php - I want to make sure my way of identifying ID is secure -
i trying fetch user info if not logged in display image , name on login page if visit website there own profile links.
before , till using method
//file connect db require_once 'incdb/db.inc.con.php'; //check see if they're logged in else head them login page if(!isset($_session['logged_in'])) { header("location: login.php"); } // checking user $userid = mysqli_real_escape_string($globals["___mysqli_ston"], $_get['userid']); $check = mysqli_query($globals["___mysqli_ston"], "select * users id='$userid'"); while ($row = mysqli_fetch_assoc($check)) { $pid = $row['id']; $pfname = $row['firstname']; $plname = $row['lastname']; } so trying little changes , making name visible on login page if visit there own links http://www.example.com/member.php?userid=1 , adding name , image meta properties code
//file connect db require_once 'incdb/db.inc.con.php'; // checking user $userid = mysqli_real_escape_string($globals["___mysqli_ston"], $_get['userid']); $check = mysqli_query($globals["___mysqli_ston"], "select * users id='$userid'"); while ($row = mysqli_fetch_assoc($check)) { $pid = $row['id']; $pfname = $row['firstname']; $plname = $row['lastname']; } //check see if they're logged in else head them login page if(!isset($_session['logged_in'])) { header("location: login.php"); } this talking meta
<meta property="og:url" content="http://www.example.com"/> <meta property="og:image" content="http://www.example.com/user/image.jpg"/> <meta property="og:title" content="user name"/>
looks fine me sure used https://github.com/philip/mysqlconvertertool helps make bit more secure code better if use own mysqli code
Comments
Post a Comment