FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


HomeWatched TopicsRegisterSearchDirectory
FAQMemberlistUsergroupsLog inStoresItemsBank
Google

Reply to topic Page 1 of 1
Counting your cookies?
Message  
Reply with quote
Post Counting your cookies? 
Some people will be surprised to find out that you can check the number of  POST or GET or even COOKIE variables. It's actually quite simple.  So simple, it is commonly overlooked.  By utilizing the count() function, you can see the number of elements in each array. If you did not send any GET variable, the array would be empty.

    <?
    $limit = count($_GET);
    echo $list;
    ?>

    // the echo is 0

If you are not expecting any GET variables and you have one in $HTTP_GET_VARS array, you can trap it accordingly.  For example:

    $limit = count($_GET);
    if ($limit>0){
    echo (" Hacking Attempt ");
    exit;
    }
    // or redirect the suspect to an error page

    $limit = count($_GET);
    if ($limit>0){
    header(" Location:./error.php ");
    exit;
    }

You know how many variables your application is expecting in most conditions. If there are less that means that some problem may have occurred. But there is rarely a time that you would receive more than expected.

    // if you send a form with 5 fields using POST you can check this

    $limit_post=count($_POST);
    $limit_get=count($_GET);
    if ($limit_post>5||$limit_get>0){
    echo (" Hacking Attempt ");
    exit;
    }


http://www.devshed.com/c/a/PHP...riables/1/

View user's profile Send private message
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  



Google

FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


Web Design by PlatinumShore.com & Web Hosting by TradeWebHosting.com