pastebin

Paste Search Dynamic
Recent pastes
DB
  1. <?php
  2.    // in chroot use mysql host IP 127.0.0.1
  3.    // if you want to use localhost put /etc/resolve.conf /etc/hosts file
  4.    // to /webroot/etc directory
  5.    $link = mysql_connect("127.0.0.1", "root", "PASSWORD");
  6.    mysql_select_db("mysql");
  7.  
  8.    $query = "show tables";
  9.    $result = mysql_query($query);
  10.    print "<h1>MySQL DB Test executed from ". $_SERVER['SCRIPT_NAME']. "</h1>n";
  11.    print "Script name: ". $_SERVER['SCRIPT_FILENAME'] ."<hr>n";
  12.    while ($line = mysql_fetch_array($result))
  13.    {
  14.       print "$line[0]<br>n";
  15.    }
  16.     mysql_close($link);
  17.     // try to open real /etc/passwd file
  18.    print "<h1>Trying to open /etc/passwd file</h1>";
  19.    try2OpenFile("/etc/passwd");
  20.    // try to open real /etc/hosts file
  21.    print "<h1>Trying to open /etc/hosts file</h1>";
  22.    try2OpenFile("/etc/hosts");
  23.  
  24. function try2OpenFile($file){
  25.    $f = @fopen($file, "r");
  26.    if ( !$f ) { print "Error - Cannot open file <b>".$file."</b>"; return;}
  27.    echo "<hr>File: $file<hr><pre>";
  28.    while ( $line = fgets($f, 1000) ) {
  29.    print $line;
  30.    }
  31.    echo "</pre>";
  32. }
  33. ?>
Parsed in 0.079 seconds