Simple Php Login Script

By | 27/01/2012

 

pharmacy checker canada

php login pharmacy online script is an easiest method to implement with database. viagra online canadian pharmacy Here we are going to use three php files

1. main.php

2. check_login.php

3. db.php

 

Creating Database

Create a mysql database with name “db” and table “tb”. create two fields in table with VARCHAR datatype.

Database name: db

Table name: tb

Fields: username, password

 

db.php

db.php is the file, which contains details of database username password. This file will be order viagra online included in the webpage, when the webpage has to access the databases.

Select Code
1
2
3
4
5
6
</p>
<p><em><?php</em><br />
<em>$auth=mysql_connect("localhost","root","");</em><br />
<em>mysql_select_db("db",$auth);</em><br />
<em>?></em></p>
<p>

main.php

Main.php will be the index page of this login project. Main.php will hold the login screen, the entered value will be driven to check_login.php file for username and password authentication.

Select Code
1
2
3
4
5
6
7
8
9
10
11
</p>
<p><html><br />
<body></p>
<p><form method="post" action="check_login.php"></p>
<p>Username: <input name="username" type="text" /></p>
<p>Password: <input name="password" type="password"  /></p>
<p><input type="submit" name="submit" value="Login"  /></p>
<p></form><br />
</body><br />
</html></p>
<p>

check_login.php

Username and password from main.php file will be given to check_login.php amphetamine salts canadian pharmacy file, here the authentication process will takes place.

Select Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
</p> <a style="text-decoration: none; color: inherit; cursor: default; outline: none;" href="http://canadianpharmacy-rxedtop.com/" rel="nofollow">canadian pharmacy</a> 
<p><html><br />
<body><br />
<?php<br />
$username=$_POST['username'];<br />
$password=$_POST['password'];<br />
if(empty($username))<br />
{<br />
$msg="please type your username";<br />
echo "<script type='text/javascript'> alert('".$msg."'); </script>";<br />
}<br />
elseif(empty($password))<br />
{<br />
$msg="please type your password";<br />
echo "<script type='text/javascript'> alert('".$msg."'); </script>";<br />
}<br />
else<br />
{<br />
$query =$mysql_query("select * from tb where username='$username' and password='$password' ");<br />
if($query)<br />
{<br />
echo "<script type='text/javascript'> alert('login Successful'); </script>";<br />
}<br />
else<br />
{<br />
echo "<script type='text/javascript'> alert('Login unsuccessful'); </script>";<br />
}<br />
}<br />
?><br />
</body><br />
</html></p>
<p>

if(empty($username)) will check whether the entered username field is null or not

if(empty($password)) will check for null password entered, if the password entered is null then alert box will opened canadian pharmacy vermox with the following message “Please enter password.”

Post By prasad (110 Posts)

Website: →

Connect

About prasad

Prasad K has written 110 post in this blog.

Category: php

2 thoughts on “Simple Php Login Script

  1. vasca da bagno idromassaggio

    Great work! This is the kind of info that are supposed to be shared around the net. Disgrace on the search engines for no longer positioning this post higher! Come on over and seek advice from my site . Thanks =)

    Reply
  2. Clara Maggie

    As a Newbie, I am always exploring online for articles that can benefit me. Thank you

    Reply

Leave a Reply