Guest Online

Started on the old forum in March 2008 · view the original in the archive · old links redirect here

22 replies · 3,236 views · started 18 years ago · 1 min read

9 participants
rukiya Lead · 569 posts #1

Well people here are searching this script.I have coded for them.You can get guest number and details who has visited last 5 minitues.You can change the session time. Make a guest.php file.Copy and paste this codes

<?php
$server = "";
$table = "visitors";
$database = "";
$username = "";
$password = "";
$connection = mysql_connect($server,$username,$password);
mysql_select_db($database,$connection);
$minutes = 5;
$seconds = $minutes*60;
$past = time()-$seconds;
$now = time();
if($_SERVER["REMOTE_ADDR"]){$ip=$_SERVER["REMOTE_ADDR"];}
else{$ip=$_SERVER["HTTP_X_FORWARDED_FOR"];}
$brws = explode("(",$_SERVER["HTTP_USER_AGENT"]);
$browser = $brws[0];
mysql_query("INSERT INTO $table SET ip='".$ip."', browser='".$browser."',date='".$now."'");
mysql_query("DELETE FROM $table WHERE date < '".$past."'");
$count = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM $table"));
echo "
<a href=\"online.php\">Users Online($count[0])</a>
";
?>

Then make online.php file copy and paste this codes

<?php
$server = "";
$database = "";
$username = "";
$password = "";
$connection = mysql_connect($server,$username,$password);
mysql_select_db($database,$connection);
$result = mysql_query("SELECT ip ,browser,date FROM visitors ORDER BY date ")or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "[b]$row[1][/b]";
$newtime =$row[2]+(6 *60 *60); 
echo "[b]".date("D d M y - H:i:s",$newtime)."[/b]
";
        echo "------------
";
}
?>

SQL table

CREATE TABLE visitors (
ip varchar(20) NOT NULL,
browser varchar(20) NOT NULL,
date int(10) DEFAULT '0' NOT NULL
)ENGINE=MyISAM DEFAULT CHARSET=latin1;
modfiles Developer · 200 posts #4

Here it is what you lookin for. i edit rukiyas work and add flags.

Attachments: Online.rar
johnny Junior · 47 posts #12

but after adding guest.php n online.php what link must i add to see it on index page

Learner lolz

ionutxp Developer · 137 posts #13
$count = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM visitors"));
echo "
<a href=\"online.php\">Guests Online($count[0])</a>
";

u can put in index

Hate romains that take codes from here and tell to all that they had made that External image (may be gone)

johnny Junior · 47 posts #14

i geting this error bro nd what must i put on my lgin index page to give guest acess to other users Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'test'@'localhost' (using password: NO) in /home/test/public_html/web/online.php on line 6

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/test/public_html/web/online.php on line 7

Warning: mysql_query() [function.mysql-query]: Access denied for user 'test'@'localhost' (using password: NO) in /home/test/public_html/web/online.php on line 8

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/test/public_html/web/online.php on line 8 Access denied for user 'test'@'localhost' (using password: NO)

Learner lolz

johnny Junior · 47 posts #16

QUOTE (Ricky21ster @ Jan 22 2009, 06:47 PM) <{POST_SNAPBACK}>

it is just because global register is turned off at your server turned it on by php.ini or .htaccess just upload any of them then that will work

download the attachments

its already on i myseld uploaded it so dnt knw why i m geting this error mate

Learner lolz

Guest #17

Its quite explanitory. Warning: mysql_query() [function.mysql-query]: Access denied for user 'test'@'localhost' (using password: NO) in /home/test/public_html/web/online.php on line 8

Access denied to database. Your password/username/dbname is wrong somewhere

johnny Junior · 47 posts #18

QUOTE (youngson @ Jan 22 2009, 09:35 PM) <{POST_SNAPBACK}>

Its quite explanitory. Warning: mysql_query() [function.mysql-query]: Access denied for user 'test'@'localhost' (using password: NO) in /home/test/public_html/web/online.php on line 8

Access denied to database. Your password/username/dbname is wrong somewhere

thanks mate its working now but now i got problem i dnt have coding for guest acess in my site

Learner lolz

inet Senior · 264 posts #19

QUOTE (johnny @ Jan 23 2009, 06:37 AM) <{POST_SNAPBACK}>

thanks mate its working now but now i got problem i dnt have coding for guest acess in my site

guest acces?

just use this code! it works well.. put it at index!

CODE

if(($action != "") && ($action!="terms") && ($action!="viewfrm") && ($action!="viewuser")&& ($action!="viewcat") && ($action!="viewtpc") && ($action!="forums")&& ($action!="main")&& ($action!="online")&& ($action!="stats")&& ($action!="funm")&& ($action!="vault")&& ($action!="pinoy2gal")&& ($action!="chat") && ($action!="onlines") && ($action!="partners")&& ($action!="disclaimer") && ($action!="pasok") && ($action!="patala")) { $uid = getuid_sid($sid); if((islogged($sid)==false)||($uid==0)) {

  echo "You are not logged in

"; echo "Or Your session has been expired

"; echo "<a href="index.php">Login</a>

"; echo " "; echo "</body>"; echo "</html>"; exit(); }

}

Services

Are you looking to take your wap or wapsite to a higher level? Do you want to stand out and rise above your competitors?

Below is a list of services I offer:

Wap Design and Customized Coding -The first way to stand out in a crowd is to have a brilliant and unique design for your wap or wapsite.

Rates

General consulting – My current hourly rate is $100 / hour. Custom Wapsite Community - My current rate is $500 / Wap Community Development.

johnny Junior · 47 posts #20

QUOTE (inet @ Jan 23 2009, 03:52 PM) <{POST_SNAPBACK}>

guest acces?

just use this code! it works well.. put it at index!

CODE

if(($action != "") && ($action!="terms") && ($action!="viewfrm") && ($action!="viewuser")&& ($action!="viewcat") && ($action!="viewtpc") && ($action!="forums")&& ($action!="main")&& ($action!="online")&& ($action!="stats")&& ($action!="funm")&& ($action!="vault")&& ($action!="pinoy2gal")&& ($action!="chat") && ($action!="onlines") && ($action!="partners")&& ($action!="disclaimer") && ($action!="pasok") && ($action!="patala")) { $uid = getuid_sid($sid); if((islogged($sid)==false)||($uid==0)) {

  echo "You are not logged in

"; echo "Or Your session has been expired

"; echo "<a href="index.php">Login</a>

"; echo " "; echo "</body>"; echo "</html>"; exit(); }

}

sorry i m new in coding so i m not that good nd where on index i must add this coding what useage must i use

Learner lolz

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close