dizzleboi1 Posted May 30, 2008 Share Posted May 30, 2008 here is the source, HELP ME! :S <?php session_start(); include "./global.php"; ?> <html> <head> <title> Forums||Admin Index</title> <link rel="stylesheet" type="text/css" href="./style.css"> <script language="javascript"> function confirmLogout(){ var agree = confirm("Are you sure you wish to log out?"); if(agree){ return true ; }else { return false ; } } </script> </head> <body> <center> <div id="holder"> <div id="userInfo"> <?php if($_SESSION['uid']){ $sql = "SELECT * FROM `users` WHERE `id`='".$_SESSION['uid']."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ session_destroy(); echo "Please <a href=\"./login.php\">Login</a> to your account, or <a href=\"./register.php\">Register</a> a new account!\n"; }else { $row = mysql_fetch_assoc($res); echo "Welcome Back, <a href=\"./index.php?act=profile&id=".$row['id']."\">".$row['username']."</a> ! <a href=\"./logout.php\" onCLick=\"return confirmLogout()\">Logout</a>\n"; echo "<br>\n"; if($row['admin'] == '1'){ echo "<a href=\"./admin.php\">Adminstrative Section</a>\n"; } } }else { echo "Please <a href=\"./login.php\">Login</a> to your account, or <a href=\"./register.php\">Register</a> a new account!\n"; } ?> </div> <div id="content"> <?php if($_SESSION['uid']){ $sql3 = "SELECT admin FROM `users` WHERE `id`='".$_SESSION['uid']."'"; $res3 = mysql_query($sql3) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "Please login to your account!\n"; }else { $row2 = mysql_fetch_assoc($res3); if($row2['admin'] !=1){ echo "You don't have the administrative rights to be on this page!\n"; }else { $act = $_GET['act']; $acts = array('create_cat','create_subcat'); $actions = array('create_cat' => 'Create Forum Category','create_subcat' => 'Create Forum Sub Category'); $x=1; $c = count($actions); foreach($actions AS $url => $link){ $bull = ($x == $c) ? "" : " • "; echo "<a href=\"./admin.php?act=".$url."\">".$link."</a>" . $bull . "\n"; $x++; } echo "<br><br>\n"; if(!$act || !in_array($act, $acts)){ echo "Please choose an option from above to continue!\n"; }else { if($act == 'create_cat') if(!$_POST['submit']){ echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n"; echo "<form method =\"post\" action\"./admin.php?act=create_cat\">\n"; echo "<tr><td>Category Name</td><td><input type=\"text\" name=\"name\"></td></tr>\n"; echo "<tr><td>Admin only?</td><td><input type =\"checkbox\" name=\"admin\" value=\"1\"></td></tr>\n"; echo "<tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"submit\" value=\"Create Forum Category\"></td></tr>\n"; echo "</form></table>\n"; }else { $name = mss($_POST['name']); $admin = $_POST['admin']; if($name){ if(strlen($name) < 3 || strlen($name) > 32){ echo "The category name must be between 3 and 32 charecters!\n"; }else { $sql4 = " SELECT * FROM `forum_cats` WHERE `name`='".$name."'"; $res4 = mysql_query($sql4) or die(mysql_error()); if(mysql_num_rows($res4) > 0){ echo "The category name already exists!\n"; }else { $admin_check =($admin == '1') ? "1" : "0"; $sql5 = "INSERT INTO `forum_cats` (`name`, `admin`) VALUES('".$name."', '".$admin_check."')"; $res5 = mysql_query($sql5) or die(mysql_error()); echo "The forum category <b>" . $name . "</b> has been sucessfully added!\n"; } } }else { echo "You must supply a category name!\n"; } } } if ($act == 'create_subcat'){ if(!$_POST['submit']){ echo "<table border=\"0\" cellspacing=\"3\">\n"; echo "<form method=\"post\" action=\"./admin.php?act=create_subcat\">\n"; echo "<tr><td>Forum Category</td><td><select name=\"cat\"><option value=\"0\">Please choose...</option>\n"; $sql6 = "SELECT * FROM `forum_cats` ORDER BY id ASC"; $res6 = mysql_query($sql6) or die(mysql_error()); if(mysql_num_rows($res6) == 0){ echo "</select><br>No categories exist\n"; }else { while($row3 = mysql_fetch_assoc($res6)){ echo "<option value=\"".$row3['id']."\">".$row3['name']."</option>\n"; } } echo "</select></td></tr>\n"; echo "<tr><td>Sub Cat. Name</td><td><input type=\"text\" name=\"name\"></td></tr>\n"; echo "<tr><td>Description</td><td><textarea name=\"desc\" style=\"width:300px;height:60px;\"></textarea></td></tr>\n"; echo "<tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"submit\" value=\"Add Forum Sub Category\"></td></tr>\n"; echo "</form></table>\n"; }else { $cat = mss($_POST['cat']); $name = mss($_POST['name']); $desc = mss($_POST['desc']); if($cat && $name && $desc){ $sql7 = "SELECT * FROM `forum_cats` WHERE `id`='".$cat."'"; $res7 = mysql_query($sql7) or die(mysql_error()); if (mysql_num_rows($res7) == 0){ echo "The forum category you supplied does not exist!\n"; }else { $sql8 = "SELECT * FROM `forum_sub_cats` `name`='".$name."' AND `cid`='".$cat."'"; $res8 = mysql_query($sql8) or die(mysql_error()); if(mysql_num_rows($res8) > 0){ echo "The forum sub category alredy exists within the main category!\n"; }else { if(strlen($desc) > 255){ echo "The description must be under 255 characters!\n"; }else { $row4 = mysql_fetch_assoc($res7); $sql9 = "INSERT INTO `forum_sub_cats` (`cid`, `name`, `desc`, `admin`) VALUES('".$cat."','".$name."','".$desc."','".$row4['admin']."')"; $res9 = mysql_query($sql9) or die(mysql_error()); echo "The forum sub category, <b>".$name."</b> has been added under the main category of <b>".$row4['name']."</b>\n"; } } ` ?> </div> </div> </center> </body> </html> Link to comment https://forums.phpfreaks.com/topic/108010-solved-parse-error-parse-error-unexpected/ Share on other sites More sharing options...
BlueSkyIS Posted May 30, 2008 Share Posted May 30, 2008 you're missing a right curly bracket: } go through your code and make sure there is a } for every { Link to comment https://forums.phpfreaks.com/topic/108010-solved-parse-error-parse-error-unexpected/#findComment-553580 Share on other sites More sharing options...
dizzleboi1 Posted May 30, 2008 Author Share Posted May 30, 2008 it didnt work i cant seem to see where im missing brackets Link to comment https://forums.phpfreaks.com/topic/108010-solved-parse-error-parse-error-unexpected/#findComment-553602 Share on other sites More sharing options...
BlueSkyIS Posted May 30, 2008 Share Posted May 30, 2008 if you indent your code blocks, the problem may become more obvious: <?php session_start(); include "./global.php"; ?> <html> <head> <title> Forums||Admin Index</title> <link rel="stylesheet" type="text/css" href="./style.css"> <script language="javascript"> function confirmLogout(){ var agree = confirm("Are you sure you wish to log out?"); if(agree){ return true ; }else { return false ; } } </script> </head> <body> <center> <div id="holder"> <div id="userInfo"> <?php if($_SESSION['uid']){ $sql = "SELECT * FROM `users` WHERE `id`='".$_SESSION['uid']."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ session_destroy(); echo "Please <a href=\"./login.php\">Login</a> to your account, or <a href=\"./register.php\">Register</a> a new account!\n"; }else { $row = mysql_fetch_assoc($res); echo "Welcome Back, <a href=\"./index.php?act=profile&id=".$row['id']."\">".$row['username']."</a> ! <a href=\"./logout.php\" onCLick=\"return confirmLogout()\">Logout</a>\n"; echo "<br>\n"; if($row['admin'] == '1'){ echo "<a href=\"./admin.php\">Adminstrative Section</a>\n"; } } } else { echo "Please <a href=\"./login.php\">Login</a> to your account, or <a href=\"./register.php\">Register</a> a new account!\n"; } ?> </div> <div id="content"> <?php if($_SESSION['uid']){ $sql3 = "SELECT admin FROM `users` WHERE `id`='".$_SESSION['uid']."'"; $res3 = mysql_query($sql3) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "Please login to your account!\n"; } else { $row2 = mysql_fetch_assoc($res3); if($row2['admin'] !=1){ echo "You don't have the administrative rights to be on this page!\n"; } else { $act = $_GET['act']; $acts = array('create_cat','create_subcat'); $actions = array('create_cat' => 'Create Forum Category','create_subcat' => 'Create Forum Sub Category'); $x=1; $c = count($actions); foreach($actions AS $url => $link){ $bull = ($x == $c) ? "" : " • "; echo "<a href=\"./admin.php?act=".$url."\">".$link."</a>" . $bull . "\n"; $x++; } echo "<br><br>\n"; if (!$act || !in_array($act, $acts)){ echo "Please choose an option from above to continue!\n"; } else { if($act == 'create_cat') if(!$_POST['submit']){ echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n"; echo "<form method =\"post\" action\"./admin.php?act=create_cat\">\n"; echo "<tr><td>Category Name</td><td><input type=\"text\" name=\"name\"></td></tr>\n"; echo "<tr><td>Admin only?</td><td><input type =\"checkbox\" name=\"admin\" value=\"1\"></td></tr>\n"; echo "<tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"submit\" value=\"Create Forum Category\"></td></tr>\n"; echo "</form></table>\n"; } else { $name = mss($_POST['name']); $admin = $_POST['admin']; if($name){ if(strlen($name) < 3 || strlen($name) > 32){ echo "The category name must be between 3 and 32 charecters!\n"; } else { $sql4 = " SELECT * FROM `forum_cats` WHERE `name`='".$name."'"; $res4 = mysql_query($sql4) or die(mysql_error()); if(mysql_num_rows($res4) > 0){ echo "The category name already exists!\n"; } else { $admin_check =($admin == '1') ? "1" : "0"; $sql5 = "INSERT INTO `forum_cats` (`name`, `admin`) VALUES('".$name."', '".$admin_check."')"; $res5 = mysql_query($sql5) or die(mysql_error()); echo "The forum category <b>" . $name . "</b> has been sucessfully added!\n"; } } } else { echo "You must supply a category name!\n"; } } } if ($act == 'create_subcat'){ if(!$_POST['submit']){ echo "<table border=\"0\" cellspacing=\"3\">\n"; echo "<form method=\"post\" action=\"./admin.php?act=create_subcat\">\n"; echo "<tr><td>Forum Category</td><td><select name=\"cat\"><option value=\"0\">Please choose...</option>\n"; $sql6 = "SELECT * FROM `forum_cats` ORDER BY id ASC"; $res6 = mysql_query($sql6) or die(mysql_error()); if(mysql_num_rows($res6) == 0){ echo "</select><br>No categories exist\n"; } else { while($row3 = mysql_fetch_assoc($res6)){ echo "<option value=\"".$row3['id']."\">".$row3['name']."</option>\n"; } } echo "</select></td></tr>\n"; echo "<tr><td>Sub Cat. Name</td><td><input type=\"text\" name=\"name\"></td></tr>\n"; echo "<tr><td>Description</td><td><textarea name=\"desc\" style=\"width:300px;height:60px;\"></textarea></td></tr>\n"; echo "<tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"submit\" value=\"Add Forum Sub Category\"></td></tr>\n"; echo "</form></table>\n"; } else { $cat = mss($_POST['cat']); $name = mss($_POST['name']); $desc = mss($_POST['desc']); if($cat && $name && $desc){ $sql7 = "SELECT * FROM `forum_cats` WHERE `id`='".$cat."'"; $res7 = mysql_query($sql7) or die(mysql_error()); if (mysql_num_rows($res7) == 0){ echo "The forum category you supplied does not exist!\n"; } else { $sql8 = "SELECT * FROM `forum_sub_cats` `name`='".$name."' AND `cid`='".$cat."'"; $res8 = mysql_query($sql8) or die(mysql_error()); if(mysql_num_rows($res8) > 0){ echo "The forum sub category alredy exists within the main category!\n"; } else { if(strlen($desc) > 255){ echo "The description must be under 255 characters!\n"; }else { $row4 = mysql_fetch_assoc($res7); $sql9 = "INSERT INTO `forum_sub_cats` (`cid`, `name`, `desc`, `admin`) VALUES('".$cat."','".$name."','".$desc."','".$row4['admin']."')"; $res9 = mysql_query($sql9) or die(mysql_error()); echo "The forum sub category, <b>".$name."</b> has been added under the main category of <b>".$row4['name']."</b>\n"; } } ?> </div> </div> </center> </body> </html> Link to comment https://forums.phpfreaks.com/topic/108010-solved-parse-error-parse-error-unexpected/#findComment-553621 Share on other sites More sharing options...
dizzleboi1 Posted May 30, 2008 Author Share Posted May 30, 2008 i seem to be missing a bracket here }else { $row2 = mysql_fetch_assoc($res3); if($row2['admin'] !=1){ echo "You don't have the administrative rights to be on this page!\n"; }else { i dont see where i should end with '}' because its confusing me a bit. the last line }else{ doesen't have ending brackett and i feel foolish to say i dont know where to put it! Link to comment https://forums.phpfreaks.com/topic/108010-solved-parse-error-parse-error-unexpected/#findComment-553623 Share on other sites More sharing options...
The Little Guy Posted May 30, 2008 Share Posted May 30, 2008 just add one before the last closing PHP tag... check it, and make sure it runs smooth. ?> </div> </div> </center> </body> </html> Link to comment https://forums.phpfreaks.com/topic/108010-solved-parse-error-parse-error-unexpected/#findComment-553625 Share on other sites More sharing options...
BlueSkyIS Posted May 30, 2008 Share Posted May 30, 2008 that first post came out nasty. i re-tabbed the code: <?php session_start(); include "./global.php"; ?> <html> <head> <title> Forums||Admin Index</title> <link rel="stylesheet" type="text/css" href="./style.css"> <script language="javascript"> function confirmLogout(){ var agree = confirm("Are you sure you wish to log out?"); if(agree){ return true ; }else { return false ; } } </script> </head> <body> <center> <div id="holder"> <div id="userInfo"> <?php if($_SESSION['uid']){ $sql = "SELECT * FROM `users` WHERE `id`='".$_SESSION['uid']."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ session_destroy(); echo "Please <a href=\"./login.php\">Login</a> to your account, or <a href=\"./register.php\">Register</a> a new account!\n"; }else { $row = mysql_fetch_assoc($res); echo "Welcome Back, <a href=\"./index.php?act=profile&id=".$row['id']."\">".$row['username']."</a> ! <a href=\"./logout.php\" onCLick=\"return confirmLogout()\">Logout</a>\n"; echo "<br>\n"; if($row['admin'] == '1'){ echo "<a href=\"./admin.php\">Adminstrative Section</a>\n"; } } } else { echo "Please <a href=\"./login.php\">Login</a> to your account, or <a href=\"./register.php\">Register</a> a new account!\n"; } ?> </div> <div id="content"> <?php if($_SESSION['uid']){ $sql3 = "SELECT admin FROM `users` WHERE `id`='".$_SESSION['uid']."'"; $res3 = mysql_query($sql3) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "Please login to your account!\n"; } else { $row2 = mysql_fetch_assoc($res3); if($row2['admin'] !=1){ echo "You don't have the administrative rights to be on this page!\n"; } else { $act = $_GET['act']; $acts = array('create_cat','create_subcat'); $actions = array('create_cat' => 'Create Forum Category','create_subcat' => 'Create Forum Sub Category'); $x=1; $c = count($actions); foreach($actions AS $url => $link){ $bull = ($x == $c) ? "" : " • "; echo "<a href=\"./admin.php?act=".$url."\">".$link."</a>" . $bull . "\n"; $x++; } echo "<br><br>\n"; if (!$act || !in_array($act, $acts)){ echo "Please choose an option from above to continue!\n"; } else { if($act == 'create_cat') if(!$_POST['submit']){ echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n"; echo "<form method =\"post\" action\"./admin.php?act=create_cat\">\n"; echo "<tr><td>Category Name</td><td><input type=\"text\" name=\"name\"></td></tr>\n"; echo "<tr><td>Admin only?</td><td><input type =\"checkbox\" name=\"admin\" value=\"1\"></td></tr>\n"; echo "<tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"submit\" value=\"Create Forum Category\"></td></tr>\n"; echo "</form></table>\n"; } else { $name = mss($_POST['name']); $admin = $_POST['admin']; if($name){ if(strlen($name) < 3 || strlen($name) > 32){ echo "The category name must be between 3 and 32 charecters!\n"; } else { $sql4 = " SELECT * FROM `forum_cats` WHERE `name`='".$name."'"; $res4 = mysql_query($sql4) or die(mysql_error()); if(mysql_num_rows($res4) > 0){ echo "The category name already exists!\n"; } else { $admin_check =($admin == '1') ? "1" : "0"; $sql5 = "INSERT INTO `forum_cats` (`name`, `admin`) VALUES('".$name."', '".$admin_check."')"; $res5 = mysql_query($sql5) or die(mysql_error()); echo "The forum category <b>" . $name . "</b> has been sucessfully added!\n"; } } } else { echo "You must supply a category name!\n"; } } } if ($act == 'create_subcat'){ if(!$_POST['submit']){ echo "<table border=\"0\" cellspacing=\"3\">\n"; echo "<form method=\"post\" action=\"./admin.php?act=create_subcat\">\n"; echo "<tr><td>Forum Category</td><td><select name=\"cat\"><option value=\"0\">Please choose...</option>\n"; $sql6 = "SELECT * FROM `forum_cats` ORDER BY id ASC"; $res6 = mysql_query($sql6) or die(mysql_error()); if(mysql_num_rows($res6) == 0){ echo "</select><br>No categories exist\n"; } else { while($row3 = mysql_fetch_assoc($res6)){ echo "<option value=\"".$row3['id']."\">".$row3['name']."</option>\n"; } } echo "</select></td></tr>\n"; echo "<tr><td>Sub Cat. Name</td><td><input type=\"text\" name=\"name\"></td></tr>\n"; echo "<tr><td>Description</td><td><textarea name=\"desc\" style=\"width:300px;height:60px;\"></textarea></td></tr>\n"; echo "<tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"submit\" value=\"Add Forum Sub Category\"></td></tr>\n"; echo "</form></table>\n"; } else { $cat = mss($_POST['cat']); $name = mss($_POST['name']); $desc = mss($_POST['desc']); if($cat && $name && $desc){ $sql7 = "SELECT * FROM `forum_cats` WHERE `id`='".$cat."'"; $res7 = mysql_query($sql7) or die(mysql_error()); if (mysql_num_rows($res7) == 0){ echo "The forum category you supplied does not exist!\n"; } else { $sql8 = "SELECT * FROM `forum_sub_cats` `name`='".$name."' AND `cid`='".$cat."'"; $res8 = mysql_query($sql8) or die(mysql_error()); if(mysql_num_rows($res8) > 0){ echo "The forum sub category alredy exists within the main category!\n"; } else { if(strlen($desc) > 255){ echo "The description must be under 255 characters!\n"; }else { $row4 = mysql_fetch_assoc($res7); $sql9 = "INSERT INTO `forum_sub_cats` (`cid`, `name`, `desc`, `admin`) VALUES('".$cat."','".$name."','".$desc."','".$row4['admin']."')"; $res9 = mysql_query($sql9) or die(mysql_error()); echo "The forum sub category, <b>".$name."</b> has been added under the main category of <b>".$row4['name']."</b>\n"; } } // SEEM TO BE MISSING SEVERAL }'s RIGHT HERE. ?> </div> </div> </center> </body> </html> Link to comment https://forums.phpfreaks.com/topic/108010-solved-parse-error-parse-error-unexpected/#findComment-553632 Share on other sites More sharing options...
dizzleboi1 Posted May 30, 2008 Author Share Posted May 30, 2008 thanks i had also noticed in my php pad that i had "`" in there beleive it or not it was like its invisible Link to comment https://forums.phpfreaks.com/topic/108010-solved-parse-error-parse-error-unexpected/#findComment-553635 Share on other sites More sharing options...
The Little Guy Posted May 30, 2008 Share Posted May 30, 2008 From How I read it, you were missing 9 braces... Tip: Instantly close a brace or parenthesis before you place anything in it. That goes for the following brace types: [ ( { final result: <?php session_start(); include "./global.php"; ?> <html> <head> <title> Forums||Admin Index</title> <link rel="stylesheet" type="text/css" href="./style.css"> <script language="javascript"> function confirmLogout(){ var agree = confirm("Are you sure you wish to log out?"); if(agree){ return true ; }else { return false ; } } </script> </head> <body> <center> <div id="holder"> <div id="userInfo"> <?php if($_SESSION['uid']){ $sql = "SELECT * FROM `users` WHERE `id`='".$_SESSION['uid']."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ session_destroy(); echo "Please <a href=\"./login.php\">Login</a> to your account, or <a href=\"./register.php\">Register</a> a new account!\n"; }else{ $row = mysql_fetch_assoc($res); echo "Welcome Back, <a href=\"./index.php?act=profile&id=".$row['id']."\">".$row['username']."</a> ! <a href=\"./logout.php\" onCLick=\"return confirmLogout()\">Logout</a>\n"; echo "<br>\n"; if($row['admin'] == '1'){ echo "<a href=\"./admin.php\">Adminstrative Section</a>\n"; } } }else{ echo "Please <a href=\"./login.php\">Login</a> to your account, or <a href=\"./register.php\">Register</a> a new account!\n"; } ?> </div> <div id="content"> <?php if($_SESSION['uid']){ $sql3 = "SELECT admin FROM `users` WHERE `id`='".$_SESSION['uid']."'"; $res3 = mysql_query($sql3) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "Please login to your account!\n"; }else{ $row2 = mysql_fetch_assoc($res3); if($row2['admin'] !=1){ echo "You don't have the administrative rights to be on this page!\n"; }else{ $act = $_GET['act']; $acts = array('create_cat','create_subcat'); $actions = array('create_cat' => 'Create Forum Category','create_subcat' => 'Create Forum Sub Category'); $x=1; $c = count($actions); foreach($actions AS $url => $link){ $bull = ($x == $c) ? "" : " • "; echo "<a href=\"./admin.php?act=".$url."\">".$link."</a>" . $bull . "\n"; $x++; } echo "<br><br>\n"; if (!$act || !in_array($act, $acts)){ echo "Please choose an option from above to continue!\n"; }else{ if($act == 'create_cat'){} if(!$_POST['submit']){ echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n"; echo "<form method =\"post\" action\"./admin.php?act=create_cat\">\n"; echo "<tr><td>Category Name</td><td><input type=\"text\" name=\"name\"></td></tr>\n"; echo "<tr><td>Admin only?</td><td><input type =\"checkbox\" name=\"admin\" value=\"1\"></td></tr>\n"; echo "<tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"submit\" value=\"Create Forum Category\"></td></tr>\n"; echo "</form></table>\n"; }else{ $name = mss($_POST['name']); $admin = $_POST['admin']; if($name){ if(strlen($name) < 3 || strlen($name) > 32){ echo "The category name must be between 3 and 32 charecters!\n"; }else{ $sql4 = " SELECT * FROM `forum_cats` WHERE `name`='".$name."'"; $res4 = mysql_query($sql4) or die(mysql_error()); if(mysql_num_rows($res4) > 0){ echo "The category name already exists!\n"; }else{ $admin_check =($admin == '1') ? "1" : "0"; $sql5 = "INSERT INTO `forum_cats` (`name`, `admin`) VALUES('".$name."', '".$admin_check."')"; $res5 = mysql_query($sql5) or die(mysql_error()); echo "The forum category <b>" . $name . "</b> has been sucessfully added!\n"; } } }else{ echo "You must supply a category name!\n"; } } } if ($act == 'create_subcat'){ if(!$_POST['submit']){ echo "<table border=\"0\" cellspacing=\"3\">\n"; echo "<form method=\"post\" action=\"./admin.php?act=create_subcat\">\n"; echo "<tr><td>Forum Category</td><td><select name=\"cat\"><option value=\"0\">Please choose...</option>\n"; $sql6 = "SELECT * FROM `forum_cats` ORDER BY id ASC"; $res6 = mysql_query($sql6) or die(mysql_error()); if(mysql_num_rows($res6) == 0){ echo "</select><br>No categories exist\n"; }else{ while($row3 = mysql_fetch_assoc($res6)){ echo "<option value=\"".$row3['id']."\">".$row3['name']."</option>\n"; } } echo "</select></td></tr>\n"; echo "<tr><td>Sub Cat. Name</td><td><input type=\"text\" name=\"name\"></td></tr>\n"; echo "<tr><td>Description</td><td><textarea name=\"desc\" style=\"width:300px;height:60px;\"></textarea></td></tr>\n"; echo "<tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"submit\" value=\"Add Forum Sub Category\"></td></tr>\n"; echo "</form></table>\n"; }else{ $cat = mss($_POST['cat']); $name = mss($_POST['name']); $desc = mss($_POST['desc']); if($cat && $name && $desc){ $sql7 = "SELECT * FROM `forum_cats` WHERE `id`='".$cat."'"; $res7 = mysql_query($sql7) or die(mysql_error()); if (mysql_num_rows($res7) == 0){ echo "The forum category you supplied does not exist!\n"; }else{ $sql8 = "SELECT * FROM `forum_sub_cats` `name`='".$name."' AND `cid`='".$cat."'"; $res8 = mysql_query($sql8) or die(mysql_error()); if(mysql_num_rows($res8) > 0){ echo "The forum sub category alredy exists within the main category!\n"; }else{ if(strlen($desc) > 255){ echo "The description must be under 255 characters!\n"; }else{ $row4 = mysql_fetch_assoc($res7); $sql9 = "INSERT INTO `forum_sub_cats` (`cid`, `name`, `desc`, `admin`) VALUES('".$cat."','".$name."','".$desc."','".$row4['admin']."')"; $res9 = mysql_query($sql9) or die(mysql_error()); echo "The forum sub category, <b>".$name."</b> has been added under the main category of <b>".$row4['name']."</b>\n"; } } } } } } } } } ?> </div> </div> </center> </body> </html> Link to comment https://forums.phpfreaks.com/topic/108010-solved-parse-error-parse-error-unexpected/#findComment-553642 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.