CKAP Welcome sharing the embedded excitement
New user?
 
  EOD; //end-------------------------------------------------html registration body one---------------------------------------- //start-----------------------------------------------html registration body two--------------------------------------- $html_body_two = <<Summary

C. K. Anantha Prasad

My website for sharing information on technology as well as testing online apps shaped from my desire stores. A lot of ideas yet to implement, this site is gonna be the platform for my expression.

I am C. K. Anantha Prasad from Mysore, India. A technology enthusiast started career with Embedded System, now exploring the world of softwares and integration of both. Open source is the mantra sung from the core of the heart as it is known that from freedom comes elegance.

 
 
 
 
 
Copyright © 2011 www.ckap.in
Personal website - C. K. Anantha Prasad
EOD; //end-------------------------------------------------html registration body two---------------------------------------- //start-------------------------------------------------html login form---------------------------------------- $html_login_form = <<

Login

Email
Password
   
New user Sign up?

 

EOD; //end-------------------------------------------------html Login form---------------------------------------- //start-----------------------------------------------html login error--------------------------------------- $html_login_error = <<

Login

Email
Password
  Wrong Email / Password!
forgot password?

 

EOD; //end-------------------------------------------------html login error---------------------------------------- //start-----------------------------------------------html login blank--------------------------------------- $html_login_blank = <<

Login

Email
Password
  Email Password cannot be blank
forgot password?

 

EOD; //end-------------------------------------------------html login blank---------------------------------------- //start-----------------------------------------------html login notactive--------------------------------------- $html_login_notactive = <<

Login

Email
Password
  Your account is not active yet. Check your email for activiation code
forgot password?

 

EOD; //end-------------------------------------------------html login notactive---------------------------------------- session_start(); // dBase file include("dbconfig.php"); if($_GET['op'] == "login") { if (!$_POST['email'] || !$_POST['password']) { // login credentials are blank echo $html_body_one; echo $html_login_blank; echo $html_body_two; die(); } // Create query $q = "SELECT * FROM tb_users WHERE email='$_POST[email]' AND password=md5('$_POST[password]') LIMIT 1"; // Run query $r = mysql_query($q); $row = mysql_fetch_array($r); if(!$row) { // Login not successful echo $html_body_one; echo $html_login_error; echo $html_body_two; die(); } if (($row['status'] <> 'ACTIVE') && ($row['status'] <> 'ONLINE') && ($row['status'] <> 'OFFLINE')) { //account not yet active echo $html_body_one; echo $html_login_notactive; echo $html_body_two; die(); } // Login good, create session variables $_SESSION['valid_id'] = $row['id']; $_SESSION['valid_user'] = $row['username']; $_SESSION['last_ip'] = $row['ip']; $_SESSION['last_login'] = $row['sessionstart']; $_SESSION['last_logout'] = $row['sessionexpire']; // Session time initilizations $session_begin_time=time(); $session_expire_time=$session_begin_time + $session_time_out; $_SESSION['valid_time'] = $session_begin_time; // Create query $q = "UPDATE tb_users SET sessionstart=$session_begin_time, sessionexpire=$session_expire_time, ip='$_SERVER[REMOTE_ADDR]', status='ONLINE' WHERE id='$_SESSION[valid_id]'"; // Run query $r = mysql_query($q); mysql_close($ms); if($redirecturl=="") { //redirect to Members page Header("Location: members.php"); } else { //redirect to requested page Header("Location: $redirecturl"); } } else { //fresh login form.. newly visited page echo $html_body_one; echo $html_login_form; echo $html_body_two; die(); } ?>