PHP/SQL for Jedi: newbie question: Visitor tracker, counter
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
PHP/SQL for Jedi: newbie question: Visitor tracker, counter
Hello,
I would like to add a counter, visitor tracker.
I created my Database with my community passord, then have to add:
Code:
// Connect to database
$connection = mysql_connect("localhost", "myusername", "mypassword");
// Get User IP
$current_userIPaddress = $HTTP_SERVER_VARS["REMOTE_ADDR"];
// SQL QUERY
$ipCounter = mysql_result(mysql_db_query($dbname, "SELECT COUNT(ip) as Num FROM counter WHERE ip = '$current_userIPaddress'"),0); // IP exists? RETURN '0' = No
if($ipCounter == 0){ // User/IP NOT LOGGED!
// ADD User! [NOTE: The 'timestamp' is the first time the IP address has visited the site]
$result = mysql_db_query($dbname, "INSERT INTO counter SET timestamp = time(), ip = '$current_userIPaddress'");
}
also this :
Code:
<?php
$dbhost='localhost';
$dbuser='minoux';
$dbpass='dein_password_hier_eintagen';
$dbname='minoux';
$conn=mysql_connect($dbhost, $dbuser, $dbpass) or die ('connection faild');
mysql_select_db($dbname);
?>
So my question is, it is gonna be required that every single HTML page has the password for the ftp of the webpage?
we shall replace the dein_password_hier_eintagen by the password.
I created my Database with my community passord, then have to add:
Code:
// Connect to database
$connection = mysql_connect("localhost", "myusername", "mypassword");
// Get User IP
$current_userIPaddress = $HTTP_SERVER_VARS["REMOTE_ADDR"];
// SQL QUERY
$ipCounter = mysql_result(mysql_db_query($dbname, "SELECT COUNT(ip) as Num FROM counter WHERE ip = '$current_userIPaddress'"),0); // IP exists? RETURN '0' = No
if($ipCounter == 0){ // User/IP NOT LOGGED!
// ADD User! [NOTE: The 'timestamp' is the first time the IP address has visited the site]
$result = mysql_db_query($dbname, "INSERT INTO counter SET timestamp = time(), ip = '$current_userIPaddress'");
}
also this :
Code:
<?php
$dbhost='localhost';
$dbuser='minoux';
$dbpass='dein_password_hier_eintagen';
$dbname='minoux';
$conn=mysql_connect($dbhost, $dbuser, $dbpass) or die ('connection faild');
mysql_select_db($dbname);
?>
So my question is, it is gonna be required that every single HTML page has the password for the ftp of the webpage?
we shall replace the dein_password_hier_eintagen by the password.
I dont understand
SOLVED
Quote:
PHPGcount
PHP graphical hit counter
* PHP graphical hit counter (PHPGcount)
* Version: 1.1 from 26th October 2007
* Author: Klemen Stirn
* {PHPJunkYard.com - Free PHP scripts}
* {PHP text hit counter}
* {Support and developers forum}
PLEASE NOTE: I cannot provide free installation support for this free script! Please contact me ONLY about possible bug reports, suggestions or comments! Thank you!
INDEX
* {Copyright notice and license}
* {Description & requirements}
* {Installation}
* {Upgrading from old versions}
* {HELP and Troubleshooting}
* {Newsletter, rating this script and other}
COPYRIGHT NOTICE
Copyright 2004-2007 Klemen Stirn. All Rights Reserved.
The PHPGcount may be used and modified free of charge by anyone AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT. By using this code you agree to indemnify Klemen Stirn from any liability that might arise from it's use.
Selling the code for this program, in part or full, without prior written consent is expressly forbidden.
It is there free.
Enjoy, in any cases, dont hesitate to ask questiosn
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.