Jump to content

help with login script php/html


djclewes

Recommended Posts

here is my code and i need help with why it is not letting people register or login. Once logged in i want it to take the logged in users to area.php. any help will be appriciated.

<?php
session_start();
ob_start();

//Include the database connection file
include "config.php";

//Check to see if the submit button has been clicked to process data
if(isset($_POST["submitted"]) && $_POST["submitted"] == "yes")
{
	//Variables Assignment
	$username = trim(strip_tags($_POST['username']));
	$user_password = trim(strip_tags($_POST['passwd']));
	$encrypted_md5_password = md5($user_password);
	
	$validate_user_information = mysql_query("select * from `friendship_system_users_table` where `username` = '".mysql_real_escape_string($username)."' and `password` = '".mysql_real_escape_string($encrypted_md5_password)."'");
	
	//Validate against empty fields
	if($username == "" || $user_password == "")
	{
		$error = '<br><div class="info">Sorry, all fields are required to log into your account. Thanks.</div><br>';
	}
	elseif(mysql_num_rows($validate_user_information) == 1) //Check if the information of the user are valid or not
	{
		//The submitted info of the user are valid therefore, grant the user access to the system by creating a valid session for this user and redirect this user to the welcome page
		$get_user_information = mysql_fetch_array($validate_user_information);
		$_SESSION["VALID_USER_ID"] = $username;
		$_SESSION["USER_FULLNAME"] = strip_tags($get_user_information["fullname"]);
		header("location: area.php");	}
	else
	{
		//The submitted info the user are invalid therefore, display an error message on the screen to the user
		$error = '<br><div class="info">Sorry, you have provided incorrect information. Please enter correct user information to proceed. Thanks.</div><br>';
	}
	
}
?>

<!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=utf-8" />
<title>A Cool Login System With PHP MySQL &amp jQuery | Tutorialzine demo</title>
    
    <link rel="stylesheet" type="text/css" href="demo.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="login_panel/css/slide.css" media="screen" />
    
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    
    <!-- PNG FIX for IE6 -->
    <!-- http://24ways.org/2007/supersleight-transparent-png-in-ie6 -->
    <!--[if lte IE 6]>
        <script type="text/javascript" src="login_panel/js/pngfix/supersleight-min.js"></script>
    <![endif]-->
    
    <script src="login_panel/js/slide.js" type="text/javascript"></script>
    
    </head>

<body>

<!-- Panel -->
<div id="toppanel">
	<div id="panel">
		<div class="content clearfix">
			<div class="left">	
				<p><img alt="" height="136" src="http://chatanrelax.co.uk/images/logo.gif" width="205" /></p>

			</div>
            
            
                        
			<div class="left">
				<!-- Login Form -->
			<center>
<div class="vpb_main_wrapper">
<br clear="all">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<div style="width:115px; padding-top:10px;float:left;" align="left">Your Username:</div>
<div style="width:300px;float:left;" align="left">
	<input type="text" name="username" id="username" value="" class="auto-style1" style="width: 223px"></div><br clear="all"><br clear="all">


<div style="width:115px; padding-top:10px;float:left;" align="left">Your Password:</div>
<div style="width:300px;float:left;" align="left">
<input type="password" name="passwd" id="passwd" value="" class="auto-style1" style="width: 223px"></div><br clear="all"><br clear="all">
<div style="width:300px;float:left;" align="left">
<input type="hidden" name="submitted" id="submitted" value="yes">
<input type="submit" name="submit" value="Login" style="margin-right:50px;" class="bt_login">

</div>

</form>
<br clear="all"><br clear="all">
<div style="width:450px;float:left;" align="left"><?php echo $error; ?></div><br clear="all">

</div>
</center>
			</div>
			<div class="left right">			
				<!-- Register Form -->
	<center>
<div class="vpb_main_wrapper">
<br clear="all">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<div style="width:115px; padding-top:10px;float:left;" align="left">Your Username:</div>
<div style="width:300px;float:left;" align="left">
<input type="text" name="username" id="username" value="<?php echo strip_tags($_POST["username"]); ?>" class="vpb_textAreaBoxInputs" style="width: 223px"></div><br clear="all"><br clear="all">
<div style="width:115px; padding-top:10px;float:left;" align="left">Email Address:</div>
<div style="width:300px;float:left;" align="left">
<input type="text" name="email" id="email" value="<?php echo strip_tags($_POST["email"]); ?>" class="vpb_textAreaBoxInputs" style="width: 223px"></div><br clear="all"><br clear="all">
<div style="width:115px; padding-top:10px;float:left;" align="left">Desired Password:</div>
<div style="width:300px;float:left;" align="left"><input type="password" name="passwd" id="passwd" value="" class="vpb_textAreaBoxInputs" style="width: 223px"></div><br clear="all"><br clear="all">
<input type="submit" name="submit" id="" value="Register" class="bt_register">
<input type="hidden" name="submitted" id="submitted" value="yes">
</form>
<br clear="all"><br clear="all">
<div style="width:450px;float:left;" align="left"><?php echo $error; ?></div><br clear="all">


</div>
</center>
<!-- Code Ends -->
			</div>
            
            		</div>
	</div> <!-- /login -->	

    <!-- The tab on top -->	
	<div class="tab">
		<ul class="login">
	    	<li class="left"> </li>
	        <li>Hello Guest!</li>
			<li class="sep">|</li>
			<li id="toggle">
				<a id="open" class="open" href="#">Log In | Register</a>
				<a id="close" style="display: none;" class="close" href="#">Close Panel</a>			
			</li>
	    	<li class="right"> </li>
		</ul> 
	</div> <!-- / top -->
	
</div> <!--panel -->

<div class="pageContent">
    <div id="main">
      <div class="container">
         </div>
        
        <div class="container">
        
                   <div class="clear"></div>
        </div>
        </div>

      </div>

</body>
</html>

Link to comment
Share on other sites

 

here is my code and i need help with why it is not letting people register or login.

 

 

you would start by determining why the registration process is not working. the code you posted doesn't contain the php code for that process. we would also need to know what sort of errors or symptoms you are getting that leads you to believe that registration is not working.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.