Search
Left Quote    I have not failed. I've just found 10,000 ways that won't work.
- Thomas Alva Edison    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: Help with url existance.
  This user is offline  sarvar
  Subject: "Help with url existance." Posted: @ 3:00 pm on Jun 26 2008   
Member #:
Since: 01/01/70
Posts:

Ok, I'm making a simple script. But some parts require to be passed by URL. Just IDs. Here is the example: localhost/admi n.php?id=001

How do I check if the id is blank on the url? I tried this if(!$_GET['id'] ) {
exit;
}

No hope.

Thanks in advance.

Edited at 07:47:53 pm on 06/26/08


    Viewed: 7,127 Times | Reply to This | To top
  This user is offline  David1159
  Subject: "re: Help with url existance." Posted: @ 8:47 pm on Jun 26 2008    

Member #: 526
Rank: User - (81)
Since: 12/27/07
Posts: 81
From: usa

If I understand correctly you want it to check for this
localhost/admin .php?id= more or less blank.

Simple, I use this. It states a blank(or nothing) is there.

if($_GET['id' ] == '') {
exit;
}

Theres a tad difference in !(not) too equal blank/nothing.




Coding is simply CST... Combining $hit Together. We make different $hit to run in unison correctly.

    Viewed: 7,115 Times | Reply to This | To top
  This user is offline  Genius
  Subject: "re: Help with url existance." Posted: @ 10:07 pm on Jun 26 2008    

Member #: 582
Rank: User - (77)
Since: 02/18/08
Posts: 76
From: kmmk

Hmm I think I got the issue wrong. I've tried your code still same error in the log. I was looking at the wrong part. How do you check if the id thing behind it exists or not, like:

localhost/admin .php?id=001

localhost/admin .php

how can i make the script to know when the id is being passed over the URL. like it will check if the id=001 is present after the url.



Edited at 11:08:12 pm on 06/26/08


    Viewed: 7,111 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Help with url existance." Posted: @ 11:59 pm on Jun 26 2008    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

Heres something you can do. Say you're expecting a numerical value:

if(empty($_GET[ 'id']) || (is_numeric($_G ET['id']) == false) || ($_GET['id'] < 0)) {

die('error');
}//end if




-bs0d | AllSyntax.com

    Viewed: 7,104 Times | Reply to This | To top
  This user is offline  Genius
  Subject: "re: Help with url existance." Posted: @ 2:42 am on Jun 27 2008    

Member #: 582
Rank: User - (77)
Since: 02/18/08
Posts: 76
From: kmmk

Well, I though i fixed it,but it didn't -_-.

bs0d your code only errors when user is going to localhost/admin .php?id=lol or non number id. I added that =). THANKS!

But i want it to know if id is present or not. Difference between this:
localhost/admin .php?id=001

and

localhost/admin .php


FIXED: I used
Code:

if (!isset($_GET[ 'id'])) {
smthing here;
}

to fix it.



Edited at 06:18:13 pm on 06/28/08


    Viewed: 7,099 Times | Reply to This | To top
  This user is offline  David1159
  Subject: "re: Help with url existance." Posted: @ 7:51 am on Jun 29 2008    

Member #: 526
Rank: User - (81)
Since: 12/27/07
Posts: 81
From: usa

I see what you where trying to do now. I was a confused when you said blank in your URL.

The best help comes from yourself. With trial and error, and learning.




Coding is simply CST... Combining $hit Together. We make different $hit to run in unison correctly.

    Viewed: 7,049 Times | Reply to This | To top
  This user is offline  Vilice
  Subject: "re: Help with url existance." Posted: @ 7:58 am on Jul 15 2008    
Member #: 718
Rank: User - (5)
Since: 07/14/08
Posts: 5

I think there is somthing wrong with your URL




Hostmonster special promo Discount link $4.95/mth - Unlimited storage space, unlimited bandwidth transfer http://hostmons ter.co.in

    Viewed: 6,882 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank