Jump to content

Whats wrong with this code?


garydt

Recommended Posts

	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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.