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

#81
import java.util.Scanner;

public class BeerSong
{
  public static void main(String[] args)
  {
    Scanner keyboard = new Scanner(System.in);
    int beers = 99;

    try
    {
      System.out.println("How many beers are on the wall (limit of 99)?");
      beers = keyboard.nextInt();
    }
    catch (RuntimeException e)
    {
      System.out.println("ERROR: Invalid Number input, defaulting to 99");
    }

    if (beers > 99)
      beers = 99;
    else if (beers < 0)
      beers = 0;
   
    printSong(beers);
  }
 
  public static void printSong(int beers)
  {
    for (int i = beers; i >= 0; i--)
    {    
      if (i == 0)
      {
        System.out.println("No bottles of beer on the wall, no bottles of beer.");
        System.out.print("Go to the store and buy some more");
       
        if (beers != 0)
          System.out.print(", " + beers);
        System.out.println(" bottles of beer on the wall");
      }
      else
      {
        String alphaBeers = ConvertToAlpha(i);
        String alphaNewBeers = ConvertToAlpha((i - 1));

        System.out.println(alphaBeers + " bottles of beer on the wall, " + alphaBeers + " bottles of beer.");
        System.out.println("Take one down and pass it around, " + alphaNewBeers + " beers on the wall.");
        System.out.println("");
      }
    }
  }
 
  private static String ConvertToAlpha(int number)
  {
    if (number < 14)
      return intToAlpha(number);
    else
    {
      String temp = "";

      if ((number % 10) != 0)
        temp = (number > 20 ? "-" : "") + ConvertToAlpha((number % 10));

      if (number < 20)
        return temp + TenIntToAlpha((number / 10));
      return TenIntToAlpha((number / 10)) + temp;
    }
  }
 
  private static String intToAlpha(int number)
  {
    String[] alphaNumbers = new String[] {"No More", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen"};
    return alphaNumbers[number];
  }
 
  private static String TenIntToAlpha(int number)
  {
    String[] alphaNumbers = new String[] {"", "teen", "Twenty", "Thirty", "Fourty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"};
    return alphaNumbers[number];
  }
}
#82
From My 1.1.5:
         echo '
                     ', $topic['is_sticky'] ? '' : '' , '<span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span>', $topic['is_sticky'] ? '' : '';

From SMF 1.1 SVN:
         echo '
                     ', $topic['is_sticky'] ? '' : '' , '<span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span>', $topic['is_sticky'] ? '' : '';

Your Mod File:
      echo '
                  ', $topic['is_sticky'] ? '' : '' , '<span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span>', $topic['is_sticky'] ? '' : '';
#83
14:31:43 -  * Looking up irc.villageirc.net
14:31:43 -  * Connecting to irc.villageirc.net (69.72.215.132) port 9999...
14:32:17 -  * * Subject: /C=NO/ST=Soer-Troendelag/L=Trondheim/O=ShadowRealm Creations/OU=Village IRC Network/CN=VillageIRC.net/CN=irc.VillageIRC.net
14:32:17 -  * * Issuer: /C=NO/ST=Soer-Troendelag/L=Trondheim/O=ShadowRealm Creations/OU=Village IRC Network/CN=VillageIRC.net/CN=irc.VillageIRC.net
14:32:17 -  * * Subject: /C=NO/ST=Soer-Troendelag/L=Trondheim/O=ShadowRealm Creations/OU=Village IRC Network/CN=VillageIRC.net/CN=irc.VillageIRC.net
14:32:17 -  * * Issuer: /C=NO/ST=Soer-Troendelag/L=Trondheim/O=ShadowRealm Creations/OU=Village IRC Network/CN=VillageIRC.net/CN=irc.VillageIRC.net
14:32:17 -  * * Subject: /C=NO/ST=Soer-Troendelag/L=Trondheim/O=ShadowRealm Creations/OU=Village IRC Network/CN=VillageIRC.net/CN=irc.VillageIRC.net
14:32:17 -  * * Issuer: /C=NO/ST=Soer-Troendelag/L=Trondheim/O=ShadowRealm Creations/OU=Village IRC Network/CN=VillageIRC.net/CN=irc.VillageIRC.net
14:32:17 -  * * Certification info:
14:32:17 -  *   Subject:
14:32:17 -  *     C=NO
14:32:17 -  *     ST=Soer-Troendelag
14:32:17 -  *     L=Trondheim
14:32:17 -  *     O=ShadowRealm Creations
14:32:17 -  *     OU=Village IRC Network
14:32:17 -  *     CN=VillageIRC.net
14:32:17 -  *     CN=irc.VillageIRC.net
14:32:17 -  *   Issuer:
14:32:17 -  *     C=NO
14:32:17 -  *     ST=Soer-Troendelag
14:32:17 -  *     L=Trondheim
14:32:17 -  *     O=ShadowRealm Creations
14:32:17 -  *     OU=Village IRC Network
14:32:17 -  *     CN=VillageIRC.net
14:32:17 -  *     CN=irc.VillageIRC.net
14:32:17 -  *   Public key algorithm: rsaEncryption (1024 bits)
14:32:17 -  *   Public key algorithm uses ephemeral key with -1826737944 bits
14:32:17 -  *   Sign algorithm md5WithRSAEncryption (0 bits)
14:32:17 -  *   Valid since Dec 19 22:35:07 2005 GMT to Dec 19 22:35:07 2007 GMT
14:32:17 -  * * Cipher info:
14:32:17 -  *   Version: TLSv1/SSLv3, cipher AES256-SHA (256 bits)
14:32:17 -  * Connection failed. Error: certificate has expired.? (10)
#84
// Handles our errors.
function convert_error_hanlder($error_level, $error_string, $file, $line)
{
   // Our error_log
   $convert_error_log = dirname(__FILE__) . '/convert_error_log';

   // Open the file up for writing (with pointer at end).
   $fp = fopen($convert_error_log, 'a+');
   $error_string = '';

   // Can't open it!
   if (!$fp)
      $no_write_file = true;

   // Lets leave a paper trail.
   $backtace = debug_backtrace();
   
   // Generate a simple error message familer to PHP errors.
   $error_data = "\r" . $error_level % 255 == E_ERROR ? 'Error' : ($error_level % 255 == E_WARNING ? 'Warning' : 'Notice') . ': ' . $error_string, ' in ' . $file . ' on line ' . $line . "\r" . 'Backtrace report' . "\r" . '---';

   // Now loop through our backtrace for output.
   foreach ($backtace as $trail)
   {
      foreach ($trail as $key => $value)
      {
         if (!is_array($value))
            $error_data .= "\t " . $key . " (key): " . $value . "\r";
         else
         {
            $error_data .= "\t" . $key . " (key): " . "\r";
            
            foreach ($value as $vkey => $vvalue)
               $error_data .= "\t\t" . $vkey . " (key): " . $vvalue . "\r";
         }
      }

      // Add an extra return.
      $error_data .= "\r";
   }

   // Send it out to the error log. Only if we can though.
   if (empty($no_write_file))
   {
      fwrite($fp, $error_data);
      fclose($fp);
   }   

   // Now send something to let the user know.
   echo $error_data;
}
#85
Blog Board / PHP Development going SVN!
Jul 29, 2008, 04:56 AM
While this isn't related to my site or anything. I thought I would post about this.

I generally read the PHP.net Internals mailing lists. While I used to be subscribed to it, I just can't take reading another 50 more emails a day :P
This interesting thing popped up during my reads
http://news.php.net/php.internals/39281

It seems the message was talking about Subversion, I found this interesting as Simple Machines uses it, and other software I have seen is converting to it or using it. What really picked up my attention was OSCON. I attended OSCON this year in Portland, Oregon, USA. It was amazing let me tell you, OSCON was an event I am glad I didn't miss. It was also fun to hang out with a few other team members from Simple Machines and show off the software.

I don't know if Rasmus Lerdorf was at OSCON or not. But after a quick search based on his email and pulling up his bio (how scary and cool is that) I found his picture. I don't remember that face at all during OSCON. To bad it would of been cool to know I meet somebody from PHP.net ;)

Anyways, back to the story. The email talks about basically converting the whole cvs base of php.net to svn. It goes into details and such. This was also confirmed when Gwynne Raskind sent out an email confirming the migration it seems.
http://news.php.net/php.internals/39291

Yea, so that is it. It is a bit nerdy news, but news is interesting for me.. Now I could easily get the bleeding edge of php development instead of just snapshots (I never liked cvs). Which does remind me I should update my PHP engines on my macbook pro. I am running 6.0 and 5.3 builds that are at least 1 month old.

I guess that will be after I work on the dummy upgrade tests I am performing of one of my sites to bring it to SMF 2.0. That itself is a major task as I want to overhaul the overall look and build its own homepage instead of using TinyPortal (Nothing against it, just only use it for the news on frontpage and could reduce queries without it).
#86
The-SleePy-Laptop:~ jeremy$ dig irc.freenode.net @i.root-servers.net

; <<>> DiG 9.4.1-P1 <<>> irc.freenode.net @i.root-servers.net
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21586
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 14
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;irc.freenode.net.      IN   A

