Guest Online

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

    Guest Online

    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
    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=&#39;".$ip."&#39;, browser=&#39;".$browser."&#39;,date=&#39;".$now."&#39;");
    mysql_query("DELETE FROM $table WHERE date < &#39;".$past."&#39;");
    $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 "------------
    ";
    }
    ?>
    SQL table
    Code:
    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;

    #2
    its good but when you reload the page wherein the guest.php is, it will display lot of users defending on how many times you reloaded the page. and when you check the online list, it shows same browser but different time.
    anyway, thank you.

    Comment


      #3
      bro but it is not with flags no country
      Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

      <span style="color:#9ACD32"><span style="font-size:36pt;line-height:100%">BEST MOBILE ADVERTISER</span></span>

      Comment


        #4
        Here it is what you lookin for. i edit rukiyas work and add flags.
        Attached Files

        Comment


          #5
          thank you soooo much brou bro i need a lil help if you could guide me. my host had turned the register globals off and when i try to turn it on with .htaccess my site goes down it would not work why? how to fix it?
          Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

          <span style="color:#9ACD32"><span style="font-size:36pt;line-height:100%">BEST MOBILE ADVERTISER</span></span>

          Comment


            #6
            but works on lavalair wml or is 4 funmobile version???
            if like my post click:

            http://coding-talk.com/images/totall...ost_thanks.gif

            Comment


              #7
              its ok bro i just made a php.ini file and turned it on hehehehe
              Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

              <span style="color:#9ACD32"><span style="font-size:36pt;line-height:100%">BEST MOBILE ADVERTISER</span></span>

              Comment


                #8
                bro a lil error on the script everytime you refresh the fage the number of users keeps increasin tho the user is same just one but it will show more and more everytime you refresh the page
                Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

                <span style="color:#9ACD32"><span style="font-size:36pt;line-height:100%">BEST MOBILE ADVERTISER</span></span>

                Comment


                  #9
                  bro it dnt even say the country name or ip
                  Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

                  <span style="color:#9ACD32"><span style="font-size:36pt;line-height:100%">BEST MOBILE ADVERTISER</span></span>

                  Comment


                    #10
                    oh dumb me it shows the flags so we dnt need country name anyways hehehehe
                    Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

                    <span style="color:#9ACD32"><span style="font-size:36pt;line-height:100%">BEST MOBILE ADVERTISER</span></span>

                    Comment


                      #11
                      modfiles bro your script stoped working. it now only shows srilanka&#39;s flags
                      Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

                      <span style="color:#9ACD32"><span style="font-size:36pt;line-height:100%">BEST MOBILE ADVERTISER</span></span>

                      Comment


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

                        Comment


                          #13
                          Code:
                          $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

                          Comment


                            #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 &#39;test&#39;@&#39;localhost&#39; (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 &#39;test&#39;@&#39;localhost&#39; (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 &#39;test&#39;@&#39;localhost&#39; (using password: NO)

                            Comment


                              #15
                              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
                              Attached Files
                              get cheap web hosting ever AdzeHost
                              ===================
                              get free hosting for life time hostwebswap not allowed
                              ===================
                              get free cpanel web hosting free cpanel hostingwap are allowed
                              ===================

                              ===================

                              Comment

                              Working...
                              X