<?php require_once('Connections/useraccounts.php'); ?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['textfield'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "/clients/";
$MM_redirectLoginFailed = "/loginfailed.php";
$MM_redirecttoReferrer = true;
mysql_select_db($database_useraccounts, $useraccounts);
$LoginRS__query=sprintf("SELECT username, password FROM Useraccounts WHERE username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $useraccounts) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && true) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>FreeHill Productions</title>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
color: #FFFFFF;
font-weight: bold;
}
body {
background-color: #000000;
}
-->
</style></head>
<body>
<div align="center">
<p><a href="Demoreel/stream.html"></a></p>
<p> </p>
<p> </p>
<p> </p>
<form ACTION="<?php echo $loginFormAction; ?>" id="clientlogin" name="clientlogin" method="POST">
<table width="275" height="108" border="0">
<tr>
<td> </td>
<td><label>
<div align="center">Username
<input name="username" type="text" id="username" />
</div>
</label></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><label>
<div align="center">Password
<input type="password" name="textfield" />
</div>
</label></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><label>
<div align="center">
<input type="submit" name="Submit" value="Submit" />
</div>
</label></td>
<td> </td>
</tr>
</table>
<label></label>
<p>
<label></label>
<label></label>
</p>
</form>
<p> </p>
<p> </p>
</div>
</body>
</html>
this is my login page, I'd like to have it direct the successful login to another page, possibly successfullogin.php, this page would direct the user to their individual folder based on the link I've got in the mysql database. I know so little about this, thank you for all the help. Please let me know if you need more information
Perhaps you could try this...
Successfullogin.php...
Make the client login a session variable..
[PHP]
<?php
start_session();
$client=$_SESSION['client'];
$echotable=mysql_fetch_array(myql_query("SELECT * FROM `tablename` WHERE `client`='$client'"));
echo $echotable[0];
?>
[/PHP]
Also, in your regular login page... Try using arrays instead of the $MM__stuff..
[PHP]
Was...
$loginUsername=$_POST['username'];
$password=$_POST['textfield'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "/clients/";
$MM_redirectLoginFailed = "/loginfailed.php";
$MM_redirecttoReferrer = true;
Now...
$loginUsername=$_POST['username'];
$password=$_POST['textfield'];
$MM=array("", "clients", "loginfailed.php", "true");
[/PHP]
And you simply call $MM by number entered.. like $MM_fldUserAuthorization would instead be $MM[0].