;; AUTHORITY SECTION:
net.         172800   IN   NS   I.GTLD-SERVERS.net.
net.         172800   IN   NS   J.GTLD-SERVERS.net.
net.         172800   IN   NS   K.GTLD-SERVERS.net.
net.         172800   IN   NS   L.GTLD-SERVERS.net.
net.         172800   IN   NS   M.GTLD-SERVERS.net.
net.         172800   IN   NS   A.GTLD-SERVERS.net.
net.         172800   IN   NS   B.GTLD-SERVERS.net.
net.         172800   IN   NS   C.GTLD-SERVERS.net.
net.         172800   IN   NS   D.GTLD-SERVERS.net.
net.         172800   IN   NS   E.GTLD-SERVERS.net.
net.         172800   IN   NS   F.GTLD-SERVERS.net.
net.         172800   IN   NS   G.GTLD-SERVERS.net.
net.         172800   IN   NS   H.GTLD-SERVERS.net.

;; ADDITIONAL SECTION:
A.GTLD-SERVERS.net.   172800   IN   A   192.5.6.30
A.GTLD-SERVERS.net.   172800   IN   AAAA   2001:503:a83e::2:30
B.GTLD-SERVERS.net.   172800   IN   A   192.33.14.30
B.GTLD-SERVERS.net.   172800   IN   AAAA   2001:503:231d::2:30
C.GTLD-SERVERS.net.   172800   IN   A   192.26.92.30
D.GTLD-SERVERS.net.   172800   IN   A   192.31.80.30
E.GTLD-SERVERS.net.   172800   IN   A   192.12.94.30
F.GTLD-SERVERS.net.   172800   IN   A   192.35.51.30
G.GTLD-SERVERS.net.   172800   IN   A   192.42.93.30
H.GTLD-SERVERS.net.   172800   IN   A   192.54.112.30
I.GTLD-SERVERS.net.   172800   IN   A   192.43.172.30
J.GTLD-SERVERS.net.   172800   IN   A   192.48.79.30
K.GTLD-SERVERS.net.   172800   IN   A   192.52.178.30
L.GTLD-SERVERS.net.   172800   IN   A   192.41.162.30

;; Query time: 195 msec
;; SERVER: 192.36.148.17#53(192.36.148.17)
;; WHEN: Sun Jul 13 21:53:32 2008
;; MSG SIZE  rcvd: 503

#87
The-SleePy-Laptop:~ jeremy$ dig freenode.net

; <<>> DiG 9.4.1-P1 <<>> freenode.net
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1636
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;freenode.net.         IN   A

;; ANSWER SECTION:
freenode.net.      3327   IN   A   140.211.166.123

;; Query time: 33 msec
;; SERVER: 208.67.222.222#53(208.67.222.222)
;; WHEN: Sun Jul 13 21:49:14 2008
;; MSG SIZE  rcvd: 46

The-SleePy-Laptop:~ jeremy$ dig freenode.net @e.gtld-servers.net

; <<>> DiG 9.4.1-P1 <<>> freenode.net @e.gtld-servers.net
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 2416
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;freenode.net.         IN   A

;; AUTHORITY SECTION:
net.         900   IN   SOA   a.gtld-servers.net. nstld.verisign-grs.com. 1216010947 1800 900 604800 900

;; Query time: 109 msec
;; SERVER: 192.12.94.30#53(192.12.94.30)
;; WHEN: Sun Jul 13 21:49:24 2008
;; MSG SIZE  rcvd: 103
#88

1

2


3
test
#89
The test zone / test pages
Jul 05, 2008, 07:14 PM
d
#90
Blog Board / Where does a script come from
Jun 27, 2008, 09:08 PM
Well, this is easier to explain to anyone of all ages (unlike explaining where other things come from).

For me, a script just doesn't appear nor do I just open something up and start coding right away. I don't know about most people but I do know I like to think about what I am going to do and think about the best possible way to accomplish it.

For the most part, I start off with just thinking about it. It may take days to do this. I usually find it best to go do something like play video games or work really hard at work. I don't know why, but once I have my mind off coding I am able to think very clearly on how to create something. It is usually during something else I spawn the good idea and then start working out the details in my head.
I go over what I think I will need such as functions, loops, arrays, variables, etc. It makes it fun when you have other things such as SMF going to be involved in the script as then I start to add in, doesn't SMF do this already? Then go about thinking how I can accomplish it without doing to much work and using my already available resources.
This is why I like working on very new versions of PHP. If I where to use PHP 4, I couldn't use the scandir function and would need to use the opendir function and set it into a handler, then loop through it in a while and get all the files/directories in that directory into an array and then close it. Thats a lot more work than just calling a simple function.

If I am going to be working with a database it depends on what I do next. If I am using SMF such as making a mod, I will manipulate things in the database to see if I can't use already available tables and columns). If I am using my own database or not using SMF, I usually hold off on this for a bit.

The next part is actually working with the script. If I am not using SMF but my own script, I usually save time and just hard code things that will sooner or later be arrays or variables that where received from a database query. My main focus at the point is to just get it going. During this process I usually don't remove hard coded text strings or anything like that. It makes it easy for if I have a new sparked idea on how to do something I can change it without going to to many files. As well I usually hard code right in there at the end of it the template part so I can easily split it out and debug any issues from that.

Once that is done, if I did hard code queries, I go back in and make them work as they should and start manipulating the database. Sometimes I am not messing with a database but instead a file or something, no mater what I am doing, I usually leave the dynamics such as files or queries until I got the initial idea down of how I wanted the script done.

After I got it working more dynamic, I start by removing hard coded text strings and using sprintf function as needed to make it so translation into other languages work properly. As well during this stage I will also move it correctly to its template and make the calls in source files as needed so it knows what template file we are looking for.

Finally I have the script going, its dynamic, its using language strings, it has a template, but I am not done yet. At this stage I am usually doing bug checking to ensure it should still work. I check my theories and functions to make sure they are logical. As well if I didn't already I make sure I am using proper coding and comments (where needed).

Hopefully after all of this the script is ready. I then do some more final touches to it. Add some spices and maybe some Easter eggs. Who knows, its all working and ready to go, I can add some fun stuff if I wanted to :P

That is how I usually come up with a script, Most people don't realize that a script just doesn't always appears. By doing things in this order it does help out with your script development. For others it is sometimes easier to just start coding, find issues and continue through this process of guess and check and possibly tons of rewrites to just get where they wanted to in the first place.
#91
This has to be one of the funnest things I like to do.
Reading a directory in PHP is very simple, infact if you are using PHP 5 you can just use the scandir function and get the array it returns.
It is just as easy to use a $_GET or $_REQUEST to change the directory you are reading...

But what is going to stop somebody from doing some very clever hacking here and get to areas you don't want to allow them in?
The one thing you should know about hackors, is if its not easy to do or will waste to much time. They will most likely give up and go to somebody else who isn't as secure. There are some who if they are specifically attempting to attack you will waste that time.

Well while programing two different scripts recently I came across two methods I like nicely.

The first one is simple actually, Just base64 encode the relative path (ie /forum/index.php) and use that as part of the url.
Then in your script to view directories, you have that base64 value in a array of allowed strings. This is a simple method.
But what if I wanted to be dynamic?

Well I had to do this for another script I wrote and I thought hard about this and beheld a really simple, yet complex idea.
The first thing I did was treat each folder change as a new item in an array. So it was like dir[]=forum dir[]=Themes.
This was the simple part. I then throw out any bad ones such as people wanting to use any periods in the directory or slashes (This was it simply but I used a complex regex to match other things as well).
I didn't want to the array to be in plain text in the url. So I did something very simple and encoded the url using base64. While anyone code decode it, it added a layer and made it so that the single string going in had to be base64 encoded.

Now that I had things in check, I could manipulate it. I could easily drop the last item in the array off for somebody to go back a directory or add a new item to change to a new directory.

You may ask, why is it worth it? Well now that I knew exactly where my users where going, I could easily even block off certain folders. Such as a "Sources" folder that had "Forum" as its part array item. This was the fun part, I could do anything I wanted and block off only certain sections as well as string of words. So I could really give somebody access to see all a files in a directory without comprising my security.

Well I still wanted to take it to another level, just because I was in the mood for it. So I added two salts onto the url that gets passed to the user. The nice thing about it is in one of the salts is needed otherwise the script won't let you continue. It is a matching and nicely mixed into the array to make sure those who want to try and change the url, will need to do some work.
Now for the second salt I went into this with a little fun, I made it so this salt contains a encrypted one way string of the current directory they where viewing. This uses a few encryption methods and I won't disclose all of those as there is many out there such as sha1, sha256, md5, md4, etc all for usage and I did a combination of some of those and others in a mixture. So it would take a haxor a while to figure this out and get the pattern right that I was using..
With that in mind, I decided to make it randomly change those based on your session id. So if you get a new session it would add a key to it. This key itself is just a code that tells it which method of encryption it should be using. So yes I know have taken it to the next level by making sure those who want to figure it out may be spending hours to get things right and all the possible combination's it may have (I use a separate file that figures out which method I was using and either makes the match or kicks them as invalid, just so I didn't dirty up my code with all the possibilities and using a function is nicer :P )

