LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-21-2009, 04:43 AM   #1
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Rep: Reputation: 57
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
 
Old 04-21-2009, 10:31 PM   #2
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Original Poster
Rep: Reputation: 57
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
 
Old 04-22-2009, 10:21 AM   #3
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Original Poster
Rep: Reputation: 57
Quote:
Originally Posted by frenchn00b View Post
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
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL noob question: can SQL effectively handle a 2D matrix? JoeyAdams Programming 2 03-17-2008 01:10 AM
Newbie PHP question sleepisforwimps Programming 2 08-28-2005 04:06 AM
how to check if the visitor is using https using php ? graziano1968 Programming 3 11-10-2004 02:55 PM
PHP newbie question jacksmash Programming 20 11-22-2003 11:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration