garydt Posted October 9, 2007 Share Posted October 9, 2007 session_start(); $disc = $_GET['topic']; $logon = ($_SESSION['MM_Username']); mysql_select_db($database_elvisdb, $elvisdb); $query_Recordset6 = "SELECT * FROM discussions WHERE discnum='$disc'"; $Recordset6 = mysql_query($query_Recordset6, $elvisdb) or die(mysql_error()); $row_Recordset6 = mysql_fetch_assoc($Recordset6); $top = $row_Recordset6['topic']; $prv = $row_Recordset6['private']; $u = $row_Recordset6['user']; $u1 = $row_Recordset6['user1']; $u2 = $row_Recordset6['user2']; $u3 = $row_Recordset6['user3']; $u4 = $row_Recordset6['user4']; $u5 = $row_Recordset6['user5']; $totalRows_Recordset6 = mysql_num_rows($Recordset6); if ($prv=="Yes") { if ($logon=='') { header("Location: login.php"); } if ($logon!='$u') { header("Location: forum.php"); } else { } } I've made a forum where users can create private discussions where upto 5 other users are allowed in the discussions. $logon is the current logged on user and $u is one of the allowed users. If the allowed user is logged on and tries to view the private discussion it won't let them. It also doesn't let any user view the private discussion which doesn't makes sence. What have i got wrong? Link to comment https://forums.phpfreaks.com/topic/72497-whats-wrong-with-this-code/ Share on other sites More sharing options...
trq Posted October 9, 2007 Share Posted October 9, 2007 What do you meen by won't let them? What happens? Link to comment https://forums.phpfreaks.com/topic/72497-whats-wrong-with-this-code/#findComment-365564 Share on other sites More sharing options...
garydt Posted October 9, 2007 Author Share Posted October 9, 2007 it doesn't open the discussion page, it just goes to forum.php - if ($logon!='$u') { header("Location: forum.php"); } else { } Link to comment https://forums.phpfreaks.com/topic/72497-whats-wrong-with-this-code/#findComment-365570 Share on other sites More sharing options...
trq Posted October 9, 2007 Share Posted October 9, 2007 Variables are not parsed within single quotes. Try... if ($logon != $u) { Link to comment https://forums.phpfreaks.com/topic/72497-whats-wrong-with-this-code/#findComment-365572 Share on other sites More sharing options...
garydt Posted October 9, 2007 Author Share Posted October 9, 2007 Thanks Tried that. Still doesn't work. Link to comment https://forums.phpfreaks.com/topic/72497-whats-wrong-with-this-code/#findComment-365582 Share on other sites More sharing options...
garydt Posted October 9, 2007 Author Share Posted October 9, 2007 can any1 help? Link to comment https://forums.phpfreaks.com/topic/72497-whats-wrong-with-this-code/#findComment-365654 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.