Warptweet Posted March 22, 2007 Share Posted March 22, 2007 I keep getting a PHP error with something that doesn't have to do with PHP at all! Here is my error: Parse error: parse error, unexpected $ in /home/warp/public_html/gm/index.php on line 730 The wierd thing is, line 730 is... </html> AND, it's OUTSIDE of the php <?php ?> things, whats wrong? Here is the last section of my code which is near line 730: if ($_GET['cmd'] == 'admin'){ if ($_GET['acp'] == 'editdecision'){ $decision = $_POST['editentry']; if ($decision == 'Keep Entry'){ echo "Administration Function Chosen: Keep Entry</br></br>The submission you selected has been successfully Kept in the Database, with no editing functions occuring."; } if ($decision == 'Decline Entry'){ $uploadid = $_POST['uploadid']; $uploadname = $_POST['uploadname']; $uploaddescription = $_POST['uploaddescription']; $uploadicon = $_POST['uploadicon']; $uploadlink = $_POST['uploadlink']; $uploadtype = $_POST['uploadtype']; $uploadgenre = $_POST['uploadgenre']; $uploadstyle = $_POST['uploadstyle']; $con = mysql_connect("localhost","warp_gm","Forest77"); if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("warp_gm", $con); $qu = mysql_query("SELECT uploadname, uploadauthor,uploadid,uploaddescription,uploadlink,deleteupload FROM pending_uploads WHERE uploadid = '$uploadid'") or DIE(mysql_error()); while ($row = mysql_fetch_array($qu)) { mysql_query("INSERT INTO declined_uploads (uploadname, uploadauthor,uploadid,uploaddescription,uploadlink) VALUES ('$uploadname', '$uploadauthor','$uploadid','$uploaddescription','$uploadlink')") or DIE(mysql_error()); mysql_query("DELETE FROM accepted_uploads WHERE uploadname = '$uploadname' AND uploadauthor='$uploadauthor' AND uploadid='$uploadid' AND uploaddescription = '$uploaddescription' AND uploadlink='$uploadlink' LIMIT 1"); } mysql_close($con); echo "Administrator Function Chosen: Decline Entry</br></br>The entry with the ID of $uploadid that was once marked as accepted and valid for Warptweet.com has not officially been deleted from the MySQL Database _gm and table accepted_uploads. Backup information and the link to this deleted upload has been stored in the MySQL Database _gm with the table name declined_uploads. OMIT: Type, Genre, Style. If a mental note or you need to write the name of the deleted upload, then please take note of the deleted uploads name: $uploadname</br></br>If there are multiple uploads with this name, you can also narrow it down by the description, if needed: $uploaddescription"; } if ($decision == 'Pend Entry'){ $uploadid = $_POST['uploadid']; $uploadname = $_POST['uploadname']; $uploaddescription = $_POST['uploaddescription']; $uploadicon = $_POST['uploadicon']; $uploadlink = $_POST['uploadlink']; $uploadtype = $_POST['uploadtype']; $uploadgenre = $_POST['uploadgenre']; $uploadstyle = $_POST['uploadstyle']; $con = mysql_connect("localhost","warp_gm","Forest77"); if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("warp_gm", $con); $qu = mysql_query("SELECT uploadname, uploadauthor,uploadid,uploaddescription,uploadlink,deleteupload FROM pending_uploads WHERE uploadid = '$uploadid'") or DIE(mysql_error()); while ($row = mysql_fetch_array($qu)) { mysql_query("INSERT INTO pending_uploads (uploadname, uploadauthor,uploadid,uploaddescription,uploadlink,deleteupload) VALUES ('$uploadname', '$uploadauthor','$uploadid','$uploaddescription','$uploadlink','no')") or DIE(mysql_error()); mysql_query("DELETE FROM accepted_uploads WHERE uploadname = '$uploadname' AND uploadauthor='$uploadauthor' AND uploadid='$uploadid' AND uploaddescription = '$uploaddescription' AND uploadlink='$uploadlink' LIMIT 1"); } mysql_close($con); echo "The upload has been successfully sent to the Pending Database List, MySQL Database _gm and the table pending_uploads. The ID of this pending upload is $uploadid, please keep note of it. For recognition, the name is $uploadname and the description is: $uploaddescription"; } } } if ($_GET['cmd'] == 'register'){ // set your infomation. $dbhost='localhost'; $dbusername='warp_gm'; $dbuserpass='Forest77'; $dbname='warp_gm'; // connect to the mysql database server. mysql_connect ($dbhost, $dbusername, $dbuserpass); mysql_select_db($dbname) or die("Cannot select database"); //Are they just getting here or submitting their info? if (isset($_POST["username"])) { $username = $_POST["username"]; $password = $_POST["password"]; $cpassword = $_POST["cpassword"]; $email = $_POST["email"]; //Was a field left blank? if($username==NULL|$password==NULL|$cpassword==NULL|$email==NULL) { echo "A field was left blank."; }else{ //Do the passwords match? if($password!=$cpassword) { echo "Passwords do not match"; }else{ //Has the username or email been used? $checkuser = mysql_query("SELECT username FROM gm_users WHERE username='$username'"); $username_exist = mysql_num_rows($checkuser); $checkemail = mysql_query("SELECT email FROM gm_users WHERE email='$email'"); $email_exist = mysql_num_rows($checkemail); if ($email_exist>0|$username_exist>0) { echo "The username or email is already in use"; }else{ //Everything seems good, lets insert. $query = "INSERT INTO gm_users (username, password, email) VALUES('$username','$password','$email')"; mysql_query($query) or die(mysql_error()); echo "The user $username has been successfully registered."; } } } echo "<h1>Register</h1> <form action=\"?cmd=register\" method=\"POST\"> <table style=\"border:1px solid #000000;\"> <tr> <td align=\"right\"> Username: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\"> </td> </tr> <tr> <td align=\"right\"> Password: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"password\"> </td> </tr> <tr> <td align=\"right\"> Confirm Password: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"cpassword\"> </td> </tr> <tr> <td align=\"right\"> Email: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"email\"> </td> </tr> <tr> <td align=\"center\"> <input type=\"submit\" value=\"Register\"> </td> </tr> <tr> <td align=\"center\"> <a href=\"?cmd=login\">Login Here</a> </td> </tr> </table> </form> </center>"; } if ($_GET['cmd'] == 'login'){ if (isset($_SESSION['s_username'])) { echo " "; }else{ // set your infomation. $dbhost='localhost'; $dbusername='warp_gm'; $dbuserpass='Forest77'; $dbname='warp_gm'; // connect to the mysql database server. mysql_connect ($dbhost, $dbusername, $dbuserpass); mysql_select_db($dbname) or die('Cannot select database'); if ($_POST['username']) { //did they supply a password and username $username=$_POST['username']; $password=$_POST['password']; if ($password==NULL) { echo "A password was not supplied"; }else{ $query = mysql_query("SELECT username,password FROM gm_users WHERE username = '$username'") or die(mysql_error()); $data = mysql_fetch_array($query); if($data['password'] != $password) { echo "The supplied login is incorrect"; }else{ $query = mysql_query("SELECT username,password FROM gm_users WHERE username = '$username'") or die(mysql_error()); $row = mysql_fetch_array($query); $_SESSION["s_username"] = $row['username']; echo "You have successfully logged in as ".$_SESSION['s_username']." and can go to the index <a href='?cmd=index'>here</a>."; } } } echo "<h1>Login</h1> <form action='?cmd=login' method='POST'> <table style='border:1px solid #000000;'> <tr> <td align='right'> Username: <input type='text' size='15' maxlength='25' name='username'> </td> </tr> <tr> <td align='right'> Password: <input type='password' size='15' maxlength='25' name='password'> </td> </tr> <tr> <td align='center'> <input type=\"submit\" value=\"Login\"> </td> </tr> <tr> <td align='center'> <a href='?cmd=register'>Register Here</a> </td> </tr> </table> </form>"; } if ($_GET['cmd'] == 'logout'){ $_SESSION = array(); echo "You are now logged out! Please click <a href=\"?cmd=index\">here</a> to go to the Home Page."; } } ?> // I ENDED THE PHP CODE HERE, THE </html> THING BELOW SHOULDNT DO ANYTHING WRONG </td> </tr> </table> </center> </div> </body> </html> // HERE IS LINE 730, WIERD HUH? Link to comment https://forums.phpfreaks.com/topic/43761-wierd-error-please-help/ Share on other sites More sharing options...
AndyB Posted March 22, 2007 Share Posted March 22, 2007 That error message indicates that you have an unclosed loop somewhere in your code. Indenting all conditionals is a great way to check that all loops are properly closed. Link to comment https://forums.phpfreaks.com/topic/43761-wierd-error-please-help/#findComment-212467 Share on other sites More sharing options...
shaunrigby Posted March 22, 2007 Share Posted March 22, 2007 It will mean unexpected end to your code, so check to see if all your statements have been closed and you have semi colons( on the end of each line... Link to comment https://forums.phpfreaks.com/topic/43761-wierd-error-please-help/#findComment-212468 Share on other sites More sharing options...
soycharliente Posted April 16, 2007 Share Posted April 16, 2007 I can't find a close brace for this line... if ($_GET['cmd'] == 'register'){ Try a close brace before this and see what happens... if ($_GET['cmd'] == 'login'){ Please try to indent your code in the future. That was PAINFUL. Link to comment https://forums.phpfreaks.com/topic/43761-wierd-error-please-help/#findComment-230140 Share on other sites More sharing options...
cyrixware Posted April 16, 2007 Share Posted April 16, 2007 yeah try to see the brackets..... and also try to follow the correct indentions of your codes as what charlieholder said. It is very hard to locate the error if you did not follow the corect indentions. Link to comment https://forums.phpfreaks.com/topic/43761-wierd-error-please-help/#findComment-230190 Share on other sites More sharing options...
bsprogs Posted April 16, 2007 Share Posted April 16, 2007 This line is where the bracket starts but is never closed if ($_GET['cmd'] == 'register'){ It's line 68 of the code you posted. Link to comment https://forums.phpfreaks.com/topic/43761-wierd-error-please-help/#findComment-230204 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.