Gallery Upload Script..

Started on the old forum in May 2007 · view the original in the archive · old links redirect here

18 replies · 1,879 views · started 19 years ago · 1 min read

5 participants
thanatos Senior · 261 posts #1

i made some revisions on Tommie. scripts and wizards script..

upload.php

<?php
include("config.php");
include("core.php");
//session_start();
header("Content-type: text/html; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"\"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";

echo "<head><title>$title</title>";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/default.css\" />";
echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />
<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>
<meta name=\"description\" content=\"Natasu\"> 
<meta name=\"keywords\" content=\"free, natasu, community, forums, chat, wap, communicate\"></head>";
echo "<body>";

$bcon = connectdb();
if (!$bcon)
{
    echo "<img src=\"images/exit.gif\" alt=\"*\"/>
";
    echo "ERROR! cannot connect to database

";
    echo "This error happens usually when backing up the database, please be patient, The site will be up any minute

";
    echo "you can temperoray be in this site <a href=\"$siteurl\">$title</a> while $title is offline
";
    echo "[b]THANK YOU VERY MUCH[/b]";
    echo "</p>";
    echo "</html>";
    echo "</body>";
    exit();
}
$brws = explode(" ",$_SERVER[HTTP_USER_AGENT] );
$ubr = $brws[0];
$uip = getip();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];

$uid = getuid_sid($sid);

cleardata();

if(isipbanned($uip,$ubr))
    {
      if(!isshield(getuid_sid($sid)))
      {
      echo "<p align=\"center\">";
      echo "<img src=\"images/notok.gif\" alt=\"x\"/>
";
      echo "This IP address is blocked
";
      echo "
";
      echo "How ever we grant a shield against IP-Ban for our great users, you can try to see if you are shielded by trying to log-in, if you kept coming to this page that means you are not shielded, so come back when the ip-ban period is over

";
      $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
      //echo mysql_error();
      $remain =  $banto[0] - time();
      $rmsg = gettimemsg($remain);
      echo " IP: $rmsg

";
      
      echo "</p>";
      echo "

";
  echo "<form align=\"left\" action=\"login.php\" method=\"post\" ENCTYPE=\"multipart/form-data\">";

  echo "UserID: <input name=\"loguid\" format=\"*x\" maxlength=\"30\"/>
";
  echo "Password: <input type=\"password\" name=\"logpwd\"  maxlength=\"30\"/>
";
  echo "<postfield name=\"loguid\" value=\"$(loguid)\"/>";
  echo "<postfield name=\"logpwd\" value=\"$(logpwd)\"/>";
  echo "<input type=\"submit\" value=\"Login!\"/>
";
  echo "</form>";
  echo "</p>";
      echo "</body>";
      echo "</html>";
      exit();
      }
   }
if(($action != "") && ($action!="terms"))
{
    $uid = getuid_sid($sid);
    if((islogged($sid)==false)||($uid==0))
    {
      
      echo "You are not logged in
";
      echo "Or Your session has been expired

";
      echo "<a href=\"index.php\">Login</a>

";
      echo "</p>";
      echo "</body>";
      echo "</html>";
      exit();
    }
    
    
    
}
//echo isbanned($uid);
if(isbanned($uid))
    {
      echo "<p align=\"center\">";
      echo "<img src=\"images/notok.gif\" alt=\"x\"/>
";
      echo "You are [b]Banned[/b]
";
      $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1'"));
      $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
      
      $remain = $banto[0]- time();
      $rmsg = gettimemsg($remain);
      echo "Time to finish your penalty: $rmsg

";
      echo "Ban Reason: $banres[0]";
      //echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</body>";
      echo "</html>";
      exit();
    }

$res = mysql_query("UPDATE ibwf_users SET browserm='".$ubr."', ipadd='".$uip."' WHERE id='".getuid_sid($sid)."'");