So I had fun doing this and could even take more steps, but it works as I wanted it to and to let you know, this was just to view directories, I did let them view certain files and images, which took another step of work for me to do but it was worth it for the fact I know that those who attempt to exploit such things will most likely give up and go try somebody else who might not have been using as good security.

Thats all for this blog.
#92
// Provide a way to do results with offsets
fucntion convert_result($request, $offset = 0, $field_name = '')
{
   global $smcFunc;

   // SQLite is a pain, This should hopefully work.
   if ($smcFunc['db_title'] == 'SQLite')
   {
      $result = $smcFunc['db_query']('', $request, 'security_override');

      $t = 0;

      while ($row = sqlite_fetch_array($result))
      {
         if ($t != $offset)
            ++$t;
         elseif ($field_name != '')
            return $row[$field_name];
         else
            return $row[0];
      }   
   }
   // Luckily Postgresql is with it.
   elseif ($smcFunc['db_title'] == 'PostgreSQL')
      return pg_fetch_result($request, $offset, $field_name);
   else
      return mysql_fetch($request, $offset, $field_name);
}
#93
The test zone / anchors in your pants
Jun 08, 2008, 05:36 PM
anchor is an inline element. You are trying to use it as a block level element.

Use it like this:
[anchor=T1][/anchor]

Or just not at all
[anchor=T1]
#94
Finally,
After working on it for months, I finally managed to update my code, as well as fix a few bugs and a few minor features to the site. While you won't notice much from the user front, things have been fixed all over and my coding complies now to my own standards.
I did write this site back a while ago (over 2 years ago) and it was using styles and standards from before I even joined the SMF team. I am happy to say it complies with this now and follows a more simplistic method to accomplish things, I didn't take much load time off, but that is ok, I didn't add any either ;D

I also updated my PasteBin, Todo, and blog page to the new standards and using proper 2.0 coding (When I upgraded this site to 2.0 for the first time I did quick fixes to get everything working again and left it). So that is good news now.
I finally cleaned up the last of the errors that where being generated into my php error log. That was thanks to a script that catches the php errors and logs them into a single file that is emailed to me for fixing (I run to many sites to keep up on php error logs for all of them). Though mostly it was templating issues from when I split my source away from my theming/output coding.

My next part of the big project was to allow source viewing of the page content. I haven't got very far on this as I want to impose a very nice security model on the script to prevent naughty people :P I recently coded another script that allows file source viewing and I am thinking of using its model as the source for my work here. Though I haven't go much further than adding the files and forcing it to be an admin only page ;D

After that I plan on bringing my file manager script into this century. Currently when I upload something and want it private I have to go to my admin panel (not really an admin panel yet), and add the files name into a list of private files.
I am wanting to improve this so I can simply check a ratio box and force it to hidden (or one of the other two options).
During that process I plan on making an actual Administration panel for myself, just because I am to lazy to keep logging into FTP to do these things ::)

Finally I hope after all that, I can actually get some new scripts up here. I haven't had very many ideas lately or time to push froward on scripts. Which is why I am guessing that to complete even one of those above it will take me months.

Ok, now to upgrade the forums and hope I don't break things >:D
#95
ToDo / Test Task
May 22, 2008, 09:46 PM
Weeeeee.
#96
   // Determine the method of insertion.
   $queryTitle = $method == 'replace' ? 'REPLACE' : ($method == 'ignore' ? 'INSERT IGNORE' : 'INSERT');
   
   smf_db_error_backtrace($insertRows);
   smf_db_error_backtrace('
      ' . $queryTitle . ' INTO ' . $table . '(' . implode(', ', $indexed_columns) . ')
      VALUES
         ' . implode(',
         ', $insertRows));
   
   // Do the insert.
   $smcFunc['db_query']('', '
      ' . $queryTitle . ' INTO ' . $table . '(' . implode(', ', $indexed_columns) . ')
      VALUES
         ' . implode(',
         ', $insertRows),
      array(
         'security_override' => true,
      ),
      $connection
   );
#97
array(4) {
 
[0]=>
  array(4) {
    ["file"]=>
    string(62) "/home/smf/public_html/SVN/7133-0/Sources/Subs.php"
    ["line"]=>
    int(2912)
    ["function"]=>
    string(13) "smf_db_insert"
    ["args"]=>
    array(5) {
      [0]=>
      &string(7) "replace"
      [1]=>
      &string(27) "{db_prefix}log_floodcontrol"
      [2]=>
      &array(3) {
        ["ip"]=>
        string(9) "string-16"
        ["log_time"]=>
        string(3) "int"
        ["log_type"]=>
        string(6) "string"
      }
      [3]=>
      &array(3) {
        [0]=>
        string(9) "127.0.0.1"
        [1]=>
        int(1210227507)
        [2]=>
        string(6) "search"
      }
      [4]=>
      &array(2) {
        [0]=>
        string(2) "ip"
        [1]=>
        string(8) "log_type"
      }
    }
  }
  [1]=>
  array(4) {
    ["file"]=>
    string(64) "/home/smf/public_html/SVN/7133-0/Sources/Search.php"
    ["line"]=>
    int(926)
    ["function"]=>
    string(14) "spamProtection"
    ["args"]=>
    array(1) {
      [0]=>
      &string(6) "search"
    }
  }
  [2]=>
  array(2) {
    ["function"]=>
    string(12) "PlushSearch2"
    ["args"]=>
    array(0) {
    }
  }
  [3]=>
  array(4) {
    ["file"]=>
    string(55) "/home/smf/public_html/SVN/7133-0/index.php"
    ["line"]=>
    int(151)
    ["function"]=>
    string(14) "call_user_func"
    ["args"]=>
    array(1) {
      [0]=>
      &string(12) "PlushSearch2"
    }
  }
}

Array
(
    [0] => ip
    [1] => log_time
    [2] => log_type
)
1

array(7) {
 
[0]=>
  array(4) {
    ["file"]=>
    string(64) "/home/smf/public_html/SVN/7133-0/Sources/Errors.php"
    ["line"]=>
    int(150)
    ["function"]=>
    string(13) "smf_db_insert"
    ["args"]=>
    array(5) {
      [0]=>
      &string(0) ""
      [1]=>
      &string(21) "{db_prefix}log_errors"
      [2]=>
      &array(9) {
        ["id_member"]=>
        string(3) "int"
        ["log_time"]=>
        string(3) "int"
        ["ip"]=>
        string(9) "string-16"
        ["url"]=>
        string(12) "string-65534"
        ["message"]=>
        string(12) "string-65534"
        ["session"]=>
        string(6) "string"
        ["error_type"]=>
        string(6) "string"
        ["file"]=>
        string(10) "string-255"
        ["line"]=>
        string(3) "int"
      }
      [3]=>
      &array(9) {
        [0]=>
        string(1) "1"
        [1]=>
        int(1210227507)
        [2]=>
        string(9) "127.0.0.1"
        [3]=>
        string(15) "?action=search2"
        [4]=>
        string(30) "8: Undefined variable: dataRow"
        [5]=>
        string(32) "5e197917cbe9f0c56c15f807f60a5737"
        [6]=>
        string(14) "undefined_vars"
        [7]=>
        string(72) "/home/smf/public_html/SVN/7133-0/Sources/Subs-Db-sqlite.php"
        [8]=>
        int(550)
      }
      [4]=>
      &array(1) {
        [0]=>
        string(8) "id_error"
      }
    }
  }
  [1]=>
  array(4) {
    ["file"]=>
    string(64) "/home/smf/public_html/SVN/7133-0/Sources/Errors.php"
    ["line"]=>
    int(246)
    ["function"]=>
    string(9) "log_error"
    ["args"]=>
    array(4) {
      [0]=>
      &string(30) "8: Undefined variable: dataRow"
      [1]=>
      &string(14) "undefined_vars"
      [2]=>
      &string(72) "/home/smf/public_html/SVN/7133-0/Sources/Subs-Db-sqlite.php"
      [3]=>
      &int(550)
    }
  }
  [2]=>
  array(4) {
    ["file"]=>
    string(72) "/home/smf/public_html/SVN/7133-0/Sources/Subs-Db-sqlite.php"
    ["line"]=>
    int(550)
    ["function"]=>
    string(13) "error_handler"
    ["args"]=>
    array(5) {
      [0]=>
      &int(8)
      [1]=>
      &string(27) "Undefined variable: dataRow"
      [2]=>
      &string(72) "/home/smf/public_html/SVN/7133-0/Sources/Subs-Db-sqlite.php"
      [3]=>
      &int(550)
      [4]=>
      &array(22) {
        ["method"]=>
        string(7) "replace"
        ["table"]=>
        string(20) "smf_log_floodcontrol"
        ["columns"]=>
        array(3) {
          ["ip"]=>
          string(9) "string-16"
          ["log_time"]=>
          string(3) "int"
          ["log_type"]=>
          string(6) "string"
        }
        ["data"]=>
        array(1) {
          [0]=>
          array(3) {
            [0]=>
            string(9) "127.0.0.1"
            [1]=>
            int(1210227507)
            [2]=>
            string(6) "search"
          }
        }
        ["keys"]=>
        array(2) {
          [0]=>
          string(2) "ip"
          [1]=>
          string(8) "log_type"
        }
        ["disable_trans"]=>
        bool(false)
        ["connection"]=>
        resource(9) of type (sqlite database)
        ["db_in_transact"]=>
        &bool(false)
        ["db_connection"]=>
        &resource(9) of type (sqlite database)
        ["smcFunc"]=>
        &array(35) {
          ["db_query"]=>
          string(12) "smf_db_query"
          ["db_quote"]=>
          string(12) "smf_db_quote"
          ["db_fetch_assoc"]=>
          string(18) "sqlite_fetch_array"
          ["db_fetch_row"]=>
          string(16) "smf_db_fetch_row"
          ["db_free_result"]=>
          string(18) "smf_db_free_result"
          ["db_insert"]=>
          string(13) "smf_db_insert"
          ["db_insert_id"]=>
          string(16) "smf_db_insert_id"
          ["db_num_rows"]=>
          string(15) "sqlite_num_rows"
          ["db_data_seek"]=>
          string(11) "sqlite_seek"
          ["db_num_fields"]=>
          string(17) "sqlite_num_fields"
          ["db_escape_string"]=>
          string(20) "sqlite_escape_string"
          ["db_unescape_string"]=>
          string(22) "smf_db_unescape_string"
          ["db_server_info"]=>
          string(17) "smf_db_libversion"
          ["db_affected_rows"]=>
          string(20) "smf_db_affected_rows"
          ["db_transaction"]=>
          string(18) "smf_db_transaction"
          ["db_error"]=>
          string(17) "smf_db_last_error"
          ["db_select_db"]=>
          string(0) ""
          ["db_title"]=>
          string(6) "SQLite"
          ["db_sybase"]=>
          bool(true)
          ["db_case_sensitive"]=>
          bool(false)
          ["entity_fix"]=>
          string(11) "�lambda_174"
          ["substr"]=>
          string(11) "�lambda_175"
          ["strlen"]=>
          string(11) "�lambda_176"
          ["strpos"]=>
          string(11) "�lambda_177"
          ["htmlspecialchars"]=>
          string(11) "�lambda_178"
          ["htmltrim"]=>
          string(11) "�lambda_179"
          ["truncate"]=>
          string(11) "�lambda_180"
          ["strtolower"]=>
          string(10) "strtolower"
          ["strtoupper"]=>
          string(10) "strtoupper"
          ["ucfirst"]=>
          string(7) "ucfirst"
          ["ucwords"]=>
          string(7) "ucwords"
          ["db_search_query"]=>
          string(19) "smf_db_search_query"
          ["db_search_support"]=>
          string(21) "smf_db_search_support"
          ["db_create_word_search"]=>
          string(25) "smf_db_create_word_search"
          ["db_support_ignore"]=>
          bool(false)
        }
        ["db_prefix"]=>
        &string(4) "smf_"
        ["priv_trans"]=>
        bool(false)
        ["updateData"]=>
        string(18) "log_time = {int:1}"
        ["where"]=>
        string(56) "ip = SUBSTR({string:0}, 1, 16) AND log_type = {string:2}"
        ["count"]=>
        int(3)
        ["columnName"]=>
        string(8) "log_type"
        ["type"]=>
        string(6) "string"
        ["actualType"]=>
        string(23) "log_type = {string:2}, "
        ["k"]=>
        int(0)
        ["entry"]=>
        array(3) {
          [0]=>
          string(9) "127.0.0.1"
          [1]=>
          int(1210227507)
          [2]=>
          string(6) "search"
        }
        ["insertData"]=>
        string(63) "(SUBSTR({string:ip}, 1, 16), {int:log_time}, {string:log_type})"
        ["indexed_columns"]=>
        array(3) {
          [0]=>
          string(2) "ip"
          [1]=>
          string(8) "log_time"
          [2]=>
          string(8) "log_type"
        }
      }
    }
  }
  [3]=>
  array(4) {
    ["file"]=>
    string(62) "/home/smf/public_html/SVN/7133-0/Sources/Subs.php"
    ["line"]=>
    int(2912)
    ["function"]=>
    string(13) "smf_db_insert"
    ["args"]=>
    array(5) {
      [0]=>
      &string(7) "replace"
      [1]=>
      &string(27) "{db_prefix}log_floodcontrol"
      [2]=>
      &array(3) {
        ["ip"]=>
        string(9) "string-16"
        ["log_time"]=>
        string(3) "int"
        ["log_type"]=>
        string(6) "string"
      }
      [3]=>
      &array(3) {
        [0]=>
        string(9) "127.0.0.1"
        [1]=>
        int(1210227507)
        [2]=>
        string(6) "search"
      }
      [4]=>
      &array(2) {
        [0]=>
        string(2) "ip"
        [1]=>
        string(8) "log_type"
      }
    }
  }
  [4]=>
  array(4) {
    ["file"]=>
    string(64) "/home/smf/public_html/SVN/7133-0/Sources/Search.php"
    ["line"]=>
    int(926)
    ["function"]=>
    string(14) "spamProtection"
    ["args"]=>
    array(1) {
      [0]=>
      &string(6) "search"
    }
  }
  [5]=>
  array(2) {
    ["function"]=>
    string(12) "PlushSearch2"
    ["args"]=>
    array(0) {
    }
  }
  [6]=>
  array(4) {
    ["file"]=>
    string(55) "/home/smf/public_html/SVN/7133-0/index.php"
    ["line"]=>
    int(151)
    ["function"]=>
    string(14) "call_user_func"
    ["args"]=>
    array(1) {
      [0]=>
      &string(12) "PlushSearch2"
    }
  }
}


Array
(
    [0] => id_member
    [1] => log_time
    [2] => ip
    [3] => url
    [4] => message
    [5] => session
    [6] => error_type
    [7] => file
    [8] => line
)
1



Notice:  Undefined variable: dataRow in /home/smf/public_html/SVN/7133-0/Sources/Subs-Db-sqlite.php on line 550

1

1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
#98
The test zone / test
May 07, 2008, 03:58 PM
My text1 My Text 2
#99
Array
(
    [0] => Array
        (
            [modifys] => Array
                (
                    [0] => Array
                        (
                            [change] => modification
                            [code] => install.xml
                            [dest] => $sourcedir
                            [t_id] => 1
                            [s_id] => 1
                        )

                )

            [t_id] => 1
            [s_id] => 1
            [s_id_updated] => 2
            [num_fields] => 1
            [selected] => install
            [work_for] => 2.0 Beta 3 Public, 2.0 Beta 4, 2.0-2.0.99
            [edits] => Array
                (
                    [change] => install
                    [workfor] => 2.0 Beta 3 Public, 2.0 Beta 4, 2.0-2.0.99
                    [edit] => Array
                        (
                            [1] => Array
                                (
                                    [change] => modification
                                    [code] => install.xml
                                    [dest] => $sourcedir
                                )

                        )

                )

        )

    [1] => Array
        (
            [modifys] => Array
                (
                    [0] => Array
                        (
                            [code] => 23423
                            [t_id] => 2
                            [s_id] => 1
                        )

                )

            [t_id] => 2
            [s_id] => 1
            [s_id_updated] => 2
            [num_fields] => 1
            [selected] => install
            [work_for] => 2342342
            [edits] => Array
                (
                    [change] => install
                    [workfor] => 2342342
                    [edit] => Array
                        (
                            [0] => Array
                                (
                                    [change] => modification
                                )

                            [1] => Array
                                (
                                    [code] => 23423
                                )

                            [2] => Array
                                (
                                    [dest] => $sourcedir
                                )

                        )

                )

        )

)
#100
<?php
$block_size = 200;

require_once(dirname(__FILE__) . '/SSI.php');
error_reporting(E_ALL);
@mysql_select_db($db_name, $db_connection);

$request = db_query("
   SELECT MAX(ID_MSG)
   FROM {$db_prefix}messages
   WHERE 1
   LIMIT 1", __FILE__, __LINE__);
list($total_messages) = mysql_fetch_row($request);
mysql_free_result($request);

while ($total_messages > $block_size)
{
   $request = db_query("
      SELECT t.ID_TOPIC, m.subject
      FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS m)
         LEFT JOIN {$db_prefix}log_search_subjects AS lss ON (lss.ID_TOPIC = t.ID_TOPIC)
      WHERE m.ID_MSG = t.ID_FIRST_MSG
         AND lss.ID_TOPIC IS NULL", __FILE__, __LINE__);
      
   $insertRows = array();
   while ($row = mysql_fetch_assoc($request))
   {
      foreach (text2words($row['subject']) as $word)
         $insertRows[] = "'$word', $row[ID_TOPIC]";
      if (count($insertRows) > 500)
      {
         db_query("
            INSERT IGNORE INTO {$db_prefix}log_search_subjects
               (word, ID_TOPIC)
            VALUES (" . implode('),
            (', $insertRows) . ")", __FILE__, __LINE__);
            $insertRows = array();
      }
   }
   mysql_free_result($request);

   if (!empty($insertRows))
      db_query("
         INSERT IGNORE INTO {$db_prefix}log_search_subjects
            (word, ID_TOPIC)
         VALUES (" . implode('),
            (', $insertRows) . ")", __FILE__, __LINE__);
}

echo "\n Completed!\n\n";
?>