Current location: Hot Scripts Forums » Programming Languages » PHP » Please Help me Get rid of this parse error


Please Help me Get rid of this parse error

Reply
  #1 (permalink)  
Old 06-18-04, 10:10 AM
gmjan6 gmjan6 is offline
New Member
 
Join Date: Jun 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Question Please Help me Get rid of this parse error

in this code it keeps giving me following error.
"Parse error: parse error in /mywebsite/folder/index.php on line 18"
<?
session_start();
include("../vars.php");
include("../headfoot.php");
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);
if (!isset($_SESSION['sess_name']) || !isset($_SESSION['sess_passwd'])) {
if ($_POST['form'] == 'sent') {
if ($_POST['email'] == "" || $_POST['passwd'] == "") {
echo("<head><title>$title</title><meta http-equiv=\"Refresh\" content=\"1;URL=$self_url\"></head><body><font face=\"$fontface\" color=\"red\"><span style=\"font-size:250%\">$title</span><br><span style=\"font-size:150%\">You are not authorised to view this page!</span></font></body></html>");
$_SESSION = array();
session_destroy();
mysql_close;
exit;
} else {
$_SESSION['sess_name'] = trim($_POST['email']);
$_SESSION['sess_passwd'] = md5(trim($_POST['passwd']));
header("Location: $self_url" . "members/?".session_name."="session_id());
mysql_close;
exit;
}
} else {
echo("<head><title>$title</title><meta http-equiv=\"Refresh\" content=\"1;URL=$self_url\"></head><body><font face=\"$fontface\" color=\"red\"><span style=\"font-size:250%\">$title</span><br><span style=\"font-size:150%\">Session has expired!</span></font></body></html>");
$_SESSION = array();
session_destroy();
mysql_close;
exit;
}
} else {
$res = mysql_query("select * from user where email='" . $_SESSION['sess_name'] . "'");
if (mysql_num_rows($res) != 0) {
$usrid = mysql_result($res, 0, "id");
$saved_passwd = mysql_result($res, 0, "passwd");
$saved_ac = mysql_result($res, 0, "ac");
if (md5($saved_passwd) != $_SESSION['sess_passwd']) {
echo("<head><title>$title</title><meta http-equiv=\"Refresh\" content=\"1;URL=$self_url\"></head><body><font face=\"$fontface\" color=\"red\"><span style=\"font-size:250%\">$title</span><br><span style=\"font-size:150%\">Invalid login details!</span></font></body></html>");
$_SESSION = array();
session_destroy();
mysql_close;
exit;
} elseif ($saved_ac != 0) {
$actcode = "Your account is not yet activated, please click the link below to activate your account!\n\n$self_url" . "activate.php?ac=$saved_ac&i=$usrid\n\n<a href=\"$self_url" . "activate.php?ac=$saved_ac&i=$usrid\">AOL Users</a>";
if (mail($_SESSION['sess_name'], "$title password reminder", "Your $title login is: " . $_SESSION['sess_name'] . "\n\nYour $title password is: $saved_passwd\n\n$actcode" . "Regards\n\n$title Admin\nhttp://$siteurl/", $email_headers)) {
$emaileds = "<br>Check your email for the activation link that was just resent!";
} else {
$emaileds = "<br>Please contact us immediately our mailer is not functioning!";
}
echo("<head><title>$title</title><meta http-equiv=\"Refresh\" content=\"5;URL=$self_url\"></head><body><font face=\"$fontface\" color=\"red\"><span style=\"font-size:250%\">$title</span><br><span style=\"font-size:150%\">Account not yet activated!$emaileds</span></font></body></html>");
$_SESSION = array();
session_destroy();
mysql_close;
exit;
}
} else {
echo("<head><title>$title</title><meta http-equiv=\"Refresh\" content=\"1;URL=$self_url\"></head><body><font face=\"$fontface\" color=\"red\"><span style=\"font-size:250%\">$title</span><br><span style=\"font-size:150%\">User not found!</span></font></body></html>");
$_SESSION = array();
session_destroy();
mysql_close;
exit;
}
}
$name = mysql_result($res, 0, "name");
$name = stripslashes($name);
$acctype = mysql_result($res, 0, "acctype");
$credits = mysql_result($res, 0, "credits");
$credits = round($credits, 2);
$minmax = mysql_result($res, 0, "minmax");
$la = date("Y-m-d H:i:s");
$lar = mysql_query("update user set lastaccess='$la' where id=$usrid");
$query = "select name, ";
switch ($minmax) {
case 1:
$query = $query . "ratemin ";
break;
case 0:
$query = $query . "ratemax ";
break;
}
$query = $query . "from acctype where id=$acctype";
$res = mysql_query($query);
$accname = mysql_result($res, 0, "name");
switch ($minmax) {
case 1:
$rate = mysql_result($res, 0, "ratemin");
$allow = 'Yes';
break;
case 0:
$rate = mysql_result($res, 0, "ratemax");
$allow = 'No';
break;
}
if ($accname != 1) {
$premmx = mysql_result(mysql_query("select value from adminprops where field='premmx'"), 0);
$prembn = mysql_result(mysql_query("select value from adminprops where field='prembn'"), 0);
$res = mysql_query("select premmp, UNIX_TIMESTAMP(premregdate) as premrd from user where id=$usrid");
$premrd = mysql_result($res, 0, "premrd");
$premmp = mysql_result($res, 0, "premmp");
$timest = time();
$realmp = floor(($timest - $premrd) / 2592000);
if ($realmp > $premmp && $premmp < $premmx) {
if ($realmp > $premmx) {
$realmp = $premmx;
}
$res = mysql_query("update user set premmp=$realmp, credits=credits+$prembn where id=$usrid");
$surpres = mysql_query("update adminprops set value=value-$prembn where field='surplu'");
}
}
$res = mysql_query("select id, name, url, state, credits, totalhits, hitslastmail, cph from site where usrid=$usrid");
$menu = array("<font face=$fontface size=2 style=\"text-decoration: none\" color=#000000 onmouseover=\"this.style.color='$links'\" onmouseout=\"this.style.color='#000000'\"><b>| Start Surfing |" => "/surf.php", "<font face=$fontface size=2 style=\"text-decoration: none\" color=#000000 onmouseover=\"this.style.color='$links'\" onmouseout=\"this.style.color='#000000'\"><b>| Buy credits |" => "/members/buy.php", "<font face=$fontface size=2 style=\"text-decoration: none\" color=#000000 onmouseover=\"this.style.color='$links'\" onmouseout=\"this.style.color='#000000'\"><b><b>| FAQ |" => "/faq.php", "<font face=$fontface size=2 style=\"text-decoration: none\" color=#000000 onmouseover=\"this.style.color='$links'\" onmouseout=\"this.style.color='#000000'\"><b>| Banners |" => "/members/banners.php", "<font face=$fontface size=2 style=\"text-decoration: none\" color=#000000 onmouseover=\"this.style.color='$links'\" onmouseout=\"this.style.color='#000000'\"><b>| Referral |" => "/members/referral.php", "<font face=$fontface size=2 style=\"text-decoration: none\" color=#000000 onmouseover=\"this.style.color='$links'\" onmouseout=\"this.style.color='#000000'\"><b>| Delete |" => "/members/delete.php");
$admail = mysql_result(mysql_query("select value from admin where field='email'"), 0);
if ($fform == 'edit') {
if ($fac == 'ne') {
if (md5($passwd) == $_SESSION['sess_passwd'] && ($email1 == $email2 || $email1 == $_SESSION['sess_name']) && $email1 != "" && ereg('@', $email1) && ereg('.', $email1) && $uname != "" && !ereg('%', $uname) && mysql_result(mysql_query("select count(*) from user where email='$email1'"), 0) == 0) {
$name1 = addslashes($uname);
$res = mysql_query("update user set name='$name1', email='$email1' where id=$usrid");
$_SESSION['sess_name'] = $email1;
mail($sess_name, "$title account details change", "New details for your $title account:\n\tE-mail: $sess_name\n\tName: $uname\n\n$title Admin\nhttp://$siteurl/\n$admail", $email_headers);
header("Location: ".$self_url."members/?".SID);
mysql_close;
exit;
}
header("Location: ".$self_url."members/?".SID);
mysql_close;
exit;
} elseif ($fac == 'pw') {
if (md5($passwd) == $sess_passwd && $new1 == $new2 && $new1 != "" && !ereg('%', $new1) && strlen($new1) > 5) {
$res = mysql_query("update user set passwd='$new1' where id=$usrid");
$_SESSION['sess_passwd'] = md5($new1);
mail($_SESSION['sess_name'], "$title password change", "Your password was changed to: $new1\n\n$title Admin\nhttp://$siteurl/\n$admail", $email_headers);
header("Location: ".$self_url."members/?".SID);
mysql_close;
exit;
}
header("Location: ".$self_url."members/?".SID);
mysql_close;
exit;
}
} elseif ($fform == 'upgrade') {
$res = mysql_query("update user set minmax=$uminmax where id=$usrid");
header("Location: ".$self_url."members/?".SID);
mysql_close;
exit;
} elseif ($fform == 'allocate') {
$res = mysql_query("select id from site where usrid=$usrid");
for ($i = 0; $i < mysql_num_rows($res); $i++) {
$sid = mysql_result($res, $i);
$fname = "_" . $sid;
if (is_numeric(${$fname}) && ${$fname} <= $credits && ${$fname} >= 0) {
${$fname} = round(${$fname}, 1);
$res2 = mysql_query("update site set credits=credits+${$fname} where id=$sid");
$credits = $credits - ${$fname};
} elseif (is_numeric(${$fname}) && ${$fname} >= 0) {
${$fname} = $credits;
$credits = $credits - ${$fname};
$res2 = mysql_query("update site set credits=credits+${$fname} where id=$sid");
}
}
$res = mysql_query("update user set credits=$credits where id=$usrid");
header("Location: ".$self_url."members/?".SID);
mysql_close;
exit;
} elseif ($fform == 'site') {
if (isset($sid) && is_numeric($sid)) {
if ($sid == 0 && $sname != "" && $surl != "" && ereg('http://', $surl) && !ereg('%', $sname)) {
$sname = addslashes($sname);
$res = mysql_query("insert into site (usrid, name, url, lang, state) values ($usrid, '$sname', '$surl', '$slang', 'Waiting')");
header("Location: ".$self_url."members/?".SID);
mysql_close;
exit;
} else {
if ($fac != 'trash' && $sname != "" && $surl != "" && ereg('http://', $surl) && !ereg('%', $sname) && ($acctype == 1 || is_numeric($scph))) {
$sname = addslashes($sname);
$qur = "update site set name='$sname', url='$surl', lang='$slang', state='$sstate'";
if ($acctype != 1) {$qur = $qur . ", cph=$scph";}
$qur = $qur . " where id=$sid && usrid=$usrid";
$res = mysql_query($qur);
header("Location: ".$self_url."members/?".SID);
mysql_close;
exit;
} elseif ($fac == 'trash') {
$res = mysql_query("delete from site where id=$sid && usrid=$usrid");
if (mysql_affected_rows() != 0) {
$res = mysql_query("delete from abuse where siteid=$sid");
}
header("Location: ".$self_url."members/?".SID);
mysql_close;
exit;
}
}
}
header("Location: ".$self_url."members/?".SID);
mysql_close;
exit;
} elseif ($fform == 'nope') {
header("Location: ".$self_url."members/?".SID);
mysql_close;
exit;
} else {
secheader();
echo("<p><table border=0 cellpadding=3><tr class=menu>");
while (list($k, $v) = each($menu)) {
echo("<td align=center><a href=$v>$k</a></td>");
}
echo("</tr></table></p>");
$passwd = strlen($saved_passwd);
$passwd = str_repeat('*', $passwd);
echo("<p class=big><font face=$fontface><b>User account #$usrid</b></font></p>");
echo("<p><table width=100% border=0 cellpadding=2><tr><td align=left colspan=3><b><font face=$fontface size=2>Account details:</b></td></tr><tr style=\"background-color: $cellbg1\"><td align=right valign=middle><font face=$fontface size=2><b>Name:</b></td><td align=left valign=middle><font face=$fontface size=2>$name</td><td align=center><a href=/members/edit.php><img src=/img/arrow.gif border=0 width=25 height=14 alt=\"Change\"></a></td></tr><tr style=\"background-color: $cellbg2\"><td align=right valign=middle><font face=$fontface size=2><b>E-mail:</b></td><td align=left valign=middle><font face=$fontface size=2>$sess_name</td><td align=center><a href=/members/edit.php><img src=/img/arrow.gif border=0 width=25 height=14 alt=\"Change\"></a></td></tr><tr style=\"background-color: $cellbg1\"><td align=right valign=middle><font face=$fontface size=2><b>Password:</b></td><td align=left valign=middle><font face=$fontface size=2>$passwd</td><td align=center><a href=/members/edit.php><img src=/img/arrow.gif border=0 width=25 height=14 alt=\"Change\"></a></td></tr><tr style=\"background-color: $cellbg2\"><td align=right valign=middle><font face=$fontface size=2><b>Account:</b></td><td align=left valign=middle><font face=$fontface size=2>$accname (Rate: $rate Allow minimized: $allow)</td><td align=center><a href=/members/upgrade.php><img src=/img/arrow.gif border=0 width=25 height=14 alt=\"Change\"></a></td></tr><tr style=\"background-color: $cellbg1\"><td align=right valign=middle><font face=$fontface size=2><b>Account credits:</b></td><td align=left valign=middle><font face=$fontface size=2>$credits</td><td align=center><a href=/members/allocate.php><img src=/img/arrow.gif border=0 width=25 height=14 alt=\"Allocate\"></a></td></tr></p>");
echo("<p><table width=100% border=0 cellpadding=2><tr><td align=left colspan=7><font face=$fontface size=2><b>Site details:</b></td></tr><tr style=\"background-color: $cellbg1\"><td align=left><font face=$fontface size=2><b>Site name</td><td align=left><font face=$fontface size=2><b>URL</td><td align=left><font face=$fontface size=2><b>Total hits</td><td align=left><font face=$fontface size=2><b>Since last mail</td><td align=left><font face=$fontface size=2><b>Credits</td>");
if ($acctype != 1) {echo("<td align=left><font face=$fontface size=2><b>CPH</b></font></td>");}
echo("<td align=left><font face=$fontface size=2><b>State</td><td></td></tr>");
for ($i = 0; $i < mysql_num_rows($res); $i++) {
$sname = mysql_result($res, $i, "name");
$surl = mysql_result($res, $i, "url");
$sthits = mysql_result($res, $i, "totalhits");
$sflmail = mysql_result($res, $i, "hitslastmail");
$scredits = mysql_result($res, $i, "credits");
$scredits = round($scredits, 2);
$sstate = mysql_result($res, $i, "state");
$sname = stripslashes($sname);
$sid = mysql_result($res, $i, "id");
$cph = mysql_result($res, $i, "cph");
echo("<tr style=\"background-color: $cellbg2\"><td><font face=$fontface size=2>$sname</td><td><a href=$surl target=_blank style=\"text-decoration: none\"><font face=$fontface size=2>$surl</a></td><td><font face=$fontface size=2>$sthits</td><td><font face=$fontface size=2>$sflmail</td><td><font face=$fontface size=2>$scredits</td>");
if ($acctype != 1) {echo("<td><font face=$fontface size=2>$cph</font></td>");}
echo("<td><font face=$fontface size=2>$sstate</td><form action=/members/site.php method=post><input type=hidden name=sid value=$sid><td><input type=image src=/img/arrow.gif border=0 width=25 height=14 alt=\"Change\"></td></form></tr>");
}
echo("<tr>");
if ($acctype != 1) {echo("<td></td>");}
echo("<td></td><td></td><td></td><td></td><td></td><td></td><form action=/members/site.php method=post><input type=hidden name=sid value=0><td style=\"background-color: $cellbg1\"><input type=image src=/img/arrow.gif border=0 width=25 height=14 alt=\"Add new site\"></td></form></tr></table></p>");
$res = mysql_query("select siteid, date from 7statsite, site where siteid=site.id && site.usrid=$usrid order by date desc");
for ($i = 0; $i < mysql_num_rows($res); $i++) {
$arr1[] = mysql_result($res, $i, "date");
$sidarr[] = mysql_result($res, $i, "siteid");
}
$arr1u = array();
for ($i = 0; $i < count($arr1); $i++) {
if (!in_array($arr1[$i], $arr1u)) { $arr1u[] = $arr1[$i];}
}
$sidarru = array();
for ($i = 0; $i < count($sidarr); $i++) {
if (!in_array($sidarr[$i], $sidarru)) {$sidarru[] = $sidarr[$i];}
}
if (count($arr1u) > 7) {
while (list($k, $v) = each($sidarru)) {
$res = mysql_query("delete from 7statsite where date < $arr1u[6] && siteid=$v");
}
}
$arr1u = array_slice($arr1u, 0, 7);
$arr2 = array();
while (list($k, $v) = each($arr1u)) {
$res = mysql_query("select sum(num) from 7statsite, site where date='$v' && siteid=site.id && site.usrid=$usrid");
$arr2[$v] = mysql_result($res, 0);
}
reset($arr2);
while (list($k, $v) = each($arr2)) {
$maxnum = $maxnum + $v;
}
$maxnum = round($maxnum);
echo("<p align=left><b><font face=$fontface size=2>Hits received last 7 days:</font></b><br><table border=0>");
reset($arr2);
while (list($k, $v) = each($arr2)) {
$v = round($v);
$px = 500 * ((($v * 100) / $maxnum) / 100);
$px = round($px);
echo("<tr><td>$k</td><td align=left><img src=/img/stripe.gif border=0 width=$px height=10> $v</td></tr>");
}
echo("</table></p>");
$res = mysql_query("select date from 7stat where usrid=$usrid order by date desc limit 7");
$darr = array();
for ($i = 0; $i < mysql_num_rows($res); $i++) {
$darr[] = mysql_result($res, $i);
}
if (mysql_query("select count(*) from 7stat where usrid=$usrid") > 7) {
$res = mysql_query("delete from 7stat where usrid=$usrid && date < $darr[6]");
}
$darr2 = array();
reset($darr);
while (list($k, $v) = each($darr)) {
$res = mysql_query("select num from 7stat where date='$v' && usrid=$usrid");
$darr2[$v] = mysql_result($res, 0);
}
$maxnum = 0;
reset($darr2);
while (list($k, $v) = each($darr2)) {
$maxnum = $maxnum + $v;
}
$maxnum = round($maxnum);
echo("<p align=left><b><font face=$fontface size=2>Hits earned last 7 days:</b></font><br><table border=0>");
reset($darr2);
while (list($k, $v) = each($darr2)) {
$v = round($v);
$px = 500 * ((($v * 100) / $maxnum) / 100);
$px = round($px);
echo("<tr><td><font face=$fontface size=2>$k</td><td align=left><img src=/img/stripe.gif border=0 width=$px height=10><font face=$fontface size=2> $v</td></tr>");
}
echo("</table></p>");
secfooter();
}
mysql_close;
exit;
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 06-18-04, 10:56 AM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
try this as line 18