if($action=="uploader")
{
addvisitor();
addonline(getuid_sid($sid),"User Pic Uploader","");
$nick = getnick_sid($sid);
$uid = getuid_sid($sid);
$nopl = mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE id='".$uid."'"));
  if($nopl[0]=='M')
  {
    $usex = "M";
  }else if($nopl[0]=='F'){
    $usex = "F";
  }else{
    $usex = "M";
  }
echo "Welcome $nick
";
//get file name
if ($upload="upload"&&$file_name){
if (!eregi("\.(jpeg|jpg)$",$file_name)){
print "[b]Unsuported File extention!!![/b]";
}else{
$file_name = preg_replace(
             '/[^a-zA-Z0-9\.\$\%\'\`\-\@\{\}\~\!\#\(\)\&\_\^]/'
             ,'',str_replace(array(' ','%20'),array('_','_'),$file_name));
if(strlen($file_name)>53){ print "[b]File Name to long!!![/b]";
}else{
if (empty($file)) {
print "[b]No input file specified!!![/b]";
}else{
if (file_exists($file_name))
            {
            echo "Pic already exists";
            echo "
<a href=\"upload.php\">Upload xhtml</a>
";
                  echo "
<a href=\"index.php\">Uploads</a>
";
                  echo "[b]Natasu ©[/b]
";
                  print "</p></body></html>";
            exit();
            }

$pics = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM gallery where uid='".$uid."'"));
$cpic = $pics[0]+1;
$rev = strrev ($file_name);
$exp = explode (".", $rev);
$true = strrev ($exp[0]);
$trueext = strtolower ($true);
$picn = "$nick$cpic.$trueext";
copy("$file", "gallery/$file_name") or
die("Couldn't copy file.");
$adds = mysql_query("INSERT INTO gallery SET uid='".$uid."', file='$file_name', sex='".$usex."'");
    if ($adds) {

          echo "added pic $file_name
";

         } else {

              echo "Please try again
";
           }

echo "file has been successfully uploaded";
}
}
}
}
?>
<?php
echo "<form align=\"left\" action=\"upload.php?action=uploader&sid=$sid\" method=\"post\" ENCTYPE=\"multipart/form-data\">
File: 
<input type=\"file\" name=\"file\" size=\"30\"/>

<input type=\"submit\" value=\"Upload\"/>

<a href=\"pics.php?action=gallery&sid=$sid\">Back to Gallery</a>

<a href=\"index.php?action=main&sid=$sid\">Home</a>

<font color=\"red\">Natasu ©</font>";
}
echo "</form>
</body>
</html>";
?>

ch777 the folder gallery..

thanatos Senior · 261 posts #2

pics.php

<?php
include("config.php");
include("core.php");
connectdb();
header("Content-type: text/vnd.wap.wml"); 
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">"; 
echo "<wml>"; 
$bcon = connectdb();
if (!$bcon)
{
    echo "<card id=\"main\" title=\"Natasu (ERROR!)\">";
    echo "<p align=\"center\">";
    echo "<img src=\"images/exit.gif\" alt=\"*\"/>
";
    echo "ERROR! cannot connect to database

";
    echo "This error happens usually when backing up the database, please be patient, The site will be up any minute

";
    echo "you can temperoray be in this site <a href=\"http://chatheaven.wen.ru\">$site_name</a> while $site_name is offline
";
    echo "[b]THANK YOU VERY MUCH[/b]";
    echo "</p>";
    echo "</card>";
    echo "</wml>";
    exit();
}
$brws = explode(" ",$_SERVER[HTTP_USER_AGENT] );
$ubr = $brws[0];
$uip = getip();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];

$uid = getuid_sid($sid);

cleardata();

if(isipbanned($uip,$ubr))
    {
      if(!isshield(getuid_sid($sid)))
      {
        echo "<card id=\"main\" title=\"Natasu\">";
      echo "<p align=\"center\">";
      echo "<img src=\"images/notok.gif\" alt=\"x\"/>
";
      echo "This IP address is blocked
";
      echo "
";
      echo "How ever we grant a shield against IP-Ban for our great users, you can try to see if you are shielded by trying to log-in, if you kept coming to this page that means you are not shielded, so come back when the ip-ban period is over

";
      $banto = mysql_fetch_array(mysql_query("SELECT  timeto FROM ibwf_penalties WHERE  penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
      //echo mysql_error();
      $remain =  $banto[0] - time();
      $rmsg = gettimemsg($remain);
      echo " IP: $rmsg

";
      
      echo "</p>";
      echo "

";
  echo "UserID: <input name=\"loguid\" format=\"*x\" maxlength=\"30\"/>
";
  echo "Password: <input type=\"password\" name=\"logpwd\"  maxlength=\"30\"/>
";
  echo "<anchor>LOGIN<go href=\"login.php\" method=\"get\">";
  echo "<postfield name=\"loguid\" value=\"$(loguid)\"/>";
  echo "<postfield name=\"logpwd\" value=\"$(logpwd)\"/>";
  echo "</go></anchor>";
  echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
      }
   }
if(($action != "") && ($action!="terms"))
{
    $uid = getuid_sid($sid);
    if((islogged($sid)==false)||($uid==0))
    {
        echo "<card id=\"main\" title=\"Natasu\">";
      echo "<p align=\"center\">";
      echo "You are not logged in
";
      echo "Or Your session has been expired

";
      echo "<a href=\"index.php\">Login</a>

";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
    
    
    
}
//echo isbanned($uid);
if(isbanned($uid))
    {
        echo "<card id=\"main\" title=\"Natasu\">";
      echo "<p align=\"center\">";
      echo "<img src=\"images/notok.gif\" alt=\"x\"/>
";
      echo "You are [b]Banned[/b]
";
      $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1'"));
      $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
      
      $remain = $banto[0]- time();
      $rmsg = gettimemsg($remain);
      echo "Time to finish your penalty: $rmsg

";
      echo "Ban Reason: $banres[0]";
      //echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }

$res = mysql_query("UPDATE ibwf_users SET browserm='".$ubr."', ipadd='".$uip."' WHERE id='".getuid_sid($sid)."'");

?>
<?php
if($action=="gallery")
{
  addonline(getuid_sid($sid),"Viewing Gallery","");
     echo "<card id=\"main\" title=\"Natasu\">";
  echo "<p align=\"center\">";

$males = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM gallery WHERE sex='M'"));
echo "<a href=\"pics.php?action=male&sid=$sid\">Male Gallery($males[0])</a>
";
echo "
";
$females = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM gallery WHERE sex='F'"));
echo "<a href=\"pics.php?action=female&sid=$sid\">Female Gallery($females[0])</a>
";
echo "
";
echo "<a href=\"upload.php?action=uploader&sid=$sid\">Upload Photo</a>
";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo "</card>";
  

}else if($action=="female")
{
  addonline(getuid_sid($sid),"Viewing Female Gallery","");
     echo "<card id=\"main\" title=\"Natasu\">";
$uid = getuid_sid($sid);

    //////ALL gallery SCRIPT <<

    if($page=="" || $page<=0)$page=1;
    if($who!="")
    {
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM gallery WHERE sex='F'"));
    }else{
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM gallery WHERE sex='F'"));
    }

$num_items = $noi[0]; //changable
    $items_per_page= 5;
    $num_pages = ceil($num_items/$items_per_page);
    if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;

$sql = "SELECT DISTINCT uid FROM gallery WHERE sex='F' ORDER BY uid ASC LIMIT $limit_start, $items_per_page";
echo "

[size="1"]";
    $items = mysql_query($sql);
    echo mysql_error();
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
{
$who = $item[0];
$user=getnick_uid($who);
$countpics = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM gallery WHERE uid='".$who."'"));
        $lnk = "<a href=\"pics.php?action=viewuser&who=$who&sid=$sid\">$user($countpics[0])</a>
";
echo "$lnk";

    }
    }else{
echo "female gallery is empty";
}
    echo "[/size]</p>";
echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"pics.php?action=$action&page=$ppage&sid=$sid\">«PREV</a> ";
    }

if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"pics.php?action=$action&page=$npage&sid=$sid\">Next»</a>";
    }
    echo "
$page/$num_pages
";
    if($num_pages>2)
    {
      $rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
        $rets .= "<anchor>[GO]";
        $rets .= "<go href=\"pics.php\" method=\"get\">";
        $rets .= "<postfield name=\"action\" value=\"$action\"/>";
        $rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
        $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
        $rets .= "</go></anchor>";

        echo $rets;
    }

echo "<a href=\"pics.php?action=gallery&sid=$sid\">User Gallery</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
    echo "</p>";
echo "</card>";

}else if($action=="male")
{
  addonline(getuid_sid($sid),"Viewing Male Gallery","");
     echo "<card id=\"main\" title=\"Natasu\">";
$uid = getuid_sid($sid);

    //////ALL gallery SCRIPT <<

    if($page=="" || $page<=0)$page=1;
    if($who!="")
    {
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM gallery WHERE sex='M'"));
    }else{
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM gallery WHERE sex='M'"));
    }

$num_items = $noi[0]; //changable
    $items_per_page= 5;
    $num_pages = ceil($num_items/$items_per_page);
    if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;

$sql = "SELECT DISTINCT uid FROM gallery WHERE sex='M' ORDER BY uid ASC LIMIT $limit_start, $items_per_page";
echo "

[size="1"]";
    $items = mysql_query($sql);
    echo mysql_error();
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
{
$who = $item[0];
$user=getnick_uid($who);
$countpics = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM gallery WHERE uid='".$who."'"));
        $lnk = "<a href=\"pics.php?action=viewuser&who=$who&sid=$sid\">$user($countpics[0])</a>
";
echo "$lnk";

    }
    }else{
echo "male gallery is empty";
}
    echo "[/size]</p>";
echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"pics.php?action=$action&page=$ppage&sid=$sid\">«PREV</a> ";
    }

if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"pics.php?action=$action&page=$npage&sid=$sid\">Next»</a>";
    }
    echo "
$page/$num_pages
";
    if($num_pages>2)
    {
      $rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
        $rets .= "<anchor>[GO]";
        $rets .= "<go href=\"pics.php\" method=\"get\">";
        $rets .= "<postfield name=\"action\" value=\"$action\"/>";
        $rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
        $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
        $rets .= "</go></anchor>";

        echo $rets;
    }

echo "<a href=\"pics.php?action=gallery&sid=$sid\">User Gallery</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
    echo "</p>";
echo "</card>";

}
else if($action=="viewuser")
{
      $who = $_GET["who"];
    addonline(getuid_sid($sid),"Viewing User Photos","");
         echo "<card id=\"main\" title=\"Natasu\">";
    $uid = getuid_sid($sid);
//////ALL gallery SCRIPT <<

    if($page=="" || $page<=0)$page=1;
    if($who!="")
    {
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM gallery WHERE uid='".$who."'"));
    }else{
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM gallery"));
    }
    $num_items = $noi[0]; //changable
    $items_per_page= 1;
    $num_pages = ceil($num_items/$items_per_page);
    if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;

if($who!="")
    {
        $sql = "SELECT id, sex, file FROM gallery WHERE uid='".$who."' ORDER BY id DESC LIMIT $limit_start, $items_per_page";
        }else{
$sql = "SELECT id, sex, file, uid FROM gallery  ORDER BY id DESC LIMIT $limit_start, $items_per_page";
        }
echo "<p align=\"center\">";
    $items = mysql_query($sql);
    echo mysql_error();
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {
      $id = $item[0];
    $ext = getext($item[2]);
        $ime = getextimg($ext);
 $lnk = "<img src=\"image.php?id=$item[0]\" alt=\"pic\"/>
";

$me = getuid_sid($sid);
if($who=="$me")
{
$use = "<a href=\"genproc.php?action=useavtr&sid=$sid&vid=$item[0]\">Use as Avatar</a> | ";
}else{
$use = "";
}
if(candelgal($uid, $item[0]))
      {
        $delnk = "<a href=\"genproc.php?action=delpic&sid=$sid&vid=$item[0]\">Remove Photo</a>";
      }else{
        $delnk = "";
      }
echo "$lnk<a href=\"gallery/$item[2]\">Download Photo</a>
 $use$delnk
";
      

    }
    }
 echo "</p>";
echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"pics.php?action=$action&page=$ppage&sid=$sid&who=$who\">«PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"pics.php?action=$action&page=$npage&sid=$sid&who=$who\">Next»</a>";
    }
    echo "
$page/$num_pages
";
    if($num_pages>2)
    {
       $rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
        $rets .= "<anchor>[GO]";
        $rets .= "<go href=\"pics.php\" method=\"get\">";
        $rets .= "<postfield name=\"action\" value=\"$action\"/>";
        $rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
        $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
        $rets .= "</go></anchor>";

        echo $rets;
    }
echo "
<a href=\"pics.php?action=gallery&sid=$sid\">User Gallery</a>
";
  echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>";

    echo "</p>";
     echo "</card>";
  

}

?>

</wml>
thanatos Senior · 261 posts #3

genproc.php

//////////////////////////////////////////DELPIC
else if($action=="delpic")
{
    $vid = $_GET["vid"];
  addonline(getuid_sid($sid),"Deleting Gallery Pic","");
  echo "<card id=\"main\" title=\"Natasu\">";
  echo "<p align=\"center\">";
  $itemowner = mysql_fetch_array(mysql_query("SELECT uid, file FROM gallery WHERE id='".$vid."'"));
  if(ismod(getuid_sid($sid))||getuid_sid($sid)==$itemowner[0])
  {
    $res = mysql_query("DELETE FROM gallery WHERE id='".$vid."'");
  if($res)
        {
        $myFile = "gallery/$itemowner[1]";
        unlink($myFile);

        echo "<img src=\"../images/ok.gif\" alt=\"o\"/>Pic Deleted From Gallery
";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"x\"/>Database Error!
";
        }
  }else{
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>You can't delete this item";
  }

  echo "

";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p></card>";
}

/////////////////////////////////////////AVATAR
else if($action=="useavtr")
{
    $vid = $_GET["vid"];
  addonline(getuid_sid($sid),"Updating Avatar","");
echo "<card id=\"main\" title=\"Natasu\">";
  echo "<p align=\"center\">";
$getimg = mysql_fetch_array(mysql_query("SELECT file FROM gallery WHERE id='".$vid."'"));

$avatar = $getimg[0];
  $uid = getuid_sid($sid);

$res = mysql_query("Update ibwf_users SET avatar='gallery/".$avatar."' WHERE id='".$uid."'");
    if($res)
        {
            echo "<img src=\"images/ok.gif\" alt=\"o\"/>Avatar was successfully updated
";
        }else{
          echo "<img src=\"images/notok.gif\" alt=\"x\"/>Database Error!
";
        }
    echo "
";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
echo "</card>";

}
thanatos Senior · 261 posts #4

core.php

////////////////////////GALLERY
function candelgal($uid, $item)
{
  $candoit = mysql_fetch_array(mysql_query("SELECT uid FROM gallery WHERE id='".$item."'"));
  if($uid==$candoit[0]||ismod($uid))
  {
    return true;
  }
  return false;
}
alesh Lead · 604 posts #5

ARGH this one is even harder to installlllll

help me with the previous 1

eeeeerrr....

thanatos Senior · 261 posts #6

image.php

<?php
include("config.php");
include("core.php");
connectdb();
$pic = mysql_fetch_array(mysql_query("SELECT * FROM gallery WHERE id ='".$id."'"));
// The file
$filename = "gallery/$pic[2]";

// Set a maximum height and width
$width = 75;
$height = 75;

// Content type
header('Content-type: image/jpeg');

// Get new dimensions
list($width_orig, $height_orig) = getimagesize($filename);

$ratio_orig = $width_orig/$height_orig;

if ($width/$height > $ratio_orig) {
   $width = $height*$ratio_orig;
} else {
   $height = $width/$ratio_orig;
}

// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);

// Output
imagejpeg($image_p, null, 100);
?>
XXX #7

lol...cant u zip this and upload it with an instructions file for php begiiners?

a13x #8

thanatos, can u ziped and atach that gallery here plss?

Regz #10

How tO upload this gallery ? where this all codes shud be copied i mean wht shud be the names of files where this codes are to be copied pls explain in detail thnx

a13x #11

man the name of files are given, but u must just to copy in that files , thanatos can u ziped here?

Regz #12

man the name of files are given, but u must just to copy in that files , thanatos can u ziped here?

Where are the names of files given i dont see which is index.php , pics.php ,upload.phph only image.php is named wht abt oders pls post the script in zip file wid instructions how to install it thnx

Guest #14

wizard,tommie/thandos u should complete this topic by making a .rar file.thanks

thanatos Senior · 261 posts #18

SQL

--
-- Table structure for table `gallery`
--

CREATE TABLE `gallery` (
  `id` int(100) NOT NULL auto_increment,
  `uid` varchar(100) NOT NULL default '',
  `file` varchar(250) NOT NULL default '',
  `sex` char(1) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;

i edited my post.. no need to explain this further..

alesh Lead · 604 posts #19

thnx thanatos ... this 1s better.... but is there 1 tht is willin 2 share gallery with comments... votes... etc... pls?

eeeeerrr....

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close