Page 1 of 1

how to identify user?[SOLVE]

Posted: Sat Jun 16, 2012 3:05 am
by jayson.ph
hi all,

in my work, i already to login-logout, add, update and delete. but my problem now is how, to identify a user, since my work is all about, product information.

-let say, i have a branch in the different location: canada - africa - qatar - australia - usa - japan - chinna-
-each branch their is one user who maintain their product information on the database so that it can monitor by the areal manager. and now how can identify the user that i can monitor each location if how many product they have.

Re: how to identify user?

Posted: Sun Jun 17, 2012 4:41 am
by social_experiment
Give a user a 'country code' option to select when they register

Re: how to identify user?

Posted: Mon Jun 18, 2012 1:28 am
by jayson.ph
can i have a sample code. please..

Re: how to identify user?

Posted: Mon Jun 18, 2012 2:15 am
by social_experiment

Code: Select all

<select name="country">
<option value="na">North America</option>
<option value="sa">South America</option>
<!-- other places -->
</select>
Check $_POST['country'] when writing the values to the database; to check which country a person is from you will select that value (let's say 'country' is your column in the table) from the database; use the idea(s) to create some code and post it back here for more help :)

Re: how to identify user?

Posted: Mon Jun 25, 2012 2:28 am
by jayson.ph
Hi all,
and Hi social_experiment, Thank you and i have another questions. i have login page but it can access everything after login. since i want only my record/file that i want to access after login. even if i jump onto another page. please help

Re: how to identify user?

Posted: Mon Jun 25, 2012 4:07 am
by social_experiment
jayson.ph wrote:i have login page but it can access everything after login. since i want only my record/file that i want to access after login. even if i jump onto another page.
Are you refering to a page that can only be accessed after login?

Re: how to identify user?

Posted: Wed Jun 27, 2012 12:12 am
by jayson.ph
ah yes, exactly.. and now i have a simple log-in it just for beginner like me. i cant get in to a page. x.php

Code: Select all

$pingsql = "SELECT * FROM tbl_user WHERE usr_name = '".($_POST['iuserlogin'])."' AND usr_pass = '".md5($_POST['iuserpass'])."' AND usr_type = '".($_POST['usr_type'])."'";
																									
		$pingresult = mysql_query($pingsql);
	if($pingresult)
	{
		if(mysql_num_rows($pingresult) == 1)
		{
			session_start();
				$_SESSION['auth'] = 1;
				setcookie("usr_type", $_POST['usr_type'], time()+(84600*30));
				session_write_close();
				header('Location:x.php');
			exit();
		}
		else
		{
				header('Location:y.php');
			exit();
		}
	}
	else
	{
	die("Query failed: .$pingsql");
	}
Please help

Re: how to identify user?

Posted: Wed Jun 27, 2012 1:47 am
by social_experiment
Have a look a the url below; covers the basics of login system writing
viewtopic.php?f=28&t=135287
jayson.ph wrote:i cant get in to a page. x.php
You aren't redirected to this page?

Re: how to identify user?[SOLVE]

Posted: Thu Jun 28, 2012 9:16 pm
by jayson.ph
Have a look a the url below; covers the basics of login system writing
viewtopic.php?f=28&t=135287
thank you social_experiment i get some idea from the link you give.. thank and now it solve.. thank you for the response.