LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   PHP/SQL for Jedi: newbie question: Visitor tracker, counter (https://www.linuxquestions.org/questions/programming-9/php-sql-for-jedi-newbie-question-visitor-tracker-counter-720611/)

frenchn00b 04-21-2009 04:43 AM

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 dont understand

frenchn00b 04-21-2009 10:31 PM

Hi,

This works fine for me
HTML Code:

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
 <head>
  <title>iframe example</title>
  <style type="text/css">
  html, body, div, iframe { margin:0; padding:0; height:100%; }
  iframe { display:block; width:100%; border:none; }
  </style>

 </head>
 <body>
  <div>
  <iframe src="http://example.org/">
    <p><a href="http://example.org/">example.org</a></p>
  </iframe>
  </div>
 </body>
</html>

SOLVED

frenchn00b 04-22-2009 10:21 AM

Quote:

Originally Posted by frenchn00b (Post 3515986)
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 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


All times are GMT -5. The time now is 06:38 PM.