News:

Please note these forums are mostly a testing ground for my SMF work and I don't really use them otherwise.

Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - SleePy

#161
News & Announcements / My SMF 2.0 Forum
Jul 23, 2007, 05:57 PM
You can view the SMF 2.0 Forum I currently have running if you wish. Please note SMF 2.0 is currently Alpha and only for Team members. I will not give you it no mater how much you beg, cry, whine or other methods you may come up with. So be patient and wait like the rest and get Charter Membership to get it a bit earlier than the rest.
#162
News & Announcements / Development Site Note
Jul 23, 2007, 05:56 PM
Please remember that this site is a developmental site create by one SMF user named SleePy, which is the basis of this sites name. All scripts are considered experimental and may disfunction. Feel free to contact me via the Contact Us page if you have questions.
#163
News & Announcements / Welcome to SleePycode
Jul 23, 2007, 05:56 PM
Welcome to SleePy Code.. Feel free to browse this site and explore what it has to offer. All pages used here are a combination of PHP, Ajax, Javascript, MySQL, XML (Not all pages use this), XHTML, and CSS formating to produce a single page. Most scripts use basic of these functions to even work.
#164
My httpd.conf:

# The part that loads the modules.
LoadModule php4_module        /sw/lib/apache2/modules/libphp4.so
LoadModule php6_module        /sw/lib/apache2/modules/libphp6.so
LoadModule php5_module        /sw/lib/apache2/modules/libphp5.so


# The part that does the virutal hosts.
<VirtualHost *:8080>
ScriptAlias /php6/ "//sw/usr/local/php6/"
Action php6-script /php6/bin/php
AddHandler php6-script .php
</VirtualHost>

<VirtualHost *:8081>
ScriptAlias /php5/ "/sw/usr/local/php523/"
Action php5-script /php5/bin/php
AddHandler php5-script .php
</VirtualHost>

<VirtualHost *:8082>

ScriptAlias /php4/ "/sw/usr/local/php447/"
Action php4-script /php4/bin/php
AddHandler php4-script .php
</VirtualHost>


#165
SELECT m.subject, t.id_topic as topic_id, m.id_topic as mtopic_id
FROM smf_topics AS t
   INNER JOIN smf_messages AS m ON (m.id_topic = t.id_topic)
WHERE t.id_board = 6
   AND t.id_board = m.id_board
ORDER BY poster_time DESC
LIMIT 10
#166
<?php

$i = 0;
foreach($context as $junk)
{
   ++$i;

   echo $junk;

   // If you can divide it by 2 evenly its time for a new row.
   if($i % 2 == 0 && $i != 0)
      echo '
';
}

?>
#167
function CanDo($smf_groups, $todo_groups, $permission)
{
   global $user_info, $tSettings;

   if(is_array($smf_groups))
      $TheSMFunc = 'array_intersect';
   else
      $TheSMFunc = 'in_array';

   if(!is_array($todo_groups))
      $todo_groups = array($todo_groups);

   if($TheSMFunc($smf_groups, $user_info['groups']))
   {
      if($TheSMFunc == 'array_intersect')
      {
         foreach($smf_groups as $smf_group)
         {
            $tgroup = $tSettings['permissions'][$smf_group];

            foreach($todo_groups as $thegroup)
            {
               if($thegroup == $tgroup)
               {
                  foreach($tSettings['moderation'][$permission] as $tperm)
                  {
                     if($tperm == $tgroup)
                        return true;
                  }
               }
            }
         }
      }
      else
      {
         $tgroup = $tSettings['permissions'][$smf_groups];

         foreach($todo_groups as $thegroup)
         {
            if($thegroup == $tgroup)
            {
               foreach($tSettings['moderation'][$permission] as $tperm)
               {
                  if($tperm == $tgroup)
                     return true;
               }
            }
         }
      }
   }

   return false;
}
#168
Traceroute to (69.72.214.163)
1 * (71.115.192.1) 8 ms 10 ms 8 ms
2 at-4-2-0-134.CORE-RTR1.SEA01.verizon-gni.net (130.81.36.96) 16 ms 16 ms 16 ms
3 so-0-3-0-0.BB-RTR1.SEA01.verizon-gni.net (130.81.20.76) 14 ms 16 ms 16 ms
4 so-7-2-0-0.BB-RTR1.SJC01.verizon-gni.net (130.81.19.4) 34 ms 34 ms 34 ms
5 so-6-0-0-0.PEER-RTR1.SJC80.verizon-gni.net (130.81.17.133) 34 ms 34 ms 36 ms
6 g4-1.ar1.sjc1.us.nlayer.net (69.22.153.45) 36 ms 36 ms 34 ms
7 tge1-3.ar1.pao1.us.nlayer.net (69.22.143.154) 38 ms 40 ms 38 ms
8 ge-2-1-1.cr1.sfo1.us.nlayer.net (69.22.143.161) 38 ms 72 ms 70 ms
9 so-0-2-0.cr1.ord1.us.nlayer.net (69.22.142.77) 80 ms 80 ms 80 ms
10 so-1-1-0.cr1.nyc3.us.nlayer.net (69.22.142.105) 98 ms 98 ms 98 ms
11 po1.ar1.nyc3.us.nlayer.net (69.31.95.130) 100 ms 100 ms 100 ms
12 fortressitx.g4-26.ar1.nyc3.us.nlayer.net (69.31.95.26) 132 ms 138 ms 200 ms
13 * (208.116.63.229) 100 ms 100 ms 102 ms
14 simplemachines.org (69.72.214.163) 100 ms 102 ms 110 ms
#169
ToDo / First Todo Task!
Jun 25, 2007, 05:30 PM
Build the ToDo

