Hi all,
I try to make login page in PHP.But I unable to get the loginID/UserName in login_successful page.I try to do it by using session.Please anyone tell me how I solve this problem by using session.
Shreyasi 0 Newbie Poster
Recommended Answers
Jump to Posthi shreya,
…<? ob_start(); include("../conn.php"); if($_SERVER['REQUEST_METHOD']=="POST" && isset($_POST['rlog'])) { $res="select * from `date_profiles` where email='".mysql_real_escape_string($_POST['login'])."' and password='".mysql_real_escape_string($_POST['pass1'])."'"; $res1=mysql_query($res); $res2=mysql_num_rows($res1); if($res2==0) { echo "invalid user"; } else{ $res="select * from `date_profiles` where email='".$_POST['login']."' and password='".$_POST['pass1']."'"; $res1=mysql_query($res); $row=mysql_fetch_assoc($res1); $id=$row['id']; session_unregister("user_id"); session_register("user_id"); $_SESSION['user_id']=$id; session_unregister("name"); session_register("name"); $_SESSION['name']=$row['fname']; header("location:index.php"); } } ?>
Jump to PostI think $_POST is a submit button.
All 7 Replies
praveen_dusari 11 Posting Whiz in Training
Shanti C 106 Posting Virtuoso
praveen_dusari 11 Posting Whiz in Training
Shreyasi 0 Newbie Poster
Shreyasi 0 Newbie Poster
roh3x2n 0 Newbie Poster
praveen_dusari 11 Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.