Approximate Comparison [resend]

From: Date: Tue, 06 May 2003 21:26:38 +0000
Subject: Approximate Comparison [resend]
Groups: php.general 
Request: Send a blank email to php-general+get-146572@lists.php.net to get a copy of this message
[resend: I don't think this worked from webmail, trying from K-Mail] Hello, I'm attempting to see if $_SERVER["REQUEST_URI"] includes part of a url. Here's an example with the real URL of my script removed: <!-- For people with HTML-enabled e-mail readers, this is enclosed in <pre> tags --> <pre> if ($_POST["posted"]){ // If so, echo the following echo "<h1>* $slapper slaps $slapee with a $size $mode</h1><br>"; echo "You can link to this file with " . "<a href=\"$link\">this link</a>"; } elseif ($_POST != posted){ // Wasn't working before, let's see if this does it echo ""; } elseif ($_SERVER["REQUEST_URI"] == "http://myurl.com/my/path/myscript.php?thepartiwanttotestfor=";){ // Check and see if someone did a direct request echo "<h1>* $slapper slaps $slapee with a $size $mode</h1><br>"; echo "You can link to this file with " . "<a href=\"$link\">this link</a>"; } else { // If not, echo nothing echo ""; } It works okay when someone uses the form below all this code, but when someone uses the link (myscript.com/my/path/myscript.php?slapper=whatever&slapee=whatever&size=whatever&mode=whatever) it doesn't see $_POST includes posted (which is an input type=hidden thing in the form) so it displays nothing. So my question is, is there any way I can look for part of a string, or do an approximate comparison? Thanks :) -- Jordan C.

« previous php.general (#146572) next »