Lamez Posted July 16, 2008 Share Posted July 16, 2008 I am sorry if I am wasting a thread on this, but I cannot found how to fix this. I have been lookin at this for a while now, and try to remake it, but still need some help here is the error: Parse error: syntax error, unexpected T_ELSEIF in /mounted-storage/home48c/sub007/sc33591-LWQU/picks_web/admin_area/usmg/del_us.php on line 26 code: <?php ob_start(); $path = "../../"; $title = "Update Home"; $rank = "yes"; include ($path."main/include/cons/head.php"); if($session->logged_in){ if($session->isAdmin()){ $getlink = $_GET["cmd"]; if ($getlink == "yes") { if ($dele !== (md5("yes"))){ header('Location: del_us.php'); }else{ $results = mysql_query("SELECT * FROM `users`"); while($row = mysql_fetch_array($results)){ $user = $row['username']; $lvl = $row['userlevel']; if ($lvl == ('1')){ mysql_query("DELETE FROM `users` WHERE `username` = '$user'"); mysql_query("DELETE FROM `userpoints` WHERE `username` = '$user'"); $_SESSION['del_message'] = $user.' has been deleted.'; header('Location: del_us.php'); } } elseif ($getlink == "check") { $ans = $_POST['ans']; if ($ans == ("yes")){ header('Location: ?cmd=dele'); $dele = md5("yes"); } if ($ans == ("no")){ $_SESSION['del_message'] = $user.' has not been deleted.'; header('Location: del_us.php'); } } elseif ($getlink == "ask") { if (!isset($_POST['ask'])){ header('Location: del_us.php'); exit; } ?> <form id="form1" name="form1" method="post" action="?cmd=check"> <table width="100%" border="0"> <tr> <td width="29%">Are you sure you want to delete <?php echo $_POST['user']; ?></td> <td width="71%"><label> <input type="submit" name="yes" id="ans" value="Yes!" /> <input type="submit" name="no" id="ans" value="No!" /> </label></td> </tr> </table> </form> <?php } else { ?> <p class="header">Delete Users</p> <p class="maintext"> <?php echo $_SESSION['del_message']; ?> <br /> <form id="us_lvl" name="us_lvl" method="post" action="?cmd=ask"> <table width="100%" border="0"> <tr> <td width="7%">User List</td> <td width="13%"><label> <select name="user" id="user"> <?php $q = mysql_query("SELECT * FROM `users`"); while($row = mysql_fetch_array($q)); $usn = $row['username']; $lvl = $row['userlevel']; //$user_ is defined in head.php as logged in username. if ($usn !== ($user_)){ if ($lvl !== ('9')){ echo '<option value="'.$usn.'">'.$usn.'</option>'; } } } ?> </select> </label></td> <td width="14%"><label> <input type="submit" name="ask" id="ask" value="Delete" /> </label></td> <td width="66%"><label></label></td> </tr> </table> </form> </p> <?php } }else{ header('Location: '.$path.'index.php'); } }else{ header('Location: '.$path.'index.php'); } include ($path."main/include/cons/foot.php"); ?> line 26: elseif ($getlink == "check") { Quote Link to comment https://forums.phpfreaks.com/topic/114943-solved-need-fresh-pair-of-eyes-should-be-easy/ Share on other sites More sharing options...
Juan Dela Cruz Posted July 16, 2008 Share Posted July 16, 2008 i think you missed } before elseif ($getlink == "check") { if ($getlink == "yes") { if ($dele !== (md5("yes"))){ header('Location: del_us.php'); } else{ $results = mysql_query("SELECT * FROM `users`"); while($row = mysql_fetch_array($results)){ $user = $row['username']; $lvl = $row['userlevel']; if ($lvl == ('1')){ mysql_query("DELETE FROM `users` WHERE `username` = '$user'"); mysql_query("DELETE FROM `userpoints` WHERE `username` = '$user'"); $_SESSION['del_message'] = $user.' has been deleted.'; header('Location: del_us.php'); } } } } i aligned your code Quote Link to comment https://forums.phpfreaks.com/topic/114943-solved-need-fresh-pair-of-eyes-should-be-easy/#findComment-591158 Share on other sites More sharing options...
Lamez Posted July 16, 2008 Author Share Posted July 16, 2008 well If I use your code I get a whole new error: Parse error: syntax error, unexpected '}' in /mounted-storage/home48c/sub007/sc33591-LWQU/picks_web/admin_area/usmg/del_us.php on line 99 <?php ob_start(); $path = "../../"; $title = "Update Home"; $rank = "yes"; include ($path."main/include/cons/head.php"); if($session->logged_in){ if($session->isAdmin()){ $getlink = $_GET["cmd"]; if ($getlink == "yes") { if ($dele !== (md5("yes"))){ header('Location: del_us.php'); } else{ $results = mysql_query("SELECT * FROM `users`"); while($row = mysql_fetch_array($results)){ $user = $row['username']; $lvl = $row['userlevel']; if ($lvl == ('1')){ mysql_query("DELETE FROM `users` WHERE `username` = '$user'"); mysql_query("DELETE FROM `userpoints` WHERE `username` = '$user'"); $_SESSION['del_message'] = $user.' has been deleted.'; header('Location: del_us.php'); } } } } elseif ($getlink == "check") { $ans = $_POST['ans']; if ($ans == ("yes")){ header('Location: ?cmd=dele'); $dele = md5("yes"); } if ($ans == ("no")){ $_SESSION['del_message'] = $user.' has not been deleted.'; header('Location: del_us.php'); } } elseif ($getlink == "ask") { if (!isset($_POST['ask'])){ header('Location: del_us.php'); exit; } ?> <form id="form1" name="form1" method="post" action="?cmd=check"> <table width="100%" border="0"> <tr> <td width="29%">Are you sure you want to delete <?php echo $_POST['user']; ?></td> <td width="71%"><label> <input type="submit" name="yes" id="ans" value="Yes!" /> <input type="submit" name="no" id="ans" value="No!" /> </label></td> </tr> </table> </form> <?php } else { ?> <p class="header">Delete Users</p> <p class="maintext"> <?php echo $_SESSION['del_message']; ?> <br /> <form id="us_lvl" name="us_lvl" method="post" action="?cmd=ask"> <table width="100%" border="0"> <tr> <td width="7%">User List</td> <td width="13%"><label> <select name="user" id="user"> <?php $q = mysql_query("SELECT * FROM `users`"); while($row = mysql_fetch_array($q)); $usn = $row['username']; $lvl = $row['userlevel']; //$user_ is defined in head.php as logged in username. if ($usn !== ($user_)){ if ($lvl !== ('9')){ echo '<option value="'.$usn.'">'.$usn.'</option>'; } } } ?> </select> </label></td> <td width="14%"><label> <input type="submit" name="ask" id="ask" value="Delete" /> </label></td> <td width="66%"><label></label></td> </tr> </table> </form> </p> <?php } }else{ header('Location: '.$path.'index.php'); } }else{ header('Location: '.$path.'index.php'); } include ($path."main/include/cons/foot.php"); ?> line 99: }else{ header('Location: '.$path.'index.php'); } include ($path."main/include/cons/foot.php"); I do not understand why it is doing this. Quote Link to comment https://forums.phpfreaks.com/topic/114943-solved-need-fresh-pair-of-eyes-should-be-easy/#findComment-591163 Share on other sites More sharing options...
Bendude14 Posted July 16, 2008 Share Posted July 16, 2008 Well Juan Dela Cruz fixed your first error but then there was another one further down... on line 109 you had to many closing tags } before the last else. then that should fix it <?php ob_start(); $path = "../../"; $title = "Update Home"; $rank = "yes"; include ($path."main/include/cons/head.php"); if($session->logged_in){ if($session->isAdmin()){ $getlink = $_GET["cmd"]; if ($getlink == "yes") { if ($dele !== (md5("yes"))){ header('Location: del_us.php'); } else{ $results = mysql_query("SELECT * FROM `users`"); while($row = mysql_fetch_array($results)){ $user = $row['username']; $lvl = $row['userlevel']; if ($lvl == ('1')){ mysql_query("DELETE FROM `users` WHERE `username` = '$user'"); mysql_query("DELETE FROM `userpoints` WHERE `username` = '$user'"); $_SESSION['del_message'] = $user.' has been deleted.'; header('Location: del_us.php'); } } } } elseif ($getlink == "check") { $ans = $_POST['ans']; if ($ans == ("yes")){ header('Location: ?cmd=dele'); $dele = md5("yes"); } if ($ans == ("no")){ $_SESSION['del_message'] = $user.' has not been deleted.'; header('Location: del_us.php'); } } elseif ($getlink == "ask") { if (!isset($_POST['ask'])){ header('Location: del_us.php'); exit; } ?> <form id="form1" name="form1" method="post" action=""> <table width="100%" border="0"> <tr> <td width="29%">Are you sure you want to delete <?php echo $_POST['user']; ?></td> <td width="71%"><label> <input type="submit" name="yes" id="ans" value="Yes!" /> <input type="submit" name="no" id="ans" value="No!" /> </label></td> </tr> </table> </form> <?php } else { ?> <p class="header">Delete Users</p> <p class="maintext"> <?php echo $_SESSION['del_message']; ?> <br /> <form id="us_lvl" name="us_lvl" method="post" action=""> <table width="100%" border="0"> <tr> <td width="7%">User List</td> <td width="13%"><label> <select name="user" id="user"> <?php $q = mysql_query("SELECT * FROM `users`"); while($row = mysql_fetch_array($q)); $usn = $row['username']; $lvl = $row['userlevel']; //$user_ is defined in head.php as logged in username. if ($usn !== ($user_)){ if ($lvl !== ('9')){ echo '<option value="'.$usn.'">'.$usn.'</option>'; } } } ?> </select> </label></td> <td width="14%"><label> <input type="submit" name="ask" id="ask" value="Delete" /> </label></td> <td width="66%"><label></label></td> </tr> </table> </form> </p> <?php } }else{ header('Location: '.$path.'index.php'); } else{ header('Location: '.$path.'index.php'); } include ($path."main/include/cons/foot.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/114943-solved-need-fresh-pair-of-eyes-should-be-easy/#findComment-591182 Share on other sites More sharing options...
Lamez Posted July 16, 2008 Author Share Posted July 16, 2008 man I am still getting the same error as above. Quote Link to comment https://forums.phpfreaks.com/topic/114943-solved-need-fresh-pair-of-eyes-should-be-easy/#findComment-591208 Share on other sites More sharing options...
Bendude14 Posted July 16, 2008 Share Posted July 16, 2008 Once you removed the } in threw another error unexpected else try this <?php ob_start(); $path = "../../"; $title = "Update Home"; $rank = "yes"; include ($path."main/include/cons/head.php"); if($session->logged_in){ if($session->isAdmin()){ $getlink = $_GET["cmd"]; if ($getlink == "yes") { if ($dele !== (md5("yes"))){ header('Location: del_us.php'); } else{ $results = mysql_query("SELECT * FROM `users`"); while($row = mysql_fetch_array($results)){ $user = $row['username']; $lvl = $row['userlevel']; if ($lvl == ('1')){ mysql_query("DELETE FROM `users` WHERE `username` = '$user'"); mysql_query("DELETE FROM `userpoints` WHERE `username` = '$user'"); $_SESSION['del_message'] = $user.' has been deleted.'; header('Location: del_us.php'); } } } } elseif ($getlink == "check") { $ans = $_POST['ans']; if ($ans == ("yes")){ header('Location: ?cmd=dele'); $dele = md5("yes"); } if ($ans == ("no")){ $_SESSION['del_message'] = $user.' has not been deleted.'; header('Location: del_us.php'); } } elseif ($getlink == "ask") { if (!isset($_POST['ask'])){ header('Location: del_us.php'); exit; } ?> <form id="form1" name="form1" method="post" action="?cmd=check"> <table width="100%" border="0"> <tr> <td width="29%">Are you sure you want to delete <?php echo $_POST['user']; ?></td> <td width="71%"><label> <input type="submit" name="yes" id="ans" value="Yes!" /> <input type="submit" name="no" id="ans" value="No!" /> </label></td> </tr> </table> </form> <?php } else { ?> <p class="header">Delete Users</p> <p class="maintext"> <?php echo $_SESSION['del_message']; ?> <br /> <form id="us_lvl" name="us_lvl" method="post" action="?cmd=ask"> <table width="100%" border="0"> <tr> <td width="7%">User List</td> <td width="13%"><label> <select name="user" id="user"> <?php $q = mysql_query("SELECT * FROM `users`"); while($row = mysql_fetch_array($q)); $usn = $row['username']; $lvl = $row['userlevel']; //$user_ is defined in head.php as logged in username. if ($usn !== ($user_)){ if ($lvl !== ('9')){ echo '<option value="'.$usn.'">'.$usn.'</option>'; } } } ?> </select> </label></td> <td width="14%"><label> <input type="submit" name="ask" id="ask" value="Delete" /> </label></td> <td width="66%"><label></label></td> </tr> </table> </form> </p> <?php } }else{ header('Location: '.$path.'index.php'); } include ($path."main/include/cons/foot.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/114943-solved-need-fresh-pair-of-eyes-should-be-easy/#findComment-591228 Share on other sites More sharing options...
Lamez Posted July 16, 2008 Author Share Posted July 16, 2008 Hey it worked, I see what you did with the code. Thank you so much Quote Link to comment https://forums.phpfreaks.com/topic/114943-solved-need-fresh-pair-of-eyes-should-be-easy/#findComment-591244 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.