Zoofu Posted August 19, 2009 Share Posted August 19, 2009 <?php if(!$_POST['submit']){ echo "Invalid Path!"; }else { $tid = mss($_GET['id']); $msg = mss($_POST['reply']); if(!$tid){ echo "Invalid Path!"; }else { $sql = "SELECT * FROM `forum_topics` WHERE `id`='".$tid."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "Invalid Path!"; }else { $row = mysql_fetch_assoc($res); $sql2 = "SELECT admin FROM `forum_subcats` WHERE `id`='".$row['cid']."'"; $res2 = mysql_query($sql2) or die(mysql_error()); $row2 = mysql_fetch_assoc($res2); if($row2['admin'] == 1 && $admin_user_level == 0){ echo "You do not have permission!"; }else { if(!$msg){ echo "You did not supply a message!"; }else { if(strlen($msg) < 1 || strlen($msg) > 10000){ echo "Your reply must range from 1-8,000 characters!"; }else { $date = date("m-D-y") . " at " . date("h:i:s"); $time = time(); $sql3 = "INSERT INTO `forum_replies` (`tid`,`uid`,`message`,`date`,`time`) VALUES('".$tid."','".$_SESSION['uid']."','".$msg."','".$date."','".$time."')"; $res3 = mysql_query($sql3) or die(mysql_error()); $sql4 ="UPDATE `forum_topics` SET `time`='".time()."' WHERE `id`='".$tid."'"; $res4 = mysql_query($sql3) or die(mysql_error()); header("Location: ./index.php?act=topic&id=".$tid); } } } } } } ?> It's just outputting Invalid Path whenever I submit it, why is it ignoring the rest? Link to comment https://forums.phpfreaks.com/topic/170945-why-is-it-doing-this/ Share on other sites More sharing options...
TeNDoLLA Posted August 19, 2009 Share Posted August 19, 2009 Are you sure you are getting the $_GET variable to the $tid variable? Try var_dumping the variables in your code to see what they contains. Link to comment https://forums.phpfreaks.com/topic/170945-why-is-it-doing-this/#findComment-901580 Share on other sites More sharing options...
Zoofu Posted August 19, 2009 Author Share Posted August 19, 2009 It was earlier, I could have to move the script around a bit? Link to comment https://forums.phpfreaks.com/topic/170945-why-is-it-doing-this/#findComment-901584 Share on other sites More sharing options...
TeNDoLLA Posted August 19, 2009 Share Posted August 19, 2009 You should put var_dump($_POST['submit']) before the if clause, and also var_dump($tid); before the another if clause where the 'Invalid path!' echos are located to see if the variables are actualle considered false when you run the scripts and make the submit. There is only two places where you echo that and it must be that some of the variables stays false for some reason. You should debug then and test the script to see why they are false. Link to comment https://forums.phpfreaks.com/topic/170945-why-is-it-doing-this/#findComment-901585 Share on other sites More sharing options...
Zoofu Posted August 19, 2009 Author Share Posted August 19, 2009 Except from the fact it's doing it here: if(!$_POST['submit']){ echo "Invalid Path!"; It's going to that invalid path. Link to comment https://forums.phpfreaks.com/topic/170945-why-is-it-doing-this/#findComment-901936 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.