No Comments yet
#170
function CanDoAction($act)
{
   global $context;

   if(!isset($act))
      return false;
   elseif(empty($context['a'][$cur_act][1]))
      return false;
   elseif($context['a'][$cur_act][4] == 3)
      return false;
   elseif($context['a'][$cur_act][4] == 2 && !$context['l']['is_admin'])
      return false;
   elseif($context['a'][$cur_act][4] == 1 && !$context['l']['is_logged'])
      return false;
   elseif(!file_exists($context['t']['sourcedir'] . '/Page-' . $context['a'][$cur_act][1] . '.php'))
      return false;
   else
      return true;
}
#171
   while ($row = mysql_fetch_assoc($request))
   {
      // We need this to get the recipients.
      $pms[] = $row['ID_PM'];

      // This is the main stuff though.
      $pmessages[$row['ID_PM']] = array(
         'id' => $row['ID_PM'],
         'from' => array(
            'id' => $row['ID_MEMBER_FROM'],
            'name' => $row['RealName'],
            ),
         'recipients' => array(
            'to' => array(),
            'bbc' => array(),
            ),
         'labels' => explode(',', $row['labels']),
         'sent' => timeformat($row['msgtime']),
         'subject' => $row['subject'],
         'body' => $row['body'],
         );

      $templables = explode(',', $row['messageLabels']);
      foreach ($pmessages[$row['ID_PM']]['labels'] as $num => $label)
      {
         if($label == -1)
            $templables[$label] = 'inbox';
            
         $pmessages[$row['ID_PM']]['labels'][$num] = $templables[$label];
      }

   }
#172
      // Are we dumping the structures?
      if (isset($_GET['struct']))
      {
         echo
            $crlf,
            '#', $crlf,
            '# Table structure for table `', $tableName[0], '`', $crlf,
            '#', $crlf,
            $crlf,
            'DROP TABLE IF EXISTS `', $tableName[0], '`;', $crlf,
            $crlf,
            getTableSQLData($tableName[0]), ';', $crlf;
      }
#173
   // Output Time..
   foreach($pmessages as $msg)
   {
      // Stuff we need to set.
      $rcp_start = true;
      $labl_start = true;

      // Start Output..
      echo '
From: ', $msg['from']['name'], ' (ID: ', $msg['from']['id'], ')', $crlf,
'To: ';

      // For Everyone it went to besides BBC (Cuss you shouldn't know) tell us
      foreach ($msg['recipients']['to'] as $rcp)
         echo ($rcp_start ? ($rcp_start = false) : ', '), $rcp['name'], ' (ID: ', $rcp['id'], ')';

      // Folders are next
      echo $crlf,
'Folders: ';

      // For every folder we tell.
      foreach ($msg['labels'] as $labl)
         echo ($labl_start ? ($labl_start = false) : ', '), $labl;

      echo $crlf,
'Sent: ', $msg['sent'], $crlf,
'Subject: ', $msg['subject'], $crlf,
$msg['body'];
      
      echo $crlf,$crlf;
   }
#174
function ExportMessages()
{
   global $db_prefix, $ID_MEMBER, $scripturl, $user_info;
   // Find all Messages to export...
//          AND FIND_IN_SET('-1', pmr.labels)
   $request = db_query("
      SELECT pm.ID_PM, pm.ID_MEMBER_FROM, mem_to.RealName, pm.msgtime, pm.subject, pm.body, pmr.labels, mem_to.messageLabels
      FROM ({$db_prefix}personal_messages AS pm, {$db_prefix}pm_recipients AS pmr)
            LEFT JOIN {$db_prefix}members AS mem_to ON (mem_to.ID_MEMBER = pmr.ID_MEMBER)
      WHERE pmr.ID_PM = pm.ID_PM
         AND pmr.ID_MEMBER = $ID_MEMBER
         AND pmr.deleted = 0
      ORDER BY pmr.ID_PM ASC", __FILE__, __LINE__);

   // Load the ID_PMs and ID_MEMBERs and initialize recipients.
   $pms = array();
   $recipients = array();
   $pmessages = array();
   while ($row = mysql_fetch_assoc($request))
   {
      if (!isset($recipients[$row['ID_PM']]))
      {
         // We need this to get the recipients.
         $pms[] = $row['ID_PM'];

         // This is the main stuff though.
         $pmessages[$row['ID_PM']] = array(
            'id' => $row['ID_PM'],
            'from' => array(
               'id' => $row['ID_MEMBER_FROM'],
               'name' => $row['RealName'],
               ),
            'recipients' => array(
               'to' => array(),
               'bbc' => array(),
               ),
            'labels' => explode(',', $row['labels']),
            'sent' => $row['msgtime'],
            'subject' => $row['subject'],
            'body' => $row['body'],
            );
      }

      // Stop Repeating ourselves.
      if(isset($templables))
         $templables = explode(',', $row['messageLabels']);
   }
   mysql_free_result($request);

   if (!empty($pms))
   {
      // Get recipients (don't include bcc-recipients for your inbox, you're not supposed to know :P).
      $request = db_query("
         SELECT pmr.ID_PM, mem_to.ID_MEMBER AS ID_MEMBER_TO, mem_to.realName AS toName, pmr.bcc, pmr.labels, pmr.is_read
         FROM {$db_prefix}pm_recipients AS pmr
            LEFT JOIN {$db_prefix}members AS mem_to ON (mem_to.ID_MEMBER = pmr.ID_MEMBER)
         WHERE pmr.ID_PM IN (" . implode(', ', $pms) . ")", __FILE__, __LINE__);
      $context['message_labels'] = array();
      $context['message_replied'] = array();
      while ($row = mysql_fetch_assoc($request))
      {
         if (empty($row['bcc']))
            $pmessages[$row['ID_PM']]['recipients'][empty($row['bcc']) ? 'to' : 'bcc'][] = array (
               'id' => $row['ID_MEMBER_TO'],
               'name' => $row['toName'],
               );
      }

      mysql_free_result($request);
   }
   echo 'pmessages
', print_r($pmessages), '
';
}
#175
test
#176
<?php
$dir = date('Y-m-d', time());
$pass = '2424';

if(!is_dir('/home/cpanelname/backups/' . $dir))
   mkdir ('/home/cpanelname/backups/' . $dir);

chdir ('/home/cpanelname/backups/' . $dir);
$filename = 'backup-yoursite.com-' . $dir . '.tar.gz';
@shell_exec('curl -Ok -u cpanelname:'.$pass.' https://yoursite.com:2083/getbackup/'.$filename);
?>
#177
// Define document.getElementById for Internet Explorer 4.
if (typeof(document.getElementById) == "undefined")
   document.getElementById = function (id)
   {
      // Just return the corresponding index of all.
      return document.all[id];
   }
// Define XMLHttpRequest for IE 5 and above. (don't bother for IE 4 :/.... works in Opera 7.6 and Safari 1.2!)
else if (!window.XMLHttpRequest && window.ActiveXObject)
   window.XMLHttpRequest = function ()
   {
      return new ActiveXObject(is_ie5 ? "Microsoft.XMLHTTP" : "MSXML2.XMLHTTP");
   };
#178
PasteBin / PasteBin - 1179362578
May 17, 2007, 12:42 AM
<&#63;php

Do_Hopefully_Last_Test();

echo 
'eehehehee';

exit;

?>
#179
PasteBin / PasteBin - 1179360472
May 17, 2007, 12:07 AM
<php

echo 'Testing php'$var$vog' is a pimp';

?>
#180
PasteBin / PasteBin - 1179360443
May 17, 2007, 12:07 AM
<&#63;php

echo 'Testing php'$var$vog' is a pimp';

?>