how to identify user?[SOLVE]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
jayson.ph
Forum Contributor
Posts: 165
Joined: Mon Jan 02, 2012 9:20 am
Location: MP
Contact:

how to identify user?[SOLVE]

Post 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.
Last edited by jayson.ph on Thu Jun 28, 2012 9:17 pm, edited 1 time in total.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: how to identify user?

Post by social_experiment »

Give a user a 'country code' option to select when they register
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
jayson.ph
Forum Contributor
Posts: 165
Joined: Mon Jan 02, 2012 9:20 am
Location: MP
Contact:

Re: how to identify user?

Post by jayson.ph »

can i have a sample code. please..
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: how to identify user?

Post 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 :)
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
jayson.ph
Forum Contributor
Posts: 165
Joined: Mon Jan 02, 2012 9:20 am
Location: MP
Contact:

Re: how to identify user?

Post 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
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: how to identify user?

Post 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?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
jayson.ph
Forum Contributor
Posts: 165
Joined: Mon Jan 02, 2012 9:20 am
Location: MP
Contact:

Re: how to identify user?

Post 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
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: how to identify user?

Post 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?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
jayson.ph
Forum Contributor
Posts: 165
Joined: Mon Jan 02, 2012 9:20 am
Location: MP
Contact:

Re: how to identify user?[SOLVE]

Post 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.
Post Reply