Jump to content

Link the reference id with user


saran.tvmalai

Recommended Posts

Dear All,

 

Am new to PHP. now i want to online cargo tracking system in php. in that i create the reference id for each user to track the shipments. in that user must login and track the shipments. now i need the code for the specific user only view they shipments only. the other user can't be check the other shipments. so i need how to link the user and reference id. kindly advice me.

Link to comment
https://forums.phpfreaks.com/topic/212254-link-the-reference-id-with-user/
Share on other sites

for example there are two users. user1 and user2. both have different reference id.

 

user1 have the reference id is 001

 

user2 have the reference id is 002

 

if user1 login and track his shipment means they only possible to view his ref id 001. user1 never possible to check ref id 002. same as user2 never possible to check the ref id 001.

you are going to need a login page and a member page

 

for the login page use something like

<html>
<form method="post" action="memberpage.php">
Name:<input type="text" name="user">
Password:<input type="password" name="pass">
<input type="submit" value="submit" name="submit">

 

then in your member page you will have something like

 

$con = mysql_connect("localhost","login","pass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_db", $con);


$user = $_POST['user'];
$pass = $_POST['pass'];

$result = mysql_query("SELECT * FROM yourtable WHERE user = $user, pass = $pass");

while($row = mysql_fetch_array($result))
  {
  echo $row['refID'];
  }


 

 

that should give you a good start

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.