Want a Code to User Login Page
Posted: Fri Mar 20, 2009 8:22 am
Hi Friends,
I am new to php and database...please help me...
To learn php and mysql I made a simple form and database ...
I want a code, Once visitor type his user name and password in login.php, If it is true , It has to go my home page. If it is false, It has to go registration page.
1- login.php
2- connection.php
I am new to php and database...please help me...
To learn php and mysql I made a simple form and database ...
I want a code, Once visitor type his user name and password in login.php, If it is true , It has to go my home page. If it is false, It has to go registration page.
1- login.php
Code: Select all
<div id="form_01">
<table border="1px">
<form method="POST" action="login_control.php">
<tr>
<td><b>User Name</b></td>
<td><input type="text" name="uname" /></td>
</tr>
<tr>
<td><b>Password</b></td>
<td><input type="password" name="paswd" /></td>
</tr>
<tr>
<td><center><input type="submit" name="login" value="Log In" /></center></td>
</tr>
</form>
</table>Code: Select all
<?php
//connect with mysql
mysql_connect('localhost','root', '') or
die(mysql_error());
//Creat a Main Database for our record
$creat= mysql_query('CREATE DATABASE IF NOT EXISTS Project_1') or
die('could not create database');
//Select the database
mysql_select_db('Project_1') or
die(mysql_error());
//Creat a table for our record
$create = 'CREATE TABLE User (
Name char(40) NULL,
User_Name char(40) NULL,
Password char(15) NULL,
Country char(40) NULL,
PRIMARY KEY (User_Name)
)';
$resul = mysql_query($create) or
die(mysql_error());
?>