Identifying The Logged On User
is there a way (in php) to identify the user name used when logging onto a mySQL database? I want to know this so that I can program a basic audit trail on edited records.
View Complete Forum Thread with Replies
Related Forum Messages:
If The User Logs In, And Closes The Browser Window, How Do I Know That The User Has Logged Out.
I am creating a site that has a session based log in. Pretty simple stuff, but the bosses have asked if we can make it so that only 1 person can log into an account at once (ie if someone logs in with a specific acocunt, lock the account and dont let any one else log in) I'v been fiddleing around with session, and various session variables etc. and the only part that I cant figure, is if the user logs in, and closes the browser window, how do I know that the user has logged out.
View Replies !
Redirect The Logged In User To Home.php Without Any Clicking From The User
I have this login script that calls on itself to authenticate the username and the password. It redisplays the login page if there is an error. My question is how do I redirect it to a different page, when the user is authenticated (i.e. the address in the address box changes to a new name, for example, if the login page is called login.php,. then I want to redirect the logged in user to home.php without any clicking from the user). I realize that there is a header function available, but I've heard that any information related to the current session is lost upon using this function. Is there any better way?
View Replies !
User Logged In
I am using a script from a login tutorial online to create an admin section for a website. In this tutorial, there is a page called register.php, that should only be accessible if the user is logged in as administrator. I tried to use a simple if statement like this:<?php if($logged_in){    echo 'Logged in as '.$_SESSION['username'].', <a href="logout.php">logout</a>';    echo 'Use the form below to register new administrators.';    //code for register.php would be here, but it is pretty long, so I excluded it }else{    die(You are not logged in.) } ?>however, this doesn't work because the code I am using doesn't use "<?php" to open each php segment, and there are several sections of "<? //code ?>" throughout the page.
View Replies !
User Is Logged In
if anyone knows a better way to check if another user is currently logged into a site other than having that user update a timestamp in mysql with every new page visit and then checking to see if that timestamp falls into a certain window.
View Replies !
Logged In User
I have done this in ASP, but have come to a point where I prefer PHP. Is it possible to get the Windows login name from a script? Say I log in to my computer with the username 'Bob'. Can a PHP script read a variable that has 'Bob' in it? Or the NT domain?
View Replies !
Make Sure The User Is Logged Out.
I am building a members area for a club site I working on. My question is how do I make sure the user is logged out. If I do the logout code: SESSION_START(); unset($_session['member']); unset($_SESSION['FirstName']); unset($_SESSION['LastName']); unset($_SESSION['email']); Session_destroy(); Then try to select a page I have logged out, however if I hit the back button I will resume my session....
View Replies !
Check If A User Is Logged In
I'm trying to create a login app and I need to check if a user is logged in already or not and the send them to the aproriate page. Is this possible? If so, how do I do it?
View Replies !
Show Logged In User
I need a code that prints "Hello, $username" code can anybody help me by wrighting this out for me? I have the variable $username for the username.
View Replies !
Verifying User Has Logged In.
Just starting to learn a bit about sessions and I am using the following bit of code to check that the user has logged in through the login page. <?php session_start (); //this code checks to see if the user is logged in, if yes allowed to continue //If not redirected to the login page if (@$login |= "yes") { header ("location: login.php"); exit(); } session_destroy(); ?> However the protected page can be still accessed from the Browser window by using the page URL bypassing login.
View Replies !
Check Whether The User Is Logged In
i want to implement session in my site. If for a particular page should be accesses by only the loged in user. so I need to check whether the user is logged in or I shoud forward to Registration page or login page. Once the user is logged in we can use the userid to log the activities. How can we do this?
View Replies !
Check If User Is Already Logged In
i have a website, on wich users have to log in credentials are checked against mysql db some session vars are set during login for use somewhere else in the code. Is there a way to prohibit a user to log in twice. A was thinking about setting some flag in the db, but in that case i need some timeout in case a pc can crash for instance so the user does not logout. Is it possible to check if a session var ( in another session ) exists?
View Replies !
User Logged In Problem
I am trying to implement a feature on my site that will read the session and display the username that is currently logged on, however its not working well. this is what i have done: //part where the user logs in, just to illustrate writing into the session if (mysql_num_rows($result) == 1) { // the username and password match, // set the session $_SESSION['db_is_logged_in'] = true; $_SESSION['username'] = $username; // part where i am trying to read and display the username <?php if (!isset($_SESSION['db_is_logged_in']) echo("<b>You are not Logged in!</b></p>"); // LINE24 else echo("<b>You are logged in as ".$_SESSION['username']."</b>"); ?> The error being displayed is: Parse error: parse error, unexpected T_ECHO in W:wwwjokesadmincats.php on line 24
View Replies !
Recognising Which User Has Logged In To The Site
Is there any way of recognising which user has logged in to the site (I have directory access on the directory) so they will have had to enter their username & password. I want to be able to display different links depending on the user who has entered.
View Replies !
Update The Time The User Logged In
Im having problems with the following code, it wont update the time the user logged in, can anyone help?. tried changing mysql_num_rows to mysql_affected_rows and it still does not work. I am using a DATE/TIME format to store the login time, PHP Code:
View Replies !
Use Session To Cache My Logged In User
im having problem with session. its not with the variables i set using session_register but the variables that are not supposed to be cookied or cached. i have variables that i set using: index.php?variable=myvalue and on the next page i change that variable's value again .. but even if change it to : nexpage.php?variable=mynewvalue the variable is still using the first value i assigned to it : myvalue instead of mynewvalue. i only need to use session to cache my logged in user and not all the variables i use. how do i make this happen ? or am i doin' it wrong.
View Replies !
Sessions - User Is Logged In. But What If A Whole Different Page.
say i set $_SESSION['login'] = 1; so a user is logged in. but what if a whole different page. has a login thingy and also sets $_SESSION['login'] = 1; does that mean the user can just go to that page. w/o needing to log in when he's not supposed to be able to access that. since his session already started on a different page on which he's logged in, so $_SESSION['login'] =1 already.
View Replies !
LDAP For Current Logged In User
We are trying to setup LDAP for users to utilize our Intranet and perform some CMS stuff.. (we are using Active Directory). We are able to bind and query, no problem.. We are using PHP on IIS and MySQL as the DB However I am wondering if there is a way to find out who is currently logged in and even what their LDAP distinguishedName is.. For example in VBScript I call objUser = GetObject("LDAP://" & strUserDN).... If nothing is built in, is there a way to combine the vbscript and php together and get it back?
View Replies !
An If Statement - User Cannot Submit Something Unless He Is Logged In
Im trying to make it so that a user cannot submit something unless he is logged in, so far this is what I have // Check if the form has been submitted. if (isset($_POST['submitted'])) { if (($_SESSION['user_id']) && ($_SESSION['user_name'])) = NULL { echo '<h1>Sorry</h1> <p class="error">You need to be logged in to use this feature</p>' // Public message. echo '<p>' . mysql_error() . '<br /><br />Query: ' . $query . '</p>' // Debugging message. include ('../php/footer.php'); exit(); } else { Unfortunately it lets me submit stuff even when I am not logged in.
View Replies !
Logged In User-detection And Inputs?
I have an installation of the database-less blog service Text Rider that I wish to take public, but I want to polish it off, make it prettier, and dumber for the average user before doing so. I want it to be a system where anyone can register and post to the home page, but users can only modify their own posts, whereas administrators can, of course, modify anything. I realize how incredibly stupid this idea is, but I want to go through with it anyways, to learn programming techniques and user habits. Code:
View Replies !
Unable To Show Current Logged In User
i am not sure what is going on but when i login and that works fine but if i want to show the the user who they are logged in as in the members section for example you are loged in as who ever, it does not show Code:
View Replies !
Using Sessions To Hold User Data Once They Are Logged In.
I am writing my first CMS from scratch and am using sessions to hold user data once they are logged in. The problem is that the session data is not retained unless a username and password is passed through the URL. For example, if I go to index.php no session data is loaded, but if I go to index.php?username=this&password=that then the session data is loaded. But passing this through the URL sort of defeats the purpose of having sessions. So how do I set the session variables without having data passed through the URL? I have three functions: login() grabs the user data from the database and loads it all into session variables; authenticate() sees if the user is logged in and returns the appropriate boolean; and display_session() displays all of the session data. I have made sure that I only call authenticate() after login() has successfully ran, so the session data set in login() should be reatined for authenticate(). Here is the code:
View Replies !
Use A Function To Find Out What That Usergroup Is For The User That Is Logged In.
I am currently making my login system a lot better - I have the session_start() line at the beginning of each page in my game. I also have the variables $username and $password declared on the next two lines. In the users table there is a column called usergroup. I want to use a function to find out what that usergroup is for the user that is logged in. I have made it find out what the usergroup is WITHIN the function but I have also tried to use $usergroup outside the function, after the function has been called. This has been unsuccessful. Does anyone know how I could go about doing this?
View Replies !
Get A Login Section To Only Display If The User Have Not Logged In Yet
am trying to get a login section to only display if the user have not logged in yet, and disappears if they are. <?php if(!(isset($_SESSION['MM_Username'])) { $loging_box = "<td bgcolor='#000000'><form id='form1' name='form1' method='POST' action='<?php echo $loginFormAction; ?>'>"; $loging_box .= "<span class='style114'>Membership Number<input type='text' name='textfield' /><br />Password</span><input type='text' name='textfield2' />"; $loging_box .= "<br /><input type='submit' name='Submit' value='Login' /></form></td>"; echo $loging_box;} ?> am getting a parse error, on the first line.
View Replies !
Warning: Ftp_put(): Restricted User Logged In
Hi I am getting the following warning when using ftp_put(), and I was wondering if someone would be so kind to explain what the warning actually means. Warning: ftp_put(): Restricted user logged in. in <b>/ This is my code -------------------------- // set up basic connection $conn_id = ftp_connect('ftp.########.com.au'); // login $login_result = ftp_login($conn_id, '#####', '#####'); // this returns TRUE and everything appears fine up to this point, I have successfully logged in. // upload a file - this is where it breaks and gives me the warning described above. if (ftp_put($conn_id, $feed, $fpath.$feed, FTP_ASCII)){ ... } nb: this worked up until today, so could it be some change in configuration at the ftp sites end?
View Replies !
Detecting A Logged In Windows Domain User Id
Is there a method ($_SERVER?) to detect the id the user is logged into a Windows domain with? For instance, if I go to a desktop in my workplace and login to a Windows domain, then hit the web site, I want that web site to know the user id I used to log into the Windows domain.
View Replies !
How To Drop TEMPORARY HEAP TABLES After User Has Logged Out?
My web site uses Mysql and PHP3. I'm using HEAP tables for rapid access. A HEAP table is created for each user as they log in, and then dropped when they log out. The problem is that some users will leave the site without logging out, and I need to drop those orphaned tables so they don't choke my RAM. The ideal solution would be if there was some way to ascertain if the person has left the site and then trigger table removal, but I'm not familiar with such a "detector." Another idea I had is to make the HEAP tables Temporary Tables, hoping that they stay alive until the user leaves the site. But I can't find any good documentation on the behavior of Temporary tables. Specifically, I need to know whether a PHP persistent connection [mysql_pconnect()] will maintain the tables alive as the user travels from page to page and script to script, and then will die when the person logs out. Or does anyone have a better idea for handling this problem? I know I could also periodically run a script that would remove tables created for members who are no longer logged in, but I'd like another solution if I can find one. Any suggestions?
View Replies !
Currently Logged In NT User Id-password For Mail Function Usage
I am building an intranet website. My requirements are - I need to allow only registered users of my NT domain. I am acheiving this by using SSPI module(equivalent to NTLM) for apache. I am running Apache 2.0.44, with PHP 4.3.1 on win 2000. The SSPI module will throw a login screen where the user will type in his username and password. Now the problem is I want to use the user id and password of the currently logged in user for smtp server authentication so that I can send the emails from there email account. First, How can I achieve this? Which are the variables I willl have to use to get this info? Second, I want to sent this info for authentication in encrypted format, how do i do this?Third, how can I get the currently logged username and password without prompting the user?
View Replies !
Check To See If Img2 And Img3 Had The Image Name In Them Or Not For The Currently Logged On User.
I have a site that has multiple user postings on it. At the moment in time, they have one image name, username, pass and so on stored in the database. I wish to add a couple more images as a selection for the users to use. This works on an individual basis and i have rows setup in the table for each user. Theres three tables img, img2 and img3. The basic principle is this. A user has to have a basic image, the name for that is defined in the field img. They can, if they wish, have two more images, img2 and img3. I tried to make some code up to check to see if img2 and img3 had the image name in them or not for the currently logged on user. The idea is that, if the user has only the basic image name in the dbase, no drop down menu shows for him to select a picture. Otherwise if he has the img and img2 field in the database filled with data he has the option of 2 pictures. Likewise, if he has all three fields set he has the option of three images. PHP Code:
View Replies !
Using A Readfile() And Some Headers To Force Downloads After A User Is Logged In.
I hope someone can help me because I've been looking for other ways to do this but I can't seem to figure it out. I've been using a readfile() and some headers to force downloads after a user is logged in. It works fine but you can't resume the download if it stops. I was wondering if anyone knew a different way to force downloads. $dir = directory where file is located $db_entry = filename in database $file = $dir . $db_entry; header("Content-type: application/force-download"); header('Content-disposition: attachment; filename="' . basename($file) . '"'); header("Content-Transfer-Encoding: Binary"); header("Content-length: ".filesize($file)); readfile($file);
View Replies !
Echo The Correct Javascript Function Depending On The User Who Is Logged In.
Currently I'm messing around with some ajax, and I am running a function that well echo the correct javascript function depending on the user who is logged in. I tried a couple of methods, both time's it didn't echo the right code, having a problem with mixing the php and javascirpt into an echo: <?php function ajax_edit() { //Matches user to see if they can edit that comment if ($select_row[username] == $_SESSION[username]) { echo(" onclick="editText("$com_row[id]")" "); }else { echo(" onclick="no_edit();" "); } } ?> Both times it echoed the editText function, I wasn't logged in so it should have displayed "no_edit" I think it's just syntax because everything else works.
View Replies !
Clickable Links In A Table & Pulling Info For Logged In User Only
I'm creating a database driven site where, once the client is logged in, he will be redirected to a user-specific page. On this page, I want to be able to call up just that current logged in user's orders / purchases. The orders will be displayed in a table with clickable links. When a user clicks on, say, the purchase order number, he will be taken to a page that displays the info for just that purchase. Code:
View Replies !
Set A Cookie For Logged In When Someone Logged Into My Website
I am trying to set a cookie for logged in when someone logged into my website. Below is my script: Code removed This is the error i get: Warning: Cannot modify header information - headers already sent by (output started at /home/project/public_html/login.php:14) in /home/project/public_html/login.php on line 15.
View Replies !
Best Way To Keep User "logged In"?
I'm trying to build a web app where my users can login and view personalized data (their profile, stuff specific to them) and I'm really pulling my hair out over what would be the best way to log them in and keep them "authenticated" through out different pages. So far I have two ways in mind. 1) Keep the username and password in session variables, and check it against the database on every page access. So each time a user clicks on a page, that page will re-evaluate them against the database to see if they are allowed to be viewing what they are viewing. This also allows me to grab their User ID, which is the primary key of that table, so I can use it to search other tables where that User ID is a forgein key. 2 Session Variables: user, pass Problem: I am not sure if this is overkill on the database. I have to run that query every single page the user access a new page. Is this a bad thing? And since I have to re-authenticate on each page I have to keep the user/pass in session variables. 2) Use a boolean flag. The user logs in, and i compare the user/pass to a database. If yes, I store the their User ID in a session variable and set another session variable, such as $allow=true, and use that to "allow" the user to go from page to page. Each page checking the session variable "allow" and the session variable that contains the User ID so I can query the database to get their relevant information. 2 session varialbess: allow flag, User ID Problem: If for some reason the variable name of the flag becomes known, a simple alteration of a url could allow access to the pages.
View Replies !
Identifying Browser
Is there a way to identify the brwser a visitor to my site is using? I would like to include site style based on the visitor's browser. If their us IE show layout one way, if their using Firefox show it another way...etc...etc.
View Replies !
Identifying People
on my website i'm finding people are coming back and signing up again and again... how can i log them so i know who has logged in before. was thinking IP but does this not change per session online with dial up?
View Replies !
Identifying A Value Range
i have a form that submits to a php file, the form basically has a hidden field called number: <input type="hidden" name="number" value="12"> i know how to read the value of that, its simply putting <?php echo $_POST['number']?> but what i want to do is check if the number is between 1 and 25 and if it is then echo A else if it is between 25-75 then echo B else if it is anything above 75 then echo C .
View Replies !
Identifying SSL Clients
I have a site that uses PHP sessions through SSL, my employer does not wish the site to require cookies so I have switched on the use_trans_sid option for users who have cookies disabled. The problem I have is stopping session hijacking. If I am on a page "https://secure.mysite.com/page.php?PHPSESSID=XXXXX" And I email the url to someone else they can get onto the site without being challenged for a logon. I am trying to find a way to check that the connection is still coming from the same SSL connection, e.g. by checking the clients public key, but I can't find a way to get any information about the SSL connection from PHP.
View Replies !
Identifying An Image
Ive got a tracking system which tracks how many times a user clicks on an advert on my site. At the moment all the listings are set as one so when a user clicks on that advert it gets one click. However, one of the adverts is now going to contain two images advertising two separate companies. Ive set it up so the images and urls are different and they go to their own websites and in my tracking table i have just added an extra column called image and the number 1 goes in if image 1 is clicked on or 2 if image 2 is clicked on. However, to display this is the bit im not sure about. At the moment its displayed in a table like this: Advert Name Category Number of clicks Advert 1 Shopping 257 However, if advert 1 has two images, meaning two separate companies, how can I show this in the above table?
View Replies !
Identifying The Clicked Record
i already know how to load the my list of suppliers using mysql/php/apache, but what i would like to do now is put a link for each and every supplier and when someone clicks it, they will automatically go to that supplier's list of products. i want something like this: SUPPLIERS TABLE supplierID, Name, Address, AA Alfin21 1506 w. 66th street <>EDIT<>
View Replies !
Identifying Search Engines
my website is pretty much database driven and i've typically parsed the data in PHP and just output flat HTML. however, i'm trying to save some badwidth by spitting out just the critical information, and have javascript parse out the data. however, i'm kinda worried how search engines would react to this. (especially google) would search engines ignore the keywords if they are inside javascript tags? how do i detect search engines? maybe i can just setup a special script that output's "search-engine-friendly" output.
View Replies !
|