PDA

View Full Version : Help with $REQUEST_URI!!



Zoom
April 29th, 2001, 00:13
I have PHPscript:



<?php
$num=$REQUEST_URI;
$num = eregi_replace ( "http://www.bla-bla.com", "", $num );
$num = eregi_replace ( ".php", "", $num );
?>


it cuts from $num "http://www.bla-bla.com" and ".php"!
But how can i edit this script to cut all after .php, for example the url bar is: http://www.bla-bla.com/df.php3?434
and $num will be "df"

HELP!!!!!!!

lucifer
April 29th, 2001, 18:38
replace

$num = eregi_replace ( ".php", "", $num );

with

$num = preg_replace ( "/.php.*/", "", $num );

jw
April 29th, 2001, 21:31
or just use the $QUERY_STRING variable which stores anything after the question mark.