Welcome to WebmasterWorld Guest from 23.22.46.195

Forum Moderators: open

dreamweaver login forms

login form not working

   
12:35 am on Apr 23, 2009 (gmt 0)

5+ Year Member



I've created a normal php login page with mysql user table, it works fine on my local host xampp or apache2traid but when i upload it to server it doesn't work !

I'm using a session variables in code
and my php and sql on xampp is the same as web server

how can i get this to work

12:39 pm on Apr 23, 2009 (gmt 0)

5+ Year Member



You must always provide the code and error when you request assistance. This will help all those experts to identify where the problem is and provide you with a solution response.

As you have not provided the above, I would suggest you check if your server is php enabled.

4:22 pm on Apr 23, 2009 (gmt 0)

5+ Year Member



Ah, I'm sorry i didn't know that ..

the index code :


<?php require_once('Connections/connection.php'); ?><?php
// *** Validate request to login to this site.
session_start();

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}

if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "level";
$MM_redirectLoginSuccess = "teacher.php";
$MM_redirectLoginFailed = "badlogin.php";
$MM_redirecttoReferrer = true;
mysql_select_db($database_connection, $connection);

$LoginRS__query=sprintf("SELECT username, passwod, level FROM users WHERE username='%s' AND passwod='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

$LoginRS = mysql_query($LoginRS__query, $connection) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {

$loginStrGroup = mysql_result($LoginRS,0,'level');

//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;

//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");

if (isset($_SESSION['PrevUrl']) && true) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<html>
<head>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<script type="text/javascript" src="splashpage.js">

/***********************************************
* Splash Page script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>
<title>Your Elementary School</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="keywords" content="enter, keywords, here">
<meta name="description" content="enter brief description">
<style type="text/css">
<!--
a:link {
color: #660000;
}
.style5 {font-size: 14px}
body {
background-image: url(images/background.jpg);
}
.style6 {color: #FF0000}
.style7 {font-family: Tahoma}
.style8 {
font-size: 10pt;
color: #0000CC;
}
.style9 {
color: #FF0000;
font-size: 16pt;
font-weight: bold;
}
-->
</style>
</head>
<body vlink="#FFFFCC" alink="#FFFF00">
<div align="center">
<table width="800" height="600" border="0" background="images/demo.jpg">
<tr>
<td><form action="<?php echo $loginFormAction; ?>" method="POST" name="login_form" id="login_form">
<table width="291" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="40%"><span class="form">Username</span></td>
<td><input name="username" type="text" id="username2" size="25"></td>
</tr>
<tr>
<td width="40%"><span class="form">Password</span></td>
<td><input name="password" type="password" id="password2" size="25"></td>
</tr>
<tr>
<td colspan="2" class="style7"><div align="center">
<table width="200">
<tr>
<td><label>
<input name="selecttype" type="radio" value="1" checked>
Student</label></td>
<td><input type="radio" name="selecttype" value="2">
Teacher</td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td class="style7"><input name="login" type="submit" id="login2" value="Sign In"></td>
<td><span class="style5"><a href="register.php" class="style6">New User</a> - Forget Password </span></td>
</tr>
</table>
</form></td>
</tr>
</table>

</div>
</body>
</html>

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month