Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //db include
- require_once('rec_inc.php');
- //catching submission
- $email=isset($_POST['email']) ? mysql_real_escape_string($_POST['email']) : '';
- $password=isset($_POST['password']) ? $_POST['password']: '';
- //validation
- if($email=='' || $password =='' ){
- die('fail');
- }
- //crypting
- $password=md5($password.'iloveyou');
- $key=md5(Date("H:i:s").'iloveyou');
- //searching
- $sql="SELECT * From users where email='$email' AND pass = '$password'";
- $result = mysql_query($sql);
- if(!mysql_num_rows($result)) {
- die('fail');
- }
- while($row = mysql_fetch_array($result))
- {
- if($row['verified']!=1) die('fail');
- $email=$row['email'];
- }
- //creating cookie key
- $sql="INSERT INTO `loginkeys`( `email`, `key`) VALUES ('$email', '$key') ";
- $result = mysql_query($sql);
- //login done
- $expires=1*1000*60*60*24*365;
- setcookie('cognizan', "$key",time()+$expires,"/","cognizance.org.in");
- require_once('bottom_inc.php');
- echo('pass');
- ?>
Add Comment
Please, Sign In to add comment