forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


VDSWORLD Forum Checkup
Goto page Previous  1, 2, 3, 4, 5
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code
View previous topic :: View next topic  
Author Message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Fri May 16, 2003 9:15 pm    Post subject: Reply with quote

Hortalonus wrote:
Changed it in mine. Thanks for the new function Tommy (or whomever added it)! Very Happy


Skit originally designed the code, I modified it and put it into the DATA.PHP
file for use with the checkup script. Wink

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Hortalonus
Valued Contributor
Valued Contributor


Joined: 15 Mar 2002
Posts: 344
Location: Western USA

PostPosted: Fri May 16, 2003 9:18 pm    Post subject: Reply with quote

FreezingFire wrote:
Skit originally designed the code, I modified it and put it into the DATA.PHP file for use with the checkup script. Wink

Well, thanks guys! It works great! Thumbs Up

_________________
"ah, come take my hand... we're ridin' out tonight to face the promised land"
Get a free iPod mp3 player...
Back to top
View user's profile Send private message Send e-mail
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Fri May 16, 2003 9:22 pm    Post subject: Reply with quote

No problem. That's what we like to do. Wink

Tommy, Skit, and I are the ones that will do the changes to the site and
functionality most of the time. Prakash does most of the server work
since VDSWORLD is proudly hosted on his servers. Server work includes
things such as mantaining the server, managing domains/subdomains
for VDSWORLD, etc. Smile

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Hortalonus
Valued Contributor
Valued Contributor


Joined: 15 Mar 2002
Posts: 344
Location: Western USA

PostPosted: Wed Apr 21, 2004 8:34 pm    Post subject: Reply with quote

What is the possibility of getting the latest and greatest version of this PHP script with the online user check included? Tommy posted this before the user check was implemented.

Tommy wrote:
Very nice Geotrail, thank you for the additions Very Happy

For everyone interested in using a similar script on their server, here's the PHP source code:

Code:

<?php
  function stripslashesruntime($string)
  {
      if (get_magic_quotes_runtime() > 0)
          return stripslashes($string);
      else
          return $string;
  }
  function stripslashesgpc($string)
  {
      if (get_magic_quotes_gpc() > 0)
          return stripslashes($string);
      else
          return $string;
  }
  function addslashesruntime($string)
  {
      return addslashes(stripslashesruntime($string));
  }
  function addslashesgpc($string)
  {
      return addslashes(stripslashesgpc($string));
  }

      header("Content-Type: text/plain");
      require("connect.inc");
      if ($request == "posts")
      {
          $limit = "";
          $mindate = addslashesgpc($mindate);
          if (preg_match("/....-..-../", $mindate))
              $limit = "(post_time >= '".gmmktime(0, 0, 0, substr($mindate, 5, 2), substr($mindate, 8, 2), substr($mindate, 0, 4))."')";
          $maxdate = addslashesgpc($maxdate);
          if (preg_match("/....-..-../", $maxdate))
          {
              if ($limit)
                  $limit .= " AND ";
              $limit .= "(post_time <= '".gmmktime(0, 0, 0, substr($maxdate, 5, 2), substr($maxdate, 8, 2), substr($maxdate, 0, 4))."')";
          }
          if ($limit)
              $limit = "WHERE $limit ";

          $result = mysql_query("SELECT post_id, topic_id, post_time, post_edit_time FROM phpbb_posts ".$limit."ORDER BY post_time;");
          $rowcount = @mysql_num_rows($result);
          if (isset($rowcount))
              if ($rowcount > 0)
                  while ($record = mysql_fetch_object($result))
                  {
                      print($record->topic_id."|".$record->post_id);
                      if ($date)
                      {
                          $edit = $record->post_edit_time;
                          if ($edit > 0)
                              $edit = gmdate("Y-m-d H:i:s", $edit);
                          else
                              $edit = "";
                          print("|".gmdate("Y-m-d H:i:s", $record->post_time)."|$edit");
                      }
                      print("\r\n");
                  }
      }
      elseif ($request == "text")
      {
          $result = mysql_query("SELECT topic_id, poster_id, post_subject, post_text FROM phpbb_posts, phpbb_posts_text WHERE phpbb_posts.post_id = phpbb_posts_text.post_id AND phpbb_posts.post_id = '".addslashesgpc($id)."';");
          $rowcount = @mysql_num_rows($result);
          if (isset($rowcount))
              if ($rowcount > 0)
              {
                  $record   = mysql_fetch_object($result);
                  $topicid  = $record->topic_id;
                  $posterid = $record->poster_id;
                  $subject  = stripslashesruntime($record->post_subject);
                  $text     = substr(stripslashesruntime($record->post_text), 0, $count);

                  $result   = mysql_query("SELECT topic_title FROM phpbb_topics WHERE topic_id = '$topicid';");
                  $record   = mysql_fetch_object($result);
                  $title    = stripslashesruntime($record->topic_title);

                  $result   = mysql_query("SELECT username FROM phpbb_users WHERE user_id = '$posterid';");
                  $record   = mysql_fetch_object($result);
                  $username = stripslashesruntime($record->username);

                  print("\r\n$username\r\n$title\r\n$subject\r\n$text");
              }
      }
      else
      {
          $result = mysql_query("SELECT post_id, topic_id FROM phpbb_posts ORDER BY post_time DESC LIMIT 0, 1;");
          $record = mysql_fetch_object($result);
          print($record->topic_id."|".$record->post_id);
          $result = mysql_query("SELECT vds_files.id, title, name FROM vds_files, vds_authors WHERE authorid = vds_authors.id AND enabled <> '0' AND hide = '0' ORDER BY date DESC LIMIT 0, 1;");
          $record = mysql_fetch_object($result);
          print("|".$record->id."|".stripslashesruntime($record->title)."|".stripslashesruntime($record->name));
      }
?>



All sensitive connection information is contained in a separate file, connect.inc. If you do the same, make sure to block downloads of *.inc files using a .htaccess file, or rename the file to .php.

Code:

<?php
  $mysql_host         = '';
  $mysql_user         = '';
  $mysql_password     = '';
  $mysql_database     = '';
  mysql_select_db($mysql_database, mysql_connect($mysql_host, $mysql_user, $mysql_password));
?>

_________________
"ah, come take my hand... we're ridin' out tonight to face the promised land"
Get a free iPod mp3 player...
Back to top
View user's profile Send private message Send e-mail
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed Apr 21, 2004 8:39 pm    Post subject: Reply with quote

Here is the block of code that does what you are looking for. Smile

Code:
      elseif ($request == "users")
      {
          $time = date("YmdHis");
          $time = $time-500;

          $sql = mysql_query("SELECT * FROM `phpbb_users`");
            while ($row = mysql_fetch_object($sql))
              {
                $last_visit = date("YmdHis",$row->user_session_time);
                  if ($time < $last_visit)
                    {
                      if ($row->user_allow_viewonline == 1)
                        {
                           echo "$row->username\n";
                        }
                    }
             }
      }

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed Apr 21, 2004 8:41 pm    Post subject: Reply with quote

So the complete code would be:

Code:
<?php
  function stripslashesruntime($string)
  {
      if (get_magic_quotes_runtime() > 0)
          return stripslashes($string);
      else
          return $string;
  }
  function stripslashesgpc($string)
  {
      if (get_magic_quotes_gpc() > 0)
          return stripslashes($string);
      else
          return $string;
  }
  function addslashesruntime($string)
  {
      return addslashes(stripslashesruntime($string));
  }
  function addslashesgpc($string)
  {
      return addslashes(stripslashesgpc($string));
  }

      header("Content-Type: text/plain");
      require("connect.inc");
      if ($request == "posts")
      {
          $limit = "";
          $mindate = addslashesgpc($mindate);
          if (preg_match("/....-..-../", $mindate))
              $limit = "(post_time >= '".gmmktime(0, 0, 0, substr($mindate, 5, 2), substr($mindate, 8, 2), substr($mindate, 0, 4))."')";
          $maxdate = addslashesgpc($maxdate);
          if (preg_match("/....-..-../", $maxdate))
          {
              if ($limit)
                  $limit .= " AND ";
              $limit .= "(post_time <= '".gmmktime(0, 0, 0, substr($maxdate, 5, 2), substr($maxdate, 8, 2), substr($maxdate, 0, 4))."')";
          }
          if ($limit)
              $limit = "WHERE $limit ";

          $result = mysql_query("SELECT post_id, topic_id, post_time, post_edit_time FROM phpbb_posts ".$limit."ORDER BY post_time;");
          $rowcount = @mysql_num_rows($result);
          if (isset($rowcount))
              if ($rowcount > 0)
                  while ($record = mysql_fetch_object($result))
                  {
                      print($record->topic_id."|".$record->post_id);
                      if ($date)
                      {
                          $edit = $record->post_edit_time;
                          if ($edit > 0)
                              $edit = gmdate("Y-m-d H:i:s", $edit);
                          else
                              $edit = "";
                          print("|".gmdate("Y-m-d H:i:s", $record->post_time)."|$edit");
                      }
                      print("\r\n");
                  }
      }
      elseif ($request == "text")
      {
          $result = mysql_query("SELECT topic_id, poster_id, post_subject, post_text FROM phpbb_posts, phpbb_posts_text WHERE phpbb_posts.post_id = phpbb_posts_text.post_id AND phpbb_posts.post_id = '".addslashesgpc($id)."';");
          $rowcount = @mysql_num_rows($result);
          if (isset($rowcount))
              if ($rowcount > 0)
              {
                  $record   = mysql_fetch_object($result);
                  $topicid  = $record->topic_id;
                  $posterid = $record->poster_id;
                  $subject  = stripslashesruntime($record->post_subject);
                  $text     = substr(stripslashesruntime($record->post_text), 0, $count);

                  $result   = mysql_query("SELECT topic_title FROM phpbb_topics WHERE topic_id = '$topicid';");
                  $record   = mysql_fetch_object($result);
                  $title    = stripslashesruntime($record->topic_title);

                  $result   = mysql_query("SELECT username FROM phpbb_users WHERE user_id = '$posterid';");
                  $record   = mysql_fetch_object($result);
                  $username = stripslashesruntime($record->username);

                  print("\r\n$username\r\n$title\r\n$subject\r\n$text");
              }
      }
elseif ($request == "users")
      {
          $time = date("YmdHis");
          $time = $time-500;

          $sql = mysql_query("SELECT * FROM `phpbb_users`");
            while ($row = mysql_fetch_object($sql))
              {
                $last_visit = date("YmdHis",$row->user_session_time);
                  if ($time < $last_visit)
                    {
                      if ($row->user_allow_viewonline == 1)
                        {
                           echo "$row->username\n";
                        }
                    }
             }
      }
      else
      {
          $result = mysql_query("SELECT post_id, topic_id FROM phpbb_posts ORDER BY post_time DESC LIMIT 0, 1;");
          $record = mysql_fetch_object($result);
          print($record->topic_id."|".$record->post_id);
          $result = mysql_query("SELECT vds_files.id, title, name FROM vds_files, vds_authors WHERE authorid = vds_authors.id AND enabled <> '0' AND hide = '0' ORDER BY date DESC LIMIT 0, 1;");
          $record = mysql_fetch_object($result);
          print("|".$record->id."|".stripslashesruntime($record->title)."|".stripslashesruntime($record->name));
      }
?>

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Hortalonus
Valued Contributor
Valued Contributor


Joined: 15 Mar 2002
Posts: 344
Location: Western USA

PostPosted: Thu Apr 22, 2004 12:21 am    Post subject: Reply with quote

Thanks FF! Handy function... very handy. Smile
_________________
"ah, come take my hand... we're ridin' out tonight to face the promised land"
Get a free iPod mp3 player...
Back to top
View user's profile Send private message Send e-mail
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Thu Apr 22, 2004 12:36 am    Post subject: Reply with quote

Glad to help. Smile
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code All times are GMT
Goto page Previous  1, 2, 3, 4, 5
Page 5 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group