doyle_loader
06-14-2005, 11:12 PM
Hey Everyone!
I'm working at a simple authentication section with only 3 login names and 3 encrpyted passwords. I can always get that to work fine, but I tried something new and now I'm getting a white screen.
<?php
session_register("User");
if (!isset($_SESSION['User']))
{
// User not logged in, redirect to login page
Header("Location: main.html");
}
//Connect to database
$conn = mysql_connect("blah","blah","blah");
if (!$conn) {
echo "Unable to connect to DB: " . mysql_error();
exit;
}
if (!mysql_select_db("bda")) {
echo "Unable to select BDA: " . mysql_error();
exit;
}
if ($User == Student) {
$sql2 = "SELECT Link, Title, Description, Permissions
From Members
Where Permissions = '$User'
Order by Title Asc";
$result = mysql_query($sql2);
}
if ($User == Teacher) {
$sql2 = "SELECT Link, Title, Description, Permissions
From Members
Where Permissions = '$User'
Order by Title Asc";
$result = mysql_query($sql2);
}
else ($User == Administration) {
$sql2 = "SELECT Link, Title, Description, Permissions
From Members
Where Permissions = '$User'
Order by Title Asc";
$result = mysql_query($sql2);
}
?>
<html>
<head>
<title>Members Section</title>
<link href="CssFiles/body_frame.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function autofitIframe(id){ // v.1.0
//copyright 2004 Eddie Traversa http://www.dhtmlnirvana.com/
if (!window.opera && !document.mimeType && document.all && document.getElementById){
parent.document.getElementById(id).style.height=this.document.body.offsetHeight+"px";
}
else if(document.getElementById) {
parent.document.getElementById(id).style.height=this.document.body.scrollHeight+"px"
}
}
</script>
</head>
<body onload="autofitIframe('contentFRM');">
<h3><i>Welcome to the <? [Permissions] ?>'s Section</i></h3>
<?
echo "<table border=0 padding=0>";
echo "<tr><th>Your Options:</th><th>Description:</th></tr>";
/*Define Colours*/
$color1 = "white";
$color2 = "#EFEFEF";
$row_count = 0;
while ($row = mysql_fetch_assoc($result)) {
/* PHP alternate colors between the two colors defined above. */
$row_color = ($row_count % 2) ? $color1 : $color2;
// Add 1 to the row count
$row_count++;
echo "<tr><td bgcolor='$row_color' BORDER=0 CELLPADDING=0 CELLSPACING=0>";
?>
<a target="_blank" href="
<?php
echo $row['Link'];
?>">
<?php
echo $row['Title'];
?>
</a>
<?php
echo $row['Description'];
echo "</td></tr>";
}
echo "</table>";
mysql_free_result($result);
?>
<!--Log out link here!-->
<p><a href=\"logout.php\">Logout!</a></p>
</body>
</html>
What I wanted to happen was to be able to display different links on this members page for users to do stuff such as post news for users A, and B but only user B can Post News and change passwords. I figured if I used an IF statement this may work, but no dice for me . The javascript section I have there is just to expand an IFRAME's height and works fine so that shouldn't be causing the problem.
Any help would be great! Thanks!
Chris
I'm working at a simple authentication section with only 3 login names and 3 encrpyted passwords. I can always get that to work fine, but I tried something new and now I'm getting a white screen.
<?php
session_register("User");
if (!isset($_SESSION['User']))
{
// User not logged in, redirect to login page
Header("Location: main.html");
}
//Connect to database
$conn = mysql_connect("blah","blah","blah");
if (!$conn) {
echo "Unable to connect to DB: " . mysql_error();
exit;
}
if (!mysql_select_db("bda")) {
echo "Unable to select BDA: " . mysql_error();
exit;
}
if ($User == Student) {
$sql2 = "SELECT Link, Title, Description, Permissions
From Members
Where Permissions = '$User'
Order by Title Asc";
$result = mysql_query($sql2);
}
if ($User == Teacher) {
$sql2 = "SELECT Link, Title, Description, Permissions
From Members
Where Permissions = '$User'
Order by Title Asc";
$result = mysql_query($sql2);
}
else ($User == Administration) {
$sql2 = "SELECT Link, Title, Description, Permissions
From Members
Where Permissions = '$User'
Order by Title Asc";
$result = mysql_query($sql2);
}
?>
<html>
<head>
<title>Members Section</title>
<link href="CssFiles/body_frame.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function autofitIframe(id){ // v.1.0
//copyright 2004 Eddie Traversa http://www.dhtmlnirvana.com/
if (!window.opera && !document.mimeType && document.all && document.getElementById){
parent.document.getElementById(id).style.height=this.document.body.offsetHeight+"px";
}
else if(document.getElementById) {
parent.document.getElementById(id).style.height=this.document.body.scrollHeight+"px"
}
}
</script>
</head>
<body onload="autofitIframe('contentFRM');">
<h3><i>Welcome to the <? [Permissions] ?>'s Section</i></h3>
<?
echo "<table border=0 padding=0>";
echo "<tr><th>Your Options:</th><th>Description:</th></tr>";
/*Define Colours*/
$color1 = "white";
$color2 = "#EFEFEF";
$row_count = 0;
while ($row = mysql_fetch_assoc($result)) {
/* PHP alternate colors between the two colors defined above. */
$row_color = ($row_count % 2) ? $color1 : $color2;
// Add 1 to the row count
$row_count++;
echo "<tr><td bgcolor='$row_color' BORDER=0 CELLPADDING=0 CELLSPACING=0>";
?>
<a target="_blank" href="
<?php
echo $row['Link'];
?>">
<?php
echo $row['Title'];
?>
</a>
<?php
echo $row['Description'];
echo "</td></tr>";
}
echo "</table>";
mysql_free_result($result);
?>
<!--Log out link here!-->
<p><a href=\"logout.php\">Logout!</a></p>
</body>
</html>
What I wanted to happen was to be able to display different links on this members page for users to do stuff such as post news for users A, and B but only user B can Post News and change passwords. I figured if I used an IF statement this may work, but no dice for me . The javascript section I have there is just to expand an IFRAME's height and works fine so that shouldn't be causing the problem.
Any help would be great! Thanks!
Chris