Wap Gallery script...!!!..[request]
Started on the old forum in August 2009 · view the original in the archive · old links redirect here
<?php
if(!defined('DRK'))die('Hacking attempt...');
$uid=IdFromSes($ses);
if($mode=="viewcat")
{
$catid=get_var("category");
$page=get_var("page");
if(empty($page))$page=1;
$catname=fetch_array("name",gallery,"type='C' AND id=$catid");
$pics=num_rows("id",gallery,"type='I' AND catid=$catid");
$query=query("*",gallery,"type='I' AND catid=$catid ORDER BY LOWER(name) LIMIT ".($page-1)*$gallerypicsperpage.",$gallerypicsperpage");
if(mysql_num_rows($query)>0){
while($row=mysql_fetch_array($query)){
$color=fetch_array("path",gallery,"type='C' AND id=$catid");
$gallerylist.="<img src=\"/phpThumb/phpThumb.php?src=$row[path]&f=gif&w=96\" alt=\"$row[name]\" style=\"border:2px inset $color;\"/>
<a href=\"$row[path]\" style=\"color:$color\">$row[name]</a>
\n";
}
}
else $gallerylist="<img src=\"./images/point.gif\" alt=\"[!]\"/>no pictures at the moment!!";
if($page>1)$controls.="<a href=\"".$action."gallery".$mod."viewcat&page=".($page-1)."&category=$catid".$session."\">prev</a>";
if($page>1&&$pics>$page*$gallerypicsperpage)$controls.="\n | ";
if($pics>$page*$gallerypicsperpage)$controls.="<a href=\"".$action."gallery".$mod."viewcat&page=".($page+1)."&category=$catid".$session."\">next</a>";
if($page>1||$pics>$page*$gallerypicsperpage)$controls.="
";
$what=Array("sitename","username","catname","pics","gallerylist","controls","page","category");
$with=Array($sitename,users_table("username",$uid),$catname,$pics,$gallerylist,$controls,$page,$catid);
Template($what,$with,"gallerypics");
exit;
}
/////UPLOAD GALLERY PICTURE/////
else if($mode=="upload")
{
$time=time();
$page=get_var("page");
$category=get_var("category");
$upload=get_var("upload");
$nick=UserFromId($uid);
$size_bytes=1048576;
$size=round($size_bytes/1048576,1);
$content_type=array("image/gif","image/jpeg","image/pjpeg","image/bmp");
$ext=strtolower(strrchr($_FILES['filetoupload'][name],'.'));
$file_type=$_FILES['filetoupload']['type'];
$file_name=$_FILES['filetoupload']['name'];
$file_size=$_FILES['filetoupload']['size'];
$file_tmp=$_FILES['filetoupload']['tmp_name'];
if($upload==1){
if(!is_uploaded_file($_FILES['filetoupload']['tmp_name']))$msg="<img src=\"./images/error.gif\" alt=\"[x]\"/>no file selected!!";
else if(!in_array($file_type,$content_type))$msg="<img src=\"./images/error.gif\" alt=\"[x]\"/>invalid file type!!";
else if($file_size>$size_bytes)$msg="<img src=\"./images/error.gif\" alt=\"[x]\"/>exceeded File size limit!! maximum $size mb.";
else if(num_rows("id",gallery,"uid=$uid"))$msg="<img src=\"./images/error.gif\" alt=\"[x]\"/>you must remove your current picture to proceed!!";
else if($file_size){
insert(gallery,"NULL,'I','$nick','/gallery/".strtolower($nick).$ext."','$category','$uid','$time'");
update(userprofiles,"photo='/gallery/".strtolower($nick).$ext."'","uid=$uid");
move_uploaded_file($file_tmp,"./gallery/".strtolower($nick).$ext);
$msg="<img src=\"./images/ok.gif\" alt=\"[ok]\"/>successfully uploaded picture!!";
}
else $msg="<img src=\"./images/error.gif\" alt=\"[x]\"/>unknown error!!";
}
$what=Array("sitename","username","size","msg","page","category");
$with=Array($sitename,users_table("username",$uid),$size,$msg,$page,$category);
Template($what,$with,"galleryupload");
exit;
}
/////GALLERY/////
$query=query("*",gallery,"type='C' ORDER BY id,name");
if(mysql_num_rows($query)>0){
while($row=mysql_fetch_array($query)){
$pics=num_rows("id",gallery,"type='I' AND catid=$row[id]");
$categories.="<a href=\"".$action."gallery".$mod."viewcat&category=$row[id]".$session."\" style=\"color:$row[path]\">$row[name] ($pics)</a>
\n";
}
}
else $categories="<img src=\"./images/point.gif\" alt=\"[!]\"/>no categories at the moment!!";
$pics=num_rows("id",gallery,"type='I'");
$query=query("*",gallery,"type='I' ORDER BY RAND() LIMIT 4");
if(mysql_num_rows($query)>0){
while($row=mysql_fetch_array($query)){
$user=UserFromId($row['uid']);
$random.="<img src=\"/phpThumb/phpThumb.php?src=$row[path]&h=50&f=gif\" alt=\"$user\"/>\n";
}
}
?>
External image (may be gone) http://www.3webhost.co.cc Free WebHosting :D 8)😌😊