PHP Code:

header("Location:".$self_url."members/?".session_name."="session_id()); 

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 06-18-04, 11:16 AM
gmjan6 gmjan6 is offline
New Member
 
Join Date: Jun 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by <?Wille?>
try this as line 18

PHP Code:

header("Location:".$self_url."members/?".session_name."="session_id()); 

Thanks for reply
But,I tried it but same error
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 06-18-04, 03:41 PM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
hmm.. well.. that slash looks wrong there and there is a dot missing before session_id().. might fix the problem
PHP Code:

header("Location:".$self_url."members?".session_name."=".session_id()); 

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 06-18-04, 04:32 PM
gmjan6 gmjan6 is offline
New Member
 
Join Date: Jun 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up Thanks

Thanks alot <?Wille?> You are THE MAN
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 06-19-04, 01:48 AM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by gmjan6
Thanks alot <?Wille?> You are THE MAN
i try my best..
i think you should check your quoting...
this is one of your last lines in code
PHP Code:

echo("<tr><td><font face=$fontface size=2>$k</td><td align=left><img src=/img/stripe.gif border=0 width=$px height=10><font face=$fontface size=2> $v</td></tr>"); 

shouldint it be like this?
PHP Code:

echo("<tr><td><font face=\"$fontface\" size=\"2\">$k</td><td align=\"left\"><img src=\"/img/stripe.gif\" border=\"0\" width=\"$px\" height=\"10\"><font face=\"$fontface\" size=\"2\"> $v</td></tr>"); 

although im not sure that it must be like i did it.. but i think that might be another issue about your code..

if the code works dont go change something i think is wrong.. im not that good.

well.. glad to help you
Wille
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: unexpected $ altlprsn PHP 3 05-25-04 01:59 AM
parse error help fraggle PHP 3 04-21-04 04:49 PM
parse error Abdul PHP 2 03-15-04 06:49 AM
Using Templates - Parse Error simone PHP 8 02-15-04 11:47 PM
[php error] parse error | fatal error xeoHosting PHP 1 01-03-04 09:12 PM


All times are GMT -5. The time now is 01:55 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.