Jump to content

PHP Help for Registration and Login Page


finkrattaz

Recommended Posts

I am try to get the User Registration Validated and input the information throught the connection and then it opens it goes to the login page.

 

USER REGISTRATION

 

<?php

require_once('dbcon2.php');

if(isset($_POST['submit'])) {

}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>Registration Page</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="JavaScript" type="text/javascript">

function validationregistration()

var frmvalidator = new Validator("registration");

 

frmvalidator.addValidation("name","req","Please enter your Name");

frmvalidator.addValidation("name");

frmvalidator.addValidation("name","alpha");

 

frmvalidator.addValidation("login","req","Please enter your Login");

frmvalidator.addValidation("login");

 

frmvalidator.addValidation("password","req","Please enter your Password");

frmvalidator.addValidation("password");

 

frmvalidator.addValidation("reenter","req","Please re-enter your Password");

frmvalidator.addValidation("reenter");

 

var frm = document.forms["registration"];

if(frm.password.value != frm.reenter.value)

{

alert('The Password and verified password does not match!');

return false;

}

else

{

return true;

}

}

</script>

</head>

 

<body bgcolor="#000000">

<center>

<form name="registration" id="registration" action="dbcon2.php" method="post" onSubmit="return validationregistration()">

<table width="500" border="0" cellspacing="1" cellpadding="1">

<tr>

<td colspan="2" align="center"><font face="tahoma" size="3" color="white"><b>USER REGISTRATION</b></font></td>

</tr>

<tr>

<td> </td>

<td> </td>

</tr>

<tr>

<td><p> <font face="tahoma" size="2" color="white">User Name:</font></td>

<td><font face="tahoma" size="2" color="white"><input name="dealername" type="text" id="dealername"></font></td>

</tr>

<tr>

<td><font face="tahoma" size="2" color="white">Dealership:</font></td>

<td><font face="tahoma" size="2" color="white"><input name="dealership" type="text"></font></td>

</tr>

<tr>

<td><font face="tahoma" size="2" color="white">City:</font></td>

<td><font face="tahoma" size="2" color="white"><input name="city" type="text"></font></td>

</tr>

<tr>

<td><font face="tahoma" size="2" color="white">State:</font></td>

<td><font face="tahoma" size="2" color="white"><input name="state" type="text"></font></td>

</tr>

<tr>

<td><font face="tahoma" size="2" color="white">Zip Code:</font></td>

<td><font face="tahoma" size="2" color="white"><input name="zip" type="text"></font></td>

</tr>

<tr>

<td><font face="tahoma" size="2" color="white">Email:</font></td>

<td><font face="tahoma" size="2" color="white"><input name="Email" type="text"></font></td>

</tr>

<tr>

<td><font face="tahoma" size="2" color="white">Create Your Login:</font></td>

<td><font face="tahoma" size="2" color="white"><input name="login" type="text" id="login"></font></td>

</tr>

<tr>

<td><font face="tahoma" size="2" color="white">Create Your Password:</font></td>

<td><font face="tahoma" size="2" color="white"><input name="password" type="password" id="password"></font></td>

</tr>

<tr>

<td><font face="tahoma" size="2" color="white">Re-Enter Your Password:</font></td>

<td><font face="tahoma" size="2" color="white"><input name="reenter" type="password" id="reenter"></font></td>

</tr>

<tr>

<td> </td>

<td> </td>

</tr>

<tr align="center">

<td colspan="2"><font face="tahoma" size="2" color="white"><p><input name="submit" type="submit" onClick<?=RegisterDealer();?>> - <input name="reset" type="reset"></font>

</td>

</tr>

</table>

<p><div id="bk" align="center"><a href="index.php">back</a></div></p;

</form>

</center>

</body>

</html>

USER LOGIN

 

<?php

session_start();

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>Dealer Login Page</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">

<!--

#bk a:link,#bk a:visited  {color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 18px;text-decoration:none; }

#bk a:hover {color:#CCFF00; font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 18px;text-decoration:underline; }

body {background-color: #000000;}

.style1 {color: #FFFFFF; font-weight: bold;}

-->

</style>

</head>

 

<body>  

<center>

<form name="login" id="login" action="" method="post">

<p> </p>

<p> </p>

<p> </p>

<p> </p>

<table width="363" border="0" cellpadding="2" cellspacing="2" bgcolor="#000000" style="border:2px dotted #FFFFFF;">

<tr align="center">

<td colspan="2"><font face="tahoma" size="3" color="white"><b>User Login Panel </b></font></td>

</tr>

<tr>

<td width="183"> </td>

<td width="243"> </td>

</tr>

<tr>

<td><p> <font face="tahoma" size="2" color="white">Login:</font></td>

<td><font face="tahoma" size="2" color="white"><input name="user" type="text" maxlength="30" minlength="5"></font></td>

</tr>

<tr>

<td><font face="tahoma" size="2" color="white">Password:</font></td>

<td><font face="tahoma" size="2" color="white"><input name="password" type="password" maxlength="30" minlength="5"></font></td>

</tr>

<tr align="center">

<td colspan="2"><font face="tahoma" size="2" color="white">

<p><input name="Submit" type="submit" value="Login"></font></td>

</tr>

</table>

 

<br>

<div id="bk" align="center"><a href="DealerReg.php">New User? Click here to Register.</a></div>

 

</form>

</center>

 

</body>

</html>

<?php

require_once('dbcon2.php');

$dbr = new db;$dbr->dbuser();

if(isset($_POST['Submit']))

{

if($_POST['user']=="" || $_POST['password']=="") {

?>

<div id="m" align="center">

<div id="error" align="center" style="background-color:#FFFFCC;color:#FFFF00;width:450px;height:30px;border:1px solid #CC0000;top:700px;left:500px;">

<div  id="midd" style="margin-top:6px;color:#FF0000; ">

<strong><font face="tahoma" size="3">Please enter username and password.</font></strong>

</div>  

</div>

</div>

<?php

 

}

$query = sprintf("SELECT * FROM dealership WHERE Login='%s' AND Password='%s'",

mysql_real_escape_string(trim($_POST['user'])),

mysql_real_escape_string(trim($_POST['password'])));

$dealername = mysql_fetch_array(mysql_query($query));

if(mysql_num_rows(mysql_query($query))<=0 && $_POST['user']!="" && $_POST['password']!="")

{

?>

<div id="mm" align="center">

<div id="msgalert" align="center" style="background-color:#FFFFCC;color:#FFFF00;width:450px;height:30px;border:1px solid #CC0000;top:700px;left:500px;">

<div  id="midd" style="margin-top:6px;color:#FF0000; ">

<strong><font face="tahoma" size="3">Invalid input! or Incorrect Login Details</font> </strong>

</div>  

</div>

</div>

<?php

}

else

{

$_SESSION['LoggedInD']= $dealername['DealerName'];

$_SESSION['LoggedInID']= $dealername['DealerID'];

if(mysql_num_rows(mysql_query($query))>0 )

{ $_SESSION['LoggedInDCnt']=1;

echo "<script>window.location='videoPage.php';</script>";

}

}

}

?>

<p> </p>

<p><div id="bk" align="center"><a href="index.php">back</a></div></p>

CONNECTION CODE

 

<?php

mysql_connect("localhost", "matts", "jordan") or die(mysql_error());

mysql_select_db("matts_videoportal") or die(mysql_error());

$custname = $_POST['custname'];;

$city = $_POST['city'];

$state = $_POST['state'];

$zip = $_POST['zip'];

$make = $_POST['make'];

$model = $_POST['model'];

$video_name = $_POST['videoname'];

$complete_video = $_POST['completevideo'];

$liked_video = $_POST['likedvideo'];

$purchased_video = $_POST['purchasedvideo'];

$comments = $_POST['comments'];

$customer_register_query = sprintf("INSERT INTO customer (custname, city, state, zip, make, model, videoname, completevideo, likedvideo, purchasedvideo, comments) VALUES (`$custname`, `$city`, `$state`, `$zip`, `$make`, `$model`, `$videoname`, `$completevideo`, `$likedvideo`, `$purchasedvideo`, `$comments`)");

$dealer_register_query = sprintf("INSERT INTO dealership (`DealerName`, `Dealership`, `City`, `State`,`Zip`,`Email`,`Login`,`Password`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",$name,$dealership,$city,$state,$zip,$email,$login,$password);

 

function RegisterCustomer()

{

if (!mysql_query($customer_register_query))

{

echo "<script language=\"javascript\">\r\n";

echo "document.form1.RegisterCompletionNotifier.type=\"text\";\r\n";

echo "document.form1.RegisterCompletionNotifier.value=\"Registration was completed successfully. Thank You!\";\r\n";

echo "</script>";

}

else

{

echo "<script language=\"javascript\">\r\n";

echo "document.form1.RegisterCompletionNotifier.type=\"text\";\r\n";

echo "document.form1.RegisterCompletionNotifier.value=\"Registration Failed! Please contact site Administrator!\";\r\n";

echo "</script>";

}

}

 

function RegisterDealer()

{

if (!mysql_query($dealer_register_query))

{

echo "<script language=\"javascript\">\r\n";

echo "<!--";

echo "document.registration.DealerRegisterConfirmation.type=\"textarea\"";

echo "document.registration.DealerRegisterConfirmation.cols=\"10\" ";

echo "document.registration.DealerRegisterConfirmation.rows=\"10\" ";

echo "document.registration.DealerRegisterConfirmation.value=\"Sorry, your registration could not be saved!\" ";

echo "document.registration.DealerRegisterConfirmation.value+=\"Please contact the site administrator!!!!\" ";

echo "</script>";

}

else

{

echo "<script language=\"javascript\">\r\n";

echo "<!--";

echo "document.registration.DealerRegisterConfirmation.type=\"textarea\"";

echo "document.registration.DealerRegisterConfirmation.cols=\"10\" ";

echo "document.registration.DealerRegisterConfirmation.rows=\"10\" ";

echo "document.registration.DealerRegisterConfirmation.value=\"Registration received. Thank You!\" ";

echo "//-->";

echo "</script>";

}

}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.