Here is the code for the login page...
PHP Code:
<?php require_once('Connections/users.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_users, $users);
$query_musicians = "SELECT * FROM musicians WHERE musicians.email AND musicians.password";
$musicians = mysql_query($query_musicians, $users) or die(mysql_error());
$row_musicians = mysql_fetch_assoc($musicians);
$totalRows_musicians = mysql_num_rows($musicians);
?><?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['email'])) {
$loginUsername=$_POST['email'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "musicianscp/";
$MM_redirectLoginFailed = "login/failure";
$MM_redirecttoReferrer = false;
mysql_select_db($database_users, $users);
$LoginRS__query=sprintf("SELECT email, password FROM musicians WHERE email=%s AND password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $users) 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']) && false) {
$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>
<link href="css/menu.css" media="screen" type="text/css" />
<link href="css/main.css" media="screen" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Getaband.net: Get out there and play!</title>
<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must be a valid e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
} }
//-->
</script>
</head>
<body>
<center>
<table align="center" width="750">
<tr>
<td colspan="2" align="center">
<img src="media/banner.png" /></td>
</tr>
<tr>
<td height="196" width="180" valign="top">
<div class="arrowgreen">
<ul>
<li><a href="index.php" title="Home">Home</a></li>
<li><a href="blog.php" title="Team Blog">Team Blog</a></li>
<li><a href="tour.php" title="Tour Getaband.net">Take a tour</a></li>
<li><a href="register.php?page=home" title="Sign Up for Getaband.net. Its Free!">Register</a></li>
</ul>
</div>
<br />
<div class="login">
<form action="<?php echo $loginFormAction; ?>" method="POST" name="login" target="_self" id="login">
<span class="header">Musicians Login</span>
<br />
<label>Email Address:
<br />
<input type="text" name="email" id="email" />
</label>
<br />
<label>Password:<br />
<input type="password" name="password" id="password" />
</label>
<br />
<label>
<input name="Login" type="submit" id="Login" onclick="MM_validateForm('email','','RisEmail','password','','R');return document.MM_returnValue" value="Login" />
</label>
<p><a href="login/select.php">Other logins</a></p>
</form>
</div></td>
<td align="left" valign="top">
<div class="article">
<span class="header">Welcome to Getaband.net</span>
<p>This is a community of musicians, bands, and fans that provides opportunities for everyone. You can take a tour of almost every part of our site for any type of account.</p>
</div>
<br />
<div class="article">
<span class="header">Why Join?</span>
<p>Getaband.net is a site that was created for musicians and bands. The main purpose is to get into your dream band without having to post posters, banners, newspaper ads to try. You can either manually search musicians or have our automatic musician search application search for you. Even though it is a little complicated to use, we have posted a full tutorial with everything covered.</p>
</td>
</table>
</center>
<div>
</div>
</body>
</html>
<?php
mysql_free_result($musicians);
?>
What can I do to get it to get it to transfer as either a session, cookie or something...
Thanks!
Bookmarks