php help
(8 posts, started )
#1 - CSU1
php help
Old code (throws drecated ereg warning)

<?php 
php

/*

Header include (header.inc.php)

*/
ob_start();
include 
"global.inc.php";
include 
"ghetto_cron.inc.php";

if (
ereg("217.44.214",$REMOTE_ADDR))
{
die();
}

if (
$referer)
{
    
setcookie("referer",$referer,time()+2678400);
}
?>

new code complains of syntax error unexpected '{'

<?php 
php

/*

Header include (header.inc.php)

*/
ob_start();
include 
"global.inc.php";
include 
"ghetto_cron.inc.php";

if (
preg_match("/217.44.214/","/$REMOTE_ADDR/")
{
die();
}

if (
$referer)
{
    
setcookie("referer",$referer,time()+2678400);
}
?>

...whats wrong with syntax anyone please?
You are missing one closing bracket in the if statement. Here is the fixed part of the code:

<?php 
if (preg_match("/217.44.214/","/$REMOTE_ADDR/"))
{
die();
}
?>

#3 - CSU1
Flame you little dancer!

just.could.not.figure.it.out

...was a post more of desperation than laziness I promise - thank you

E; wtf you're a mod now YAY!!!!
#4 - CSU1
nope...stuck again...I tried

At the first if statement I'm getting a Parse error: syntax error, unexpected T_STRING error.

What is wrong with my syntax please?


<?php 
php

$findPage
[page_info] = preg_replace("/username/""/$display_name/""/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/timestamp/""/$timestamp2/""/$findPage[page_info])/");
$findPage[page_info] = preg_replace("/points/""/$points/""/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/gamename/""/$gameName2/"""/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/gameid/", "/$game/", "/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/hungerlevel/", "/$hungerLevel/", "/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/pointsname/", "/$pointVar/", "/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/usersonline/", "/$countUsersOn/", "/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/totalusers/", "/$numMembers/", "/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/activepetID/", "/$activePetID/", "/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/activepet/", "/$activePetName/", "/$findPage[page_info]/");

$findPage[page_info] = preg_replace("/activepetlvl/", "/$activePetLevel/", "/$findPage[page_info]/");

if (!
$getInfo2[real_name]) { $getInfo2[real_name] = "Unknown Name"; }
$findPage[page_info] = preg_replace("/realname/", "/$pointVar/", "/$findPage[page_info])/";

if (
$getInfo2[gender] == 2) { $gender = "<font color=blue><b>Male</b></font>"; }
if (
$getInfo2[gender] == 1) { $gender = "<font color=#FF0099><b>Female</b></font>"; }
if ($getInfo2[gender] == 0) { $gender "Undecided"; }
$findPage[page_info] = preg_replace("/gender/""$gender"$findPage[page_info])/";

smilies(
$findPage[page_info]);

 
?>


page_info is a constant?

Try this btw:


<?php 

$findPage
[page_info] = preg_replace("/username/""/$display_name/""/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/timestamp/""/$timestamp2/""/$findPage[page_info])/");
$findPage[page_info] = preg_replace("/points/""/$points/""/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/gamename/""/$gameName2/""/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/gameid/""/$game/""/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/hungerlevel/""/$hungerLevel/""/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/pointsname/""/$pointVar/""/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/usersonline/""/$countUsersOn/""/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/totalusers/""/$numMembers/""/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/activepetID/""/$activePetID/""/$findPage[page_info]/");
$findPage[page_info] = preg_replace("/activepet/""/$activePetName/""/$findPage[page_info]/");

$findPage[page_info] = preg_replace("/activepetlvl/""/$activePetLevel/""/$findPage[page_info]/");

if (!
$getInfo2[real_name]) { $getInfo2[real_name] = "Unknown Name"; }
$findPage[page_info] = preg_replace("/realname/""/$pointVar/""/$findPage[page_info])/";

if (
$getInfo2[gender] == 2) { $gender "<font color=blue><b>Male</b></font>"; }
if (
$getInfo2[gender] == 1) { $gender "<font color=#FF0099><b>Female</b></font>"; }
if (
$getInfo2[gender] == 0) { $gender "Undecided"; }
$findPage[page_info] = preg_replace("/gender/""$gender""$findPage[page_info])/";

smilies($findPage[page_info]);

?>


<?php 
php

$findPage
[page_info] = preg_replace("/username/""/$display_name/"$findPage[page_info]);
$findPage[page_info] = preg_replace("/timestamp/""/$timestamp2/"$findPage[page_info]);
$findPage[page_info] = preg_replace("/points/""/$points/"$findPage[page_info]);
$findPage[page_info] = preg_replace("/gamename/""/$gameName2/"$findPage[page_info]);
$findPage[page_info] = preg_replace("/gameid/""/$game/"$findPage[page_info]);
$findPage[page_info] = preg_replace("/hungerlevel/""/$hungerLevel/"$findPage[page_info]);
$findPage[page_info] = preg_replace("/pointsname/""/$pointVar/"$findPage[page_info]);
$findPage[page_info] = preg_replace("/usersonline/""/$countUsersOn/"$findPage[page_info]);
$findPage[page_info] = preg_replace("/totalusers/""/$numMembers/"$findPage[page_info]);
$findPage[page_info] = preg_replace("/activepetID/""/$activePetID/"$findPage[page_info]);
$findPage[page_info] = preg_replace("/activepet/""/$activePetName/"$findPage[page_info]);

$findPage[page_info] = preg_replace("/activepetlvl/""/$activePetLevel/"$findPage[page_info]);

if (!
$getInfo2[real_name]) { 
        
$getInfo2[real_name] = "Unknown Name"

        
$findPage[page_info] = preg_replace("/realname/""/$pointVar/"$findPage[page_info]);

if (
$getInfo2[gender] == 2) { 
        
$gender "<font color=blue><b>Male</b></font>"
}
if (
$getInfo2[gender] == 1) { 
        
$gender "<font color=#FF0099><b>Female</b></font>"
}
if (
$getInfo2[gender] == 0) {
    
$gender "Undecided";
}
$findPage[page_info] = preg_replace("/gender/""$gender"$findPage[page_info]);

smilies($findPage[page_info]);

 
?>

Try this?
Stop writing PHP in notepad and get a half decent editor such as PHPdesigner which will notify you about these basic syntax errors...
Quote from boothy :Stop writing PHP in notepad and get a half decent editor such as PHPdesigner which will notify you about these basic syntax errors...

Yeah. Even looking at the colours on here gave away what was wrong.

php help
(8 posts, started )
FGED GREDG RDFGDR GSFDG