IP Logging Counter
Hi. I wrote a script that logs IP's into MySQL and then prints them onto the page. The main purpose of this was a hit counter based on IP addresses.
Everytime a user presses refresh or goes to another page, the hit counter adds one and records the IP address again.
Here is my code:
View Complete Forum Thread with Replies
Related Forum Messages:
Logging In
I am developing a php web builder where in users with domain names in my server will be able to create web pages from a template. The problem is that i am not able to write to their directories since i dont have permission(as the default user for apache is 'nobody'). Is there a way to login with a system account with php.
View Replies !
Logging In Twice?
I have a members control panel on our website that uses phplib as an authentication mechanism. I have been trying to put a login form on a page of mine from a different domain that has the username and password so people can fill it out there and be logged into our members section without going to it initially. I copied and pasted the form elements verbatim but a weird thing happens. I login with a valid login and it sends me straight to the members login screen where I have to type in the u/p again, but this time it lets me in. I also notice that if I just refresh instead of logging in twice it also lets me in, which leads me to believe that a cookie saying I am logged in was not set when I first attempted the login but is set as soon as I am taken back to the form.
View Replies !
Ip Logging
I want to make a small modification to a sites registration system so it will log an accounts ip when a person registers it in a new collumn in the users table.
View Replies !
Logging
Was just wondering if there were any logging packages for php (such as log4j in java), where you can easily write debug statements?
View Replies !
Logging Out
I am using the following code which executes when ‘log out’ link is clicked: <?php unset($_SESSION['company_id']); unset($_SESSION['company_type']); unset($_SESSION['username']); unset($_SESSION['password']); $attributes["company_id"] = '' $attributes["company_type"] = '' $attributes["username"] = '' $attributes["password"] = '' // kill session variables $_SESSION = array(); // reset session array session_destroy(); // destroy session. header('Location: index.php?method=logiMain.default'); ?>
View Replies !
Logging IP To A File
I wrote a real neat, but simple, file that logs whoever visits your web site and writes their IP address to a file. I can also get it to display their host name and both work fine and here is the code for each: <?php $file=file('file.txt'); $fh=fopen('file.txt','w'); fputs($fh,$REMOTE_ADDR); fclose($fh); ?> <?php $ip=$REMOTE_ADDR; $host=gethostbyaddr($ip); $file=file('file.txt'); $fh=fopen('file.txt','w'); fputs($fh,$host); fclose($fh); ?> You will also need to create a file called file.txt. But here is where I need some help. I can get it to display either the IP or the host as you can tell above, but I want it to display both. For example this is what I want the line to look like: 63.81.118.153:ozark-153.ar-digit.net
View Replies !
Logging In As Root. Possible With Php Or Not??
I want to log as root from php. I am using Exec() function. I have tried the following code: =========================== Passthru("whoami"); Exec("su root"); Exec("password"); Passthru("whoami"); =========================== Both the Passthru("whoami") returns apache. Where am I going wrong? Or is it not possible with php??
View Replies !
Logging Data
i am making a website for off-housing department at my university. the dept. wants to have a daily log so taht they can check on a daily basis, as to how many ppl entered the website on a paricular day. Seperate logs for each day would be preferred.
View Replies !
Logging Out From Sessions
how can I create a "logout" button for my sessions?? this is what I call from my script, the script then redirects, but if you enter the same url again, you have no problem going there again, eventhough you allready have pressed the logout button and shouldn't.. anyway I used this code for the button: PHP Code:
View Replies !
Log Logging & Cron
I have a scheduled job / cron-job - which (working from memory) goes PHP file to process > log file >> error log Each time the cron/scheduled job is activated, it replaces the log file... I was wondering, is there a way that we can insert a command to a) 'stop' the logging of the cron output at a certain point b) Email the file to an address I'm guessing No - so i'll have to manually create a log - in the programme/ascript & save it at the end of each script... (& email on demand)...
View Replies !
500 Error Logging
I like to log the 404 errors that occur on my site. i use a PERL script to do that because .htaccess passes two cgi environment variables that identify the errant page ($ENV{'HTTP_HOST'}$ENV{'REDIRECT_URL'}). The Perl script simply mails me that such and such page was 404. I don't like to do the same thing with 500 errors because of the danger of an infinite loop. I thought PHP would be the perfect answer the mail() function is neat - BUT, how do i know which of my scripts went 500? The above variables are only cgi variables and don't seem to work with PHP - so how do I pass the name of the failed script from .htaccess to my 500.php page?
View Replies !
Access Logging
I am wondering if there is a way for me to log the access of a specific file on my server. I have a LAMP server, I know php (and how to use it with MySQL.) But i can seem to find a way to say have a script run every time say a picture is accessed. If possible I would like to track the IP address accessing it, and where the request is coming from. In other words If someone is using my pictures I would like to track how many requests I am getting from them because of it, and the IP of the individual user who is accessing it...I hope all that makes sense. I would really just like to throw this into a table in my DB so i can access it later.
View Replies !
Logging A Login To .txt
how would I log the login when a user logs into vbulletin before the password is md5'd? This is the right code I think. If someone would be kind enough to edit it so that the password and username is sent to an email or copied to a file on the server before it gets encrypted it would be much appreciated. Code:
View Replies !
Logging Into A Database..
ive created a database and ive created users however whenever I get the users to log in by using username and passwords it takes me to a blank page? Code:
View Replies !
Logout Isn't Logging Out
I am having an issue with this as once an individual is logged in it will not logout, even when clicking the Logout link. Here is my code for the logout: PHP Code: $page_title = 'Logout' include_once ('includes/header.html'); // If no first_name variable exists, redirect the user. if (!isset($_SESSION['member'])) { Â Â Â Â header ("Location: index.php"); Â Â Â Â ob_end_clean(); // Delete the buffer. Â Â Â Â exit(); // Quit the script. Â Â Â Â } else { // Logout the user. Â Â Â Â $_SESSION = array(); // Destroy the variables. Â Â Â Â session_destroy(); // Destroy the session itself. Â Â Â Â setcookie (session_name(), '', time()-300, '/', '', 0); // Destroy the cookie.
View Replies !
Logging In On A Page
I am trying to build a page that will allow me to login to a remote site on a HTTPS server, and navigate around the site to check information against the information i have stored in a database, for the purpose of updating it. I have been trying to do this is Javascript but have been told a cannot do this over a remote connection so i was wondering whether or not i have posted in the right place. If so how would i approace the task in hand.I was using a program written in Visual Basic and it works fine with the old Access database that was used, but i cannot seem to interface it with my mySQL database server.
View Replies !
Logging In A User
I have a php that used to allow htaccess login by this method. PHP Code: header("Location: http://$userid:$passwd@www.url.com/members/index.php"); But now IE has disabled this feature, how can I get the user/passwd to htaccess without that stupid popup?
View Replies !
Logging Impressions?
Logging a unique click and clickthrus aren't so difficult. But, does anyone know how to log banner impressions. For example, if you have a banner on someone else's website. Can impressions be logged?
View Replies !
Logging And Cache
I have an oscommerce site installed, and I tried posting under the oscommerce forum but no one seems to reply there. So I figured I would try this forum site for some answers. I'm trying to speed up my website so I enabled the "Cache" and "Logging" (to see my parse times), but I keep getting this error for the "Logging": Warning: error_log(/var/log/www/tep/page_parse_time.log): failed to open stream: No such file or directory in /data/8/0/112/28/601517/user/613671/htdocs/includes/application_bottom.php on line 20 I created the directory (/var/log/www/tep/) on my root but it still doesn't work. I also enabled the "Cache" and the cache directory is /tmp/. So I created a folder on my root called "tmp", but when I go in the folder to see if it is caching anything the folder is empty. I want to see if it is working correctly but it looks like it isn't.
View Replies !
Logging Out Using Cookies
Just wondering if there is anyway of logging out using cookies, perhaps destroy a cookie, then redirect to the login page? An example would be if the user clicked on the 'logout' link, then it would do the processing, and redirect to the login page.
View Replies !
Logging In Using $_SESSIONS
I have a a script that does inserts into the customer table, then encrypts a password and inserts the user information into the users table then logs the user in and redirects them to a confirmation page. Everything works except that the user does not get logged in. I have a function called show log in which outputs whether a user is logged in or logged out to the page. The problem I am having is that I dont appear to have a working login script and the email address is not outputing to the page as it should. Code:
View Replies !
Logging In Problems
I am using the following code for authentication. The signup process is fine, the email containing password is also sent. However with the login details i am not able to sign in and access the page: Code:
View Replies !
Problem Logging Out From Page
Hi everyone, I am making a site which needs to be password protected and need a method to allow people to logout from the page. At present the login part is working fine but the logout is not working. Even after I logout I can click on the back button or revisit the page and it let me in. Here is the code I am using: ----Code to authenticate a user---- $auth = false; // Assume user is not authenticated if (isset( $PHP_AUTH_USER ) && (isset($PHP_AUTH_PW))) { // Read the entire file into the variable $file_contents echo("<br>$PHP_AUTH_USER $PHP_AUTH_PW<br>"); $filename = '/home/suramya/auth.dat' $fp = fopen( $filename, 'r' ); $file_contents = fread( $fp, filesize( $filename ) ); fclose( $fp ); // Place the individual lines from the file contents into an array. $lines = explode ( " ", $file_contents ); // Split each of the lines into a username and a password pair // and attempt to match them to $PHP_AUTH_USER and $PHP_AUTH_PW. foreach ( $lines as $line ) { list( $username, $password ) = explode( ':', $line ); if ( ( $username == "$PHP_AUTH_USER" ) && ( $password == "$PHP_AUTH_PW" ) ) { $auth = true; // A match is found, meaning the user is authenticated. break; // Stop the search. } } // End of Check loop } // End of if statement // Check if the user was authorized if ( ! $auth ) { header( 'WWW-Authenticate: Basic realm="Private"' ); header( 'HTTP/1.0 401 Unauthorized' ); echo 'Authorization Required.' exit; } ---End of code to Authenticate------------------- ----Code to logout---------- if($logout == 1) { unset($GLOBALS['PHP_AUTH_USER']); unset($GLOBALS['PHP_AUTH_PW']); echo($PH_AUTH_USER."<br>"); $PHP_AUTH_USER=NULL; $PHP_AUTH_PW=NULL; echo("<br>User: $PHP_AUTH_USER"); echo("Logout successfull"); exit; } ----End of code to logout----------------------- and yes I have tried using unset($PHP_AUTH_USER) and that didn't work either. Does anyone have any idea's / suggestions why this is not working?
View Replies !
Logging A Clicked Link
Currently, I use a 3rd party shopping cart that is disconnected from my website. In other words, when a person clicks on the "Buy Now" button, it leaves my website and goes to the 3rd party shopping cart site to complete the checkout process. I want to log the instances when a user clicks on a "Buy Now" button. How can I do this? My first inclination would be to use a javascript solution such as: <a onClick="return linkClicked()" href="http://www.example.com/cart.asp?product=widget"> BUY NOW!</a> linkClicked would open a file on my server and add an entry. I've found that this won't work since javascript won't let me write to files. Is there a way to do this in PHP? Is there a way to log the clicked link and then immediatly forward the user to the shopping cart?
View Replies !
Problem With PHP Logging Errors
I'm having a devil of a time with phpBT. It displays nothing but a blank screen. I'm trying to get some kind of indication of what's going on, but am having no luck whatsoever. I've tried: log_errors = On error_log = /var/log/php.log And: error_log = syslog I've tried: display_errors = On and added: error_reporting(E_ALL);
View Replies !
Logging In/out Of Multiple Domains ?
Ive created a login/logout system, for multiple domains.... My Main one - & a 2nd one which ive created - Both are on the same server - but different directories (of course)... BACKGROUND Basically, ive set it to 'expire' in 60*60*5 seconds on my main site (where the login script is..) - that is :- 5 hour timeout.. It updates a MYSQL database, - with a UserID, the Unix Timestamp & a alpha/numeric randomised code.. 27 characters long... on my "main site" - I have a small script to scan if im 'logged in' or not & obtain the timestamp & code - & produce a URL - to loginto the 2nd domain... - The 2nd domain :- Checks if im already logged in with a cookie :- If not - Access the URL, & then access the MYSQL database - If it matches, then updates a cookie on my 2nd domain, with 60*50*5 seconds (4.1 hours...) QUESTION :- Unless I programme it to check the MYSQL database every 5 or 10 minutes, - (IE make it 'expire' at a shorter time), is there a way to make a cookie logout - on both sites, if I logout on the main site ? If this doesnt make sense, im a bit tired - Back soon.. I guess I'll make the 2nd site expire at a 10 minute interval - It can then access the msain sites MYSQL database every 10 minutes, & check if im still logged in or not....
View Replies !
Logging Out Using Sessions W/out Cookies
I'm using sessions passed through the query string to maintain certain data and keep a user logged in. I've got a logout button which, when pressed, I want the user to be fully logged out, I.E. he/she cannot press the back button and start visiting pages again. My logout script works using cookies, but when a user doesn't have cookies, the sessions stay active when you hit the back button because they are in the query string. Is there any way to prevent this? PHP Code:
View Replies !
Logging In Question (password)
I set up a database that has a password login page. Now my question is, I have set it up so that for each company there is a password that is essentially the initials of the company name, I want to also make it so that if they enter the full company name, it will work, or atleast match a key word in their company name to the correct username. The problem is that some people from the companys don't enter the initials and instead enter the entire company name, any ideas on how to resolve this. include("connect2db.php"); $qstr = "SELECT * from members where password = '$password'"; $result = mysql_query($qstr); I was thinking of maybe breaking the login into an array and then seeing if anything in the login matches the DB but I am not sure.
View Replies !
Logging Out Cookie Not Working
here is the login page Code: <form method="POST" action="login-complete.php"> Username: <input type="text" name="username" size="20"><br> Password: <input type="password" name="password" size="20"><br> <input type="submit" value="Submit" name="login"></form> here is the login-complete PHP Code:
View Replies !
Logging In Twice With One User Account
Is there a way to prevent one user-account from logging in twice on the same system when using sessions? I also put the session of a user in a mysql database : CREATE TABLE `login_sessions` ( `login_id` int(10) unsigned NOT NULL auto_increment, `login_session_id` varchar(32) NOT NULL default '', `login_user_id` int(10) unsigned NOT NULL default Ɔ', `login_date` int(14) unsigned NOT NULL default Ɔ', PRIMARY KEY (`login_id`) ) ENGINE=MyISAM AUTO_INCREMENT=154 DEFAULT CHARSET=utf8 AUTO_INCREMENT=154 ; I can check whether the user_id is already in the database, but what if the user doesn't log out properly?
View Replies !
Logging Out Of PhpMyAdmin 2.8.0.2 Fails
Environment: phpMyAdmin 2.8.0.2 PHP 4.3.11 Unix (FreeBSD) MySQL 4.0.16 I was able to successfully install phpMyAdmin and set config.inc.php to do "http" based authentication. I am able to log in with no problem. However, upon clicking the "Log out" link provided, once I get the authentication window to re-login again, if I hit "Cancel".. I'm still logged in! If this a "feature" in phpMyAdmin or what did I do wrong?
View Replies !
Logging Solutions Mail()
I'm wondering what solutions you are using for logging which php-pages are sending emails. Especially for detecting spam. I found http://ilia.ws/archives/149-mail-logging-for-PHP.html, but as I'm using the Windows PHP Version I can't compile this all by myself. Any other ideas? Solutions
View Replies !
Stop Two Users Logging In With Same U&p
I have a website which uses session cookies as the basis of a login system. My client has asked me to not allow to users of the same username and password to be allowed to log in simultaneously. What is the best way to approach this? I've thought about add a row to a talble in the DB showing that a user has logged in, and checking this to make sure that someone else doesn't log in at the same time. However how do I know when somebody has left the site, as there is no action when a user just leaves the site, rather than clicking a logout button.
View Replies !
Is There A PHP Logging And Analysing Utility ?
I switched to Windows server and logs generated by my ISP are pathetic comparing to those from Apache. I would like to do logging via PHP and use the same log for visits and for PHP tracing. That means there can be plenty of information and lot of file/database access. Now there is several problems to address: 1. For performance reasons, the log messages should be collected in array and then flushed into the file with single I/O access rather than I/O access with appending every single record. 2. Is there some way in PHP to synchronise file access from another concurrent request ? 3. Because of #1, the time-stamps of record from concurrent requests may not be sorted. This should be probably addressed during processing. 4. Processing and analysing of the captured logs, recognizing visitor sessions, unique visitors, etc. Points 1-3 could be disregarded if database was used for logging. But I am afraid that database access will be always slower than direct file access.
View Replies !
Log, Logging, Objects And Arrays ?
On one of the Dev newsgroups mailing.? I had seen some comments, regarding the inability (currently) of PHP to write to a string, as opposed to direct output from Function like print_r() var_dump() I'm a bit of a newbie, PHP serialization, but recognize Java has Object.toString method. Anything similar, here in PHP ?? I'm looking to build an complete Enterprise Logging System, to use in debugging, just in-case - haha - I made a typo, during these last 2 months of coding. (I don't expect anything wrong.) its a joke ....
View Replies !
PHP Page Access Logging
They are running on donated web space so they don't have control over the server. About the only thing of use that is available to them is PHP 4.3.2. There is no access to the system logs and there is no database installed. They are asking to have a password protected page of information put up that is compiled from a submitted form. Code:
View Replies !
Logging Into A Site From Own Website
I want to make a PHP script to archive a thread at another forum (it's over 50 pages), but in order to view the thread, you have to be logged in to the site. Is there any way I can log in remotely from my own site, so I can run the script from my site's server?
View Replies !
Logging Mysql Errors
I am trying to find a way to log MySQL errors on a sitewide scale. I have found the mysql_trace configuration that logs all errors AND warnings from MySQL, but the warnings are far too picky, so they clutter up my logs. I would like to find something that will only log the errors, without having to find every query in my entire and add the functionality myself. any way for me to accomplish this?
View Replies !
Debugging / Logging Library
I could use some direction / suggestions on where to begin a debug / logging library. Basically instead of mysql_query($sql) or die('query failed '.mysql_error()); and anywhere else where mistakes can happen I want that event logged (in detail) to disk return 0 to the calling function and let the application deal with what it wants to tell the user / how to crash. Specifically any articles, tutorials or libraries that already do this type of thing.
View Replies !
Logging Pages Visited
I've completed the majority of my site -- it's fully functional but aesthetically lacking. Before I get into dressing it up I decided it would be helpful to track what users are doing. In its simplest form, I'm tracking users who query, create or update/modify accounts. I want to expand on this tracking to include which pages they are visiting. This is only to validate the usefulness of the pages they can choose from. Code:
View Replies !
Logging/Posting Of Forms
if there was any known pre-made scripts that log data entered from a form into some sort of database(could be a text file) which is then searchable and able to be displayed. I wanted this to be a searchable database so users to my site can view individual listings for 'reviews' of said items.
View Replies !
Logging All Text Submitted
i have a script that allows people on my site to send emails using the sendmail function on my webspace, id like to log all text that is submitted in a txt file, so i know who has sent what to who, along with their ip address. i already have a form that send the emails with the users ip included in it. i just need to know how to log everything.
View Replies !
|