php - how to show user details -


hello have code in welcome.php when user login using login.php being redirected redirect.php welcome.php

<?php session_start();  if(isset($_session['username']))  {      echo'<h1>welcome ' . $_session['username'] . '</h1>';     echo'<h1>welcome ' . $_session['r'] . '</h1>';     echo'<br> <h1> <a href="logout.php">logout</a> </h1>';  }   else  {     echo 'you not logged in <br>';     echo'<a href="index.php">login</a>';   } ?> 

i want show r mysql database can't searched many time couldn't find answer anyhelp?

i use when member logs in. query database user set session variables

//retrieve username , password login feilds $uname = clean($_post['uname']); $password = clean($_post['password']);  //query database $qry="select * tbl_members username='$uname' , pass='".md5($_post['password'])."'"; $result=mysql_query($qry);   //check whether query successful or not if($result) {     if(mysql_num_rows($result) == 1) {         //login successful         session_regenerate_id();          $member = mysql_fetch_assoc($result);         // set session variables         $_session['sess_user_id'] = $member['id'];         $_session['sess_user_name'] = $member['username'];        $_session['sess_user_date'] = $member['r'];         session_write_close();         $result=mysql_query($sql) or die(mysql_error());         //goto member homepage         header("location: ../index.php");      }else {         //login failed - try again         header("location: ../login.php");         exit();     } }else {     die("query failed"); } 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -