View previous topic :: View next topic |
Author |
Message |
mrpaul -
Joined: 23 Sep 2005 Posts: 18
|
Posted: Thu Sep 29, 2005 10:29 pm Post subject: if && if |
|
|
hi, i need help with a script that checks to see IF to things are what i want them to be. the script sould be checking teh refererd link to see if it came form admin.php and if it did then echo something if not then echo soemthing else.
the code:
<?php
$referer = $_SERVER['HTTP_REFERER'];
$ref = "127.0.0.1/admin.php";
if ( $referer != null) && ($referer == ref)
{ echo ("great it worked"); }
else echo ("Sorry you were not sent here by a script")
?>
Also how would i get it to check 3 things or even 4 things,
i was hoeping to make a page were people cant jsut type in the link and get error that could lead to a exploite.
the reson i need 3/4 if checks? things is i would like to add a password to this page, and i dont want people directly connecting to the page. i tried to put a if inside a if but fialed.
oh btw the error;
Parse error: parse error, unexpected T_BOOLEAN_AND in C:\Abyss Web Server\htdocs\ref.php on line 6 |
|
Back to top |
|
 |
roganty -
Joined: 08 Jun 2004 Posts: 357 Location: Bristol, UK
|
Posted: Thu Sep 29, 2005 10:33 pm Post subject: Re: if && if |
|
|
Code: | <?php
$referer = $_SERVER['HTTP_REFERER'];
$ref = "127.0.0.1/admin.php";
if ( $referer != null) && ($referer == ref)
{ echo ("great it worked"); }
else echo ("Sorry you were not sent here by a script")
?> |
remove the ")" and the "(" from either side of the "&&" so you end up with
Code: | if ( $referer != null && $referer == ref) |
simple! _________________ Anthony R
Roganty | Links-Links.co.uk |
|
Back to top |
|
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Fri Sep 30, 2005 1:46 pm Post subject: Re: if && if |
|
|
Try instead:
Code: |
if ( ( $referer != null) && ($referer == $ref) )
|
We have enclosed the condition between ( and ) as the if syntax requires. We have also changed ref to $ref. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
|