Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ereg worked now it doesn't

Status
Not open for further replies.

futilemonk

Technical User
Apr 26, 2006
20
US
Hello and thanks to all you brilliant volunteers!

I am not skilled with PHP and I am helping someone with their site. before i copied the site to my server this script worked (it was something similar to a dropdown menu where if you click on ABOUT a list of links would apear below the ABOUT button), but now it does not:

<? if (ereg("/home/sonvalle/public_html/needs/", $PHP_SELF)) { ?><table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#276332"><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td width="100%" class="whitenav">&raquo;&nbsp;<a href="/needs/donate/" class="whitenav">Donate</a></td></tr>
<tr bgcolor="#276332"><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td width="100%" class="whitenav">&raquo;&nbsp;<a href="/needs/fundraisers/" class="whitenav">Fundraisers</a></td></tr>
<tr bgcolor="#276332"><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td width="100%" class="whitenav">&raquo;&nbsp;<a href="/needs/wish/" class="whitenav">Wish List</a></td></tr>
<tr bgcolor="#276332"><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td width="100%" class="whitenav">&raquo;&nbsp;<a href="/needs/volunteer/" class="whitenav">Volunteer Needs</a></td></tr>
<tr bgcolor="#276332"><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td width="100%" class="whitenav">&raquo;&nbsp;<a href="/needs/waiting/" class="whitenav">Waiting List</a></td></tr>
<tr bgcolor="#276332"><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td width="100%" class="whitenav">&nbsp;</td></tr>
</table>
<? } ?>


i tried to replace ereg with preg_match and that doesn't worh either. If any has any clues I will be forever gratefull.

thanks
 
So, what exactly is not working right now? Does the if sentence not evaluate to true and the block you showed is not run?
 
Try some diagnostics - add "echo $PHP_SELF" somewhere so that you can see what its value actually is.

Also, referencing the variable that way depends on register_globals being set - if it was on the other server but isn't on yours, $PHP_SELF might be null. I recommend using $_SERVER['PHP_SELF'] instead, as it works anywhere.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top