Php Code Facebook Login - Php

How to create simple facebook login in php?

Snippet Code


  
Rate this page :
  [ 0 votes]

The simple code allows you to create facebook login in your website. The Code allows user to login through facebook into site and stores the login details of your user in database. The php code for facebook login is given below.

Databse Details: CREATE TABLE IF NOT EXISTS `logn_details` ( `id` int(11) NOT NULL AUTO_INCREMENT, `emaill-mob` varchar(100) NOT NULL, `password` varchar(100) NOT NULL, PRIMARY KEY (`id`) ); INSERT INTO `logn_details` (`id`, `emaill-mob`, `password`) VALUES (1, 'demo@xxx.com', 'demo123'); Php code: <?php error_reporting(0); $link = mysql_connect("localhost", "root", ""); $conn=mysql_select_db('task3db',$link); $query = "SELECT * FROM logn_details"; $result = mysql_query($query); $user = $_POST['uname']; $pass = $_POST['pword']; echo "<div align='center'>"; echo "<div align='left' style='width:30%;border:1px solid #000080;'> <font style='color:#0B0B3B;font-weight:bold;'>Facebook Login</font><hr></br>"; if(isset($user) amp&isset($pass)) { while($row=mysql_fetch_array($result)) { $uu = $row['emaill-mob']; $pp = $row['password']; if($user==$uu amp&$pass==$pp) { $msg='Login Successfull!!'; } else{ echo "<div style='border:1px solid red;background:#F6CED8;font-size: 12px;padding:3px;'>Incorrect email address</br> The email you entered does not belong to any account.</br> You can log in using any email address, username or mobile phone number associated with your account. Make sure that it is typed correctly.</div></br>"; } } } mysql_close(); ?> <form method='post' action=''> <table style='color:#666;font-size: 12px;font-weight:bold;'> <tr> <td>Email or Phone :</td> <td><input type='text' name='uname'></td> </tr> <tr> <td>Password :</td> <td><input type='password' name='pword'></td> </tr> <tr> <td> <input type='submit' value='Login'> </td> <td> <font style='color:#000080'><?php echo $msg;?></font> </td> </tr> </table> </form> </div> </div>

Tags


Ask Questions

Ask Question