Posts: 73
Location: The Light and The Dark, a Renegade at Heart
|
I need some help trying to get a members area set up, I dont know how i can make sure that ppl can't see the members pg if they aren't logged in or anything like that........
And I also Need help with getting the username and password to pass onto the next pg (*from login script to the members area pg)
PLZ help, i want to get this done :P
Heres the code for each pg....
Login.php
PHP Code:
<html>
<head>
<title>Login</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><font face="Arial, Helvetica, sans-serif" size="5"><b>Login</b></font></p>
<form name="login" method="post" action="<?=$PHP_SELF?>">
Username: <input type="text" name="username" size="15" maxlength="15">
<br>
Password: <input type="password" name="password" size="15" maxlength="15">
<br><br>
<input type="submit" name="Login" value="Login">
<input type="reset" name="Clear" value="Clear">
</form>
<?php
// Connect to the database server
include("config.php");
// Request the info of all the info
$result = @mysql_query("SELECT username,password FROM members");
if (!$result) {
echo("<p>Error getting information: " . mysql_error() . "</p>");
} else {
while ( $row = mysql_fetch_array($result)) {
$dbusername = $row[username];
$dbpassword = $row[password];
if (($HTTP_POST_VARS[username] == $dbusername) && ($HTTP_POST_VARS[password] == $dbpassword)){
?>
<SCRIPT language="JavaScript1.1">
<!--
location.replace("http://members.lycos.co.uk/clanx/ex.php");
//-->
</SCRIPT>
<?php
} // endif
} // endwhile
} // endif
?>
</body>
</html>
ex.php (members pg)
PHP Code:
<?php
session_start();
session_register("username");
$username="$sername";
session_register("password");
$password="$password";
require("config.php");
?>
<html>
<head>
<title> Your msg's </title>
</head>
<body bgcolor="#000000" text="#C0C0C0">
<p><font color="#BB0000"> Messages: </font></p>
<blockquote>
<?php
// Request the info of all the msg's
$result = @mysql_query("SELECT * FROM msg WHERE reciever='$username' ORDER BY id ASC LIMIT 0, 30");
if (!$result) {
echo("<p>Error getting information:<br> " . mysql_error() . "</p>");
exit();
}
// If a game has been deleted,
// remove it from the database.
if (isset($deletemsg)) {
$sql = "DELETE FROM msg
WHERE ID=$deletemsg";
if (@mysql_query($sql)) {
echo("<font color=#0000B0 size=2>The message has been deleted.</font>");
} else {
echo("<font color=#0000C0 size=2>Error deleting message: " .
mysql_error() . "</font>");
}
}
?>
<?php
// Display the text of each msg
while ( $row = mysql_fetch_array($result) ) {
$ID = $row["ID"];
$message = $row["message"];
$sender = $row["sender"];
$subject = $row["subject"];
$reciever = $row["reciever"];
echo("<table width=\"600\"><tr bgcolor=\"#000080\"><td><font size=\"1\"> <b>From:</b> $sender <b>To:</b> $reciever </font></td>" .
"<tr bgcolor=\"#0000C0\"><td><font size=\"1\"> <b>Subject:</b> $subject </font></td></tr>" .
"<tr><td><font size=\"1\"> $message <br><br><a href='$PHP_SELF?deletemsg=$ID'>" .
"Delete</a></font></td></tr></table>" );
}
?>
</blockquote>
</body>
</html>
TY for any help, a REALLY appreciate it
P.S. I use a javascript redirect sicne the header of PHP never seems to work for me....
__________________
New Gaming Site Coming Soon!
Regular accounts are Free, Premium accounts are $5 to start, $2 every month after.....
Will be a Gaming Clan add-on (yeh, i have a gaming clan :) )
|