<?php
$localhost = "localhost"; // host name
$root = "root"; // host username
$pass = ""; // host password
$link = mysql_connect("$localhost", "$root", "$pass");
if(!$link)
{ echo "No SQL" .mysql_error();
}
$db= "100images";
if(!isset($_GET['type'])) $_GET['type'] = '';
switch($_GET['type']) {
case '';
$select_db = mysql_select_db($db);
if (!$select_db)
{
echo " No DB " .mysql_error();
}
$sql = "SELECT `img` FROM `images`";
$results = mysql_query($sql);
while ($row = mysql_fetch_assoc($results))
// list start
{
echo "<a href =\"index.php?type=wall&".$row['img']."\"><img src=\"dots/down.gif\" border =\"0\" />
";
}
break;
case 'wall';
function selfURL()
{
$s = empty($_SERVER["HTTPS"]) ? ''
: ($_SERVER["HTTPS"] == "on") ? "s"
: "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? ""
: (":".$_SERVER["SERVER_PORT"]);
return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];
}
function strleft($s1, $s2)
{
return substr($s1, 0, strpos($s1, $s2));
}
//print(selfURL());
$self = selfURL();
$space='images/';
$string = preg_replace("/index\.php\?type=wall&/", $space, $self);
echo "<img src =\"$string\">";
}
?>
look into attach.
you may need to edit this line $string = preg_replace("/index.php?type=wall&/", $space, $self); to see the picture.