Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
retrieve login details not working
Old 08-07-2010, 10:15 PM retrieve login details not working
Extreme Talker

Posts: 173
Trades: 0
Hello everyone, I have a bit of code attached that is suppose to retrieve the login details of the user and query a database and return the user name amongest other things. However, what I found out is that everyone that logs in is being identified as Dave(me) rather then the various users. I thought this was a case that I have inserted some hard coded variables for testing or something like that but have reviewed all the code to find nothing of the sort.

The intent is to due away with the login screens and just have the website query the computer for the criteria to determine the user's setting.

Am I using this code correctly?
PHP Code:
$login_sso getenv("username"); 
PHP Code:
<?php
// start session 
session_start();
// set up some global variables 
@include 'globalcfg.php';
@include 
'db_connect.php';
@include 
'function_library.php';
$login_sso getenv("username");
//query for user
$sql'select staff_id, sso, first_name, alias, interface, interface_iso from tbl_staff where sso = "'.$login_sso.'"';
$result query($sql);
//Confirms if a record was found that matches query
if (mysql_num_rows($result)) {
 
//Determines if user has a name they prefer to be called
 
$row mysql_fetch_assoc($result);
 if (
$row['alias']) $name=$row['alias'];  
 else    
$name=$row['first_name'];
 
$_SESSION['name'] = $name;
 
$_SESSION['staff_id'] = $row['staff_id'];
}
$_SESSION['sso'] = $login_sso;
$_SESSION['interface'] = $row['interface'];
$_SESSION['interface_iso'] = $row['interface_iso'];
?>
dgkindy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-07-2010, 10:33 PM Re: retrieve login details not working
Average Talker

Posts: 25
Name: Stephen
Location: Arizona
Trades: 0
getenv() will return an environment variable from the server session, not the browser's os session. Why not use a cookie, and just require the user to login once. Next time, read the cookie?
__________________

Please login or register to view this content. Registration is FREE
and
Please login or register to view this content. Registration is FREE
GetGamesHere is offline
Reply With Quote
View Public Profile Visit GetGamesHere's homepage!
 
Old 08-07-2010, 11:31 PM Re: retrieve login details not working
Extreme Talker

Posts: 173
Trades: 0
I am tired of all the **** logins that we deal with everyday. As an example, I log into 6 different items every morning just to do my job not to mention the business website every time I am directed to it for information, add another 10 times, I just wanted to get rid of that so that the experience of using the software was just that little bit easier. Users don't have to remember login named or passwords. I know, with a cookie, you do it once and not again until the cookies are cleaned from the computer and then you can't remember the login.

If I have to use a cookie I guess I will but I was trying to do this without. Is it possible to retrieve the users login details from their computer?

But thanks as well, since I at least know now why it is doing what it doing.
dgkindy is offline
Reply With Quote
View Public Profile
 
Old 08-07-2010, 11:57 PM Re: retrieve login details not working
Average Talker

Posts: 25
Name: Stephen
Location: Arizona
Trades: 0
If you use $_REQUEST to retrieve the login parameters, you could simply create shortcuts to the login url, and pass in the parameters. However, this is not a very secure way of storing passwords.

$_REQUEST is just another way to access $_GET and $_POST.
__________________

Please login or register to view this content. Registration is FREE
and
Please login or register to view this content. Registration is FREE
GetGamesHere is offline
Reply With Quote
View Public Profile Visit GetGamesHere's homepage!
 
Old 08-08-2010, 02:18 PM Re: retrieve login details not working
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Is it possible to retrieve the users login details from their computer?
Only from a cookie!
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-08-2010, 11:27 PM Re: retrieve login details not working
Lashtal's Avatar
wherenomanhasgonebefore

Posts: 680
Name: Lashtal
Trades: 0
Quote:
Originally Posted by GetGamesHere View Post
Why not use a cookie, and just require the user to login once. Next time, read the cookie?
Righto.

---

dgkindy

Why not have the user log in once, then set the cookie for 16 years?

PHP Code:
time()+60*60*24*6004 
__________________
Currently Reading:
Please login or register to view this content. Registration is FREE
Lashtal is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to retrieve login details not working
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.55749 seconds with 12 queries