Login Authentication Php

create table user_info (
user_id char(18),
fname char(15),
email char(35));
//File: index.php
$form = "


Your first name?:



Your email?:





";
if ((! isset ($seenform)) && (! isset ($userid))) :
     print $form;
elseif (isset ($seenform) && (! isset ($userid))) :
     $uniq_id = uniqid(rand());
     @mysql_pconnect("localhost", "root", "") or die("Could not connect to MySQL server!");
     @mysql_select_db("user") or die("Could not select user database!");
     $query = "INSERT INTO user_info VALUES('$uniq_id', '$fname', '$email')";
     $result = mysql_query($query) or die("Could not insert user information!");
     setcookie ("userid", $uniq_id, time()+2592000);
     print "Congratulations $fname! You are now registered!.";
elseif (isset($userid)) :
     @mysql_pconnect("localhost", "root", "") or die("Could not connect to MySQL server!");
     @mysql_select_db("user") or die("Could not select user database!");
     $query = "SELECT * FROM user_info WHERE user_id = '$userid'";
     $result = mysql_query($query) or die("Could not extract user information!");
     $row = mysql_fetch_array($result);
     print "Hi ".$row["fname"].",
";
     print "Your email address is ".$row["email"];
endif;
?>