SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 31 of 31
  1. #26
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ???????????

    Where did $count = array(); come from and what purpose does it serve?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  2. #27
    SitePoint Enthusiast mahmoud's Avatar
    Join Date
    May 2001
    Location
    Egypt
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wrote it above the:
    PHP Code:
    $url_array explode("/",$PATH_INFO);
    for(
    $i=1;$i<count($url_array);$i++) {
    $data[$url_array[$i]] = $url_array[++$i];
    }
    $count count($data);
    if(
    count($data) > 0) { 
    extract($data); 

    so I can prevent someone from using $count in the url:
    ex.
    index.php/count/2
    because it did not stop the $count in the url from being changed

    this is the case to $DOCUMENT_ROOT also ..

    so index.php/DOCUMENT_ROOT/whatever

    changes the Document root however ?DOCUMENT_ROOT=whatever does not change anything

    Any solution?
    Mahmoud

  3. #28
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am sorry man, everytime I give you a solution you change the code around on me. I am still wondering why you are so worried about someone putting count on the end of a url, are you running an enterprise level app where your customers privacy is a legal concern? If not, I wonder why you are so stuck on controlling the url string, like I have said before these links are generated within your site right? So you control what goes in them. Also just giving blurbs of code here and there isn't going to get anything done.

    Try spelling out exactly what this script is supposed to do, and show us more than just 4 lines of code. I have no idea what this script is even supposed to do, but I am imaging ther eis a much simpler way to do it.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  4. #29
    SitePoint Enthusiast mahmoud's Avatar
    Join Date
    May 2001
    Location
    Egypt
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    not enterprise level app nor a legal concern
    it is just a simple script which includes files and puts $var depending on the $var in the http url

    Anyway I do not care now if he changed the count nor the Document Root .. he is the one who is going to get errors so no problem for me

    Thanks for your help ..

    Your Homepage is password protected
    Do you have any other Homepages?
    Mahmoud

  5. #30
    imagine no limitations exbabylon's Avatar
    Join Date
    Dec 2000
    Location
    Idaho, USA
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I have designed "enterprise" level apps, but come on! If you code tightly, then there will be no room for error.

    You need to fully understand the way a scripting language works. PHP is one of my favorites becuase of the massive numbers of pre-defined functions available in it. Many newbie programmers assign the "return" of each individual function to a variable, making their code easier to view.

    You never use $count in your code, therefore there is no risk. The function count() RETURNS a value, it is NOT a value. What count() returns the number of sets of values/keys in an array. Freddydoesphp's code just checked to make sure that there was something for extract() to work with.

    extract() may be confusing to you, as it does not work as the majority of PHP's built in functions. Instead of returning a value, it actually performs a task. However, most of the time a function returns a value, therefore you must either use them in a control structure, in place of a varialbe. or assign it's return to a variable.

    Hopefully I'm being slightly helpfull, but please, post more of your code!

    God Bless,

    Alex Stanton
    Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.

    Exbabylon- Professional Internet Services

  6. #31
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My homepage is password protected because there is nothing there for you to see. If you are looking for examples of my work, you should try http://www.uniquefocus.com thats where I work.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •