Guest Online

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Guest Online

    guest Online with details ip and browsers details

    #2
    Code:
    <?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
    CODE
    <?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 "------------
    ";
    }
    ?>

    Comment


      #3
      CREATE TABLE visitors (
      ip varchar(20) NOT NULL,
      browser varchar(20) NOT NULL,
      date int(10) DEFAULT &#39;0&#39; NOT NULL
      )ENGINE=MyISAM DEFAULT CHARSET=latin1;

      Comment


        #4
        CREATE TABLE visitors (
        ip varchar(20) NOT NULL,
        browser varchar(20) NOT NULL,
        date int(10) DEFAULT &#39;0&#39; NOT NULL
        )ENGINE=MyISAM DEFAULT CHARSET=latin1;[/b]


        ip not showin lol chek it hungama-wap.net

        Comment


          #5
          ip not showin lol chek it hungama-wap.net[/b]
          look at code
          $result = mysql_query("SELECT ip ,browser,date FROM visitors ORDER BY date ")or die(mysql_error());
          while($row = mysql_fetch_array($result)){
          echo "$row[0]"; /* Add this line for IP */
          echo "$row[1]";//browser
          $newtime =$row[2]+(6 *60 *60);//for time

          Comment


            #6
            magnificent...

            Comment


              #7
              Problem with online guest on lavalair script

              i have done every thing and i domt see anything on my index i only c Visitors: nothing else i should b seein a 0 beside it and i dnt see itcould u please tell me wats wrong?

              Comment


                #8
                Working Damn Fine !!!

                Comment


                  #9
                  Originally posted by strikingv View Post
                  Working Damn Fine !!!
                  because thats my code and I upgraded my code.

                  Comment

                  Working...
                  X