RecklessCounty Posted July 6, 2007 Share Posted July 6, 2007 I keep getting this error when trying to view newcity.php (I'm working on it!) Parse error: syntax error, unexpected $end in /home/atkscape/public_html/newcity.php on line 69 <?php /** * @author ShannenName * @copyright 2007 */ session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm); $h->menuarea(); if ($ir['user_level'] != 2) { print "You sneak, get out of here!"; $h->endpage(); exit; } $posta = mysql_real_escape_string(print_r($_POST, 1), $c); $geta = mysql_real_escape_string(print_r($_GET, 1), $c); mysql_query("INSERT INTO adminlogs VALUES('', $userid, '$posta', '$geta', unix_timestamp() )", $c); switch ($_GET['action']) { case 'newcity': new_city(); break; case 'newcitysub': new_city_sub(); break; case 'editcity': edit_city(); break; case 'editcitysub': edit_city_sub(); break; function new_city() { global $ir, $c, $h, $userid; print "Create New City This will create a new city. cityname: cityid: citydesc: cityminlevel "; } function new_city_sub() { global $ir, $c, $h, $userid; mysql_query("INSERT INTO city VALUES ('', '{$_POST['cityname']}', '{$_POST['cityid']}', '{$_POST['citydesc']}', '{$_POST['cityminlevel']}', $c);", $c); print "[url='admin.php']> Back[/url]"; $h->endpage(); ?> can someone tell me why and how to fix this? Quote Link to comment Share on other sites More sharing options...
John99 Posted July 6, 2007 Share Posted July 6, 2007 Re: End page error No closeing the function function new_city_sub() { global $ir, $c, $h, $userid; mysql_query("INSERT INTO city VALUES ('', '{$_POST['cityname']}', '{$_POST['cityid']}', '{$_POST['citydesc']}', '{$_POST['cityminlevel']}', $c);", $c); print "[url='admin.php']> Back[/url]"; $h->endpage(); ?> replace with function new_city_sub() { global $ir, $c, $h, $userid; mysql_query("INSERT INTO city VALUES ('', '{$_POST['cityname']}', '{$_POST['cityid']}', '{$_POST['citydesc']}', '{$_POST['cityminlevel']}', $c);", $c); print "[url='admin.php']> Back[/url]"; } $h->endpage(); ?> try that Quote Link to comment Share on other sites More sharing options...
Dabomstew Posted July 7, 2007 Share Posted July 7, 2007 Re: End page error Also, the cities table name in MCCodes is cities, unless you changed it. Here's your code working for v1 (you dont specify a cityid, its automatically generated on insert) <?php /** * @author ShannenName * @copyright 2007 */ session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm); $h->menuarea(); if ($ir['user_level'] != 2) { print "You sneak, get out of here!"; $h->endpage(); exit; } $posta = mysql_real_escape_string(print_r($_POST, 1), $c); $geta = mysql_real_escape_string(print_r($_GET, 1), $c); mysql_query("INSERT INTO adminlogs VALUES('', $userid, '$posta', '$geta', unix_timestamp() )", $c); switch ($_GET['action']) { case 'newcity': new_city(); break; case 'newcitysub': new_city_sub(); break; case 'editcity': edit_city(); break; case 'editcitysub': edit_city_sub(); break; function new_city() { global $ir, $c, $h, $userid; print "<h3>Create New City</h3> This will create a new city. <form action='newcity.php?action=newcitysub' method='post'> cityname: <input type='text' name='cityname' /> citydesc: <input type='text' name='citydesc' /> cityminlevel <input type='text' name='cityminlevel' /> <input type='submit' value='Create New city' /></form>"; } function new_city_sub() { global $ir, $c, $h, $userid; $_POST['cityminlevel']=abs((int) $_POST['cityminlevel']); mysql_query("INSERT INTO cities (cityname, citydesc, cityminlevel) VALUES ('{$_POST['cityname']}', '{$_POST['citydesc']}', '{$_POST['cityminlevel']}');", $c); print "[url='admin.php']> Back[/url]"; $h->endpage(); } ?> Quote Link to comment Share on other sites More sharing options...
RecklessCounty Posted July 8, 2007 Author Share Posted July 8, 2007 Re: End page error Ok will try! Quote Link to comment Share on other sites More sharing options...
RecklessCounty Posted July 8, 2007 Author Share Posted July 8, 2007 Re: End page error function new_city_sub() { global $ir, $c, $h, $userid; $_POST['cityminlevel']=abs((int) $_POST['cityminlevel']); mysql_query("INSERT INTO cities (cityname, citydesc, cityminlevel) VALUES ('{$_POST['cityname']}', '{$_POST['citydesc']}', '{$_POST['cityminlevel']}');", $c); print "[url='admin.php']> Back[/url]"; } $h->endpage(); ?> is that correct because this is what I get Parse error: syntax error, unexpected $end in /home/atkscape/public_html/newcity.php on line 68 Quote Link to comment Share on other sites More sharing options...
KyleCrispy Posted July 9, 2007 Share Posted July 9, 2007 Re: End page error change this part: function new_city_sub() { global $ir, $c, $h, $userid; $_POST['cityminlevel']=abs((int) $_POST['cityminlevel']); mysql_query("INSERT INTO cities (cityname, citydesc, cityminlevel) VALUES ('{$_POST['cityname']}', '{$_POST['citydesc']}', '{$_POST['cityminlevel']}');", $c); print "[url='admin.php']> Back[/url]"; } $h->endpage(); ?> TO: function new_city_sub() { global $ir, $c, $h, $userid; $_POST['cityminlevel']=abs((int) $_POST['cityminlevel']); mysql_query("INSERT INTO cities (cityname, citydesc, cityminlevel) VALUES ('{$_POST['cityname']}', '{$_POST['citydesc']}', '{$_POST['cityminlevel']}');", $c); print "[url='admin.php']> Back[/url]"; } $h->endpage(); } ?> If it re gives u the Parse error: syntax error, unexpected $end in /home/atkscape/public_html/newcity.php on line 68 error then add another } to this lil part $h->endpage(); } ?> just like Crazy-T Stated Quote Link to comment Share on other sites More sharing options...
Matty Posted July 9, 2007 Share Posted July 9, 2007 Re: End page error Lol Kyle, do you know how to code... YOU DON'T JUST ADD { to the end of the code, if its saying that error then obviously something hasn't been closed. What I would do is make sure each open bracket has a closing bracket. In the long run what your saying kyle is VERY bad coding and will fuck up your code and will be a nightmare if you add something something else in there. Still you carry on... then add another } to this lil part Code: $h->endpage(); } ?> just like Crazy-T Stated Sure why don't you just close all your IFs and Functions at the end of the page... Quote Link to comment Share on other sites More sharing options...
KyleCrispy Posted July 12, 2007 Share Posted July 12, 2007 Re: End page error DUDE of course if u dont know about the errors yet this one means its missing a } at the end Parse error: syntax error, unexpected $end in /home/atkscape/public_html/newcity.php on line 69 then u get others wich say unexpect } or missing a } or { but i do fucking know what this one means Parse error: syntax error, unexpected $end in /home/atkscape/public_html/newcity.php on line 69 SO SHUT UP and stop trying to exploit my game ok! Quote Link to comment Share on other sites More sharing options...
Decepti0n Posted July 12, 2007 Share Posted July 12, 2007 Re: End page error Haha, obviously you dont know error's here: case 'editcitysub': edit_city_sub(); break; function new_city() { Put a } after break; (unless you already fixed it) although, that last function did need to be closed Quote Link to comment Share on other sites More sharing options...
Matty Posted July 12, 2007 Share Posted July 12, 2007 Re: End page error DUDE of course if u dont know about the errors yet this one means its missing a } at the end Code: Parse error: syntax error, unexpected $end in /home/atkscape/public_html/newcity.php on line 69 then u get others wich say unexpect } or missing a } or { but i do fucking know what this one means Code: Parse error: syntax error, unexpected $end in /home/atkscape/public_html/newcity.php on line 69 SO SHUT UP and stop trying to exploit my game ok! Go learn some more little boy if you have { } { { } Then there is a missing } of course the code is going to think that if you add if to the end that error will go becuase YOUR NOW CLOSING IT, BUT what your missing is that fact that its in the wrong PLACE! Likewise in this situation where depeception has proved that it wasnt at the end. SO SHUT UP and stop trying to exploit my game ok! LOL! Im not shutting up to some kid that thinks he knows how to code when he clearly cant. I wouldnt mind if you accepted the fact that doing what you said works but is very bad coding... Still, I thought we sorted out that little problem about errr a few months back, growup. Quote Link to comment Share on other sites More sharing options...
RecklessCounty Posted July 13, 2007 Author Share Posted July 13, 2007 Re: End page error Thanks Decepti0n worked liked a charm! I also found a program that when you click before or after a } or { it highlights green if it has a matching } or { and red if it doesnt (if matching found it also highlights green) It's called PHP Designer 2007 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.