I have a site that is for stock photography.
This section of the code calls images to display on the main page, based on several variables (new images, featured images, most downloaded, highest rated, etc...) the problem is there are some nude images on the site, and I would prefer that they not be displayed on the main page. I have created a separate category for the nude images, but I can't figure out how to modify the code so that it gets all other images OTHER THAN the nude category.
here is the code:
Code: (php) <?
if(isset($component_id))
{
$stitle=array();
$sauthor=array();
$slink=array();
$simage=array();
$sql="select * from components where id=".(int)$component_id;
$rs->open($sql);
if(!$rs->eof)
{
if(eregi("photo",$rs->row["content"]))
{
$sql="select a.id,a.id_parent,b.id_parent,b.title,b.folder,b.author from structure a, photos b where a.id=b.id_parent and b.published=1";
}
if($rs->row["category"]!=0)
{
$sql.=" and a.id_parent=".$rs->row["category"];
}
if($rs->row["user"]!="")
{
$sql.=" and b.author='".$rs->row["user"]."'";
}
if($rs->row["types"]=="featured")
{
$sql.=" and b.featured=1";
}
if($rs->row["types"]=="free")
{
$sql.=" and b.free=1";
}
if($rs->row["types"]=="free")
{
$sql.=" and b.free=1";
}
if($rs->row["types"]=="new")
{
$sql.=" order by b.data desc";
}
elseif($rs->row["types"]=="popular")
{
$sql.=" order by b.viewed desc";
}
elseif($rs->row["types"]=="downloaded")
{
$sql.=" order by b.downloaded desc";
}
else
{
$sql.=" order by rand()";
}
$sql.=" limit ".$rs->row["quantity"];
$ds->open($sql);
while(!$ds->eof)
{
$stitle[]=$ds->row["title"];
$sauthor[]=$ds->row["author"];
if(eregi("news",$rs->row["content"]))
{
$slink[]=site_root."/news/".$ds->row["id"]."/";
}
elseif(eregi("blog",$rs->row["content"]))
{
$slink[]=site_root."/post/".user_url($ds->row["user"])."/".$ds->row["id"].".html";
}
else
{
$slink[]=surl.item_url($ds->row["id"]);
}
if(eregi("photo",$rs->row["content"]) or eregi("vector",$rs->row["content"]))
{
$ttt=1;
if(eregi("2",$rs->row["content"])){$ttt=2;}
$simage[]=site_root."/content/".$ds->row["folder"]."/thumb".$ttt.".jpg";
}
elseif(eregi("video",$rs->row["content"]) or eregi("audio",$rs->row["content"]))
{
$simage[]=$ds->row["photo"];
}
else
{
$simage[]="";
}
$ds->movenext();
}
$box=file_get_contents($DOCUMENT_ROOT."/".$site_template_url."box_home.tpl");
$component_body.="<table border='0' cellpadding='0' cellspacing='0'>";
$n=0;
for($i=0;$i<$rs->row["arows"];$i++)
{
$component_body.="<tr valign='top'>";
for($j=0;$j<$rs->row["acells"];$j++)
{
if($n<count($stitle) and $n<count($slink) and $n<count($simage))
{
$boxcontent=$box;
$boxcontent=eregi_replace("{TITLE}",$stitle[$n],$boxcontent);
$lightbox="";
if($rs->row["content"]=="photo1")
{
if(file_exists($_SERVER["DOCUMENT_ROOT"].eregi_replace("thumb1","thumb2",$simage[$n])) and $rs->row["slideshow"]!=1)
{
$size = getimagesize($_SERVER["DOCUMENT_ROOT"].eregi_replace("thumb1","thumb2",$simage[$n]));
$lightbox=" onMouseover="lightboxon('".eregi_replace("thumb1","thumb2",$simage[$n])."',".$size[0].",".$size[1].",event,'','".addslashes($stitle[$n])."','".word_lang("author").": ".addslashes($sauthor[$n])."');" onMouseout="lightboxoff();" onMousemove="lightboxmove(".$size[0].",".$size[1].",event)"";
}
}
if(!$site_lightbox_photo){$lightbox="";}
$boxcontent=eregi_replace("{LIGHTBOX}",$lightbox,$boxcontent);
$boxcontent=eregi_replace("{URL}",$slink[$n],$boxcontent);
$boxcontent=eregi_replace("{IMAGE}",$simage[$n],$boxcontent);
$boxcontent=eregi_replace("{LINKNAME}","link_".strval($component_id)."_".strval($i)."_".strval($j),$boxcontent);
$boxcontent=eregi_replace("{IMGNAME}","img_".strval($component_id)."_".strval($i)."_".strval($j),$boxcontent);
$component_body.="<td>".$boxcontent."</td>";
}
$n++;
}
$component_body.="</tr>";
}
$component_body.="</table>";
if($rs->row["slideshow"]==1 and count($stitle)>$rs->row["acells"]*$rs->row["arows"])
{
$component_body.="<script language="javascript">simage".$component_id."=new Array();stitle".$component_id."=new Array();slink".$component_id."=new Array();";
for($i=0;$i<count($stitle);$i++)
{
$component_body.="simage".$component_id."[".$i."]=new Image();simage".$component_id."[".$i."].src='".$simage[$i]."';stitle".$component_id."[".$i."]='".$stitle[$i]."';slink".$component_id."[".$i."]='".$slink[$i]."';";
}
$component_body.="function ss".$component_id."()
{
acells=Math.round(".($rs->row["acells"]-1)." * Math.random());
arows=Math.round(".($rs->row["arows"]-1)." * Math.random());
if(acells*arows>".count($stitle).")
{
acells=0;
arows=0;
}
nomer=Math.round(".(count($stitle)-($rs->row["acells"]*$rs->row["arows"]))." * Math.random())+".($rs->row["acells"]*$rs->row["arows"])."-1
bufimg=new Image();
buflink="";
buftitle="";
nomer2=arows*".$rs->row["acells"]."+acells;
bufimg.src=simage".$component_id."[nomer2].src;
buflink=stitle".$component_id."[nomer2];
buftitle=slink".$component_id."[nomer2];
simage".$component_id."[nomer2].src=simage".$component_id."[nomer].src;
stitle".$component_id."[nomer2]=stitle".$component_id."[nomer];
slink".$component_id."[nomer2]=slink".$component_id."[nomer];
dimg=document.getElementById("img_".$component_id."_"+arows+"_"+acells);
dimg.src=simage".$component_id."[nomer].src;
dimg.setAttribute('alt',stitle".$component_id."[nomer]);
dlink=document.getElementById("link_".$component_id."_"+arows+"_"+acells);
dlink.href=slink".$component_id."[nomer];
simage".$component_id."[nomer].src=bufimg.src;
stitle".$component_id."[nomer]=buflink;
slink".$component_id."[nomer]=buftitle;
setTimeout("ss".$component_id."()",".(1000*$rs->row["slideshowtime"]).")
}
ss".$component_id."()
</script>";
}
}
}
?>
This code controls the "Components" which display on the main page. It has references to categories, and I can configure each component to display 1 category, but I can't figure out how to make it display all but 1 category
Asset Transfer from One plant to another within same company code
Hi,
need help in update query
i create a form for update. there are 8 columns in my mysql table. on my main page all the data is retrieve from db and displayed on the page. after every row there is a link edit. when user click
restricting another login once you logout
Hello,how can I restrict a page from login authenticating against info in a MySQL DB for a second time? Right now a login check against username and password in a MySQL table and allows access against
Disable html within defined tags
I have a mysql database that allows users to enter content with html, but I also want to have a tag that will disable the html between it for example:<a
Socket programming
Hello all,I have a PHP socket script. GPS trackers connect to this socket. IMEI verification takes place and if that is ok, the code is passed to a database. Also if the code contains alert-info, SMS
Need help with some php code :)
Hey! I'm quite new to this whole thing, so please don't fire me with shait on this one =DI'm trying to learn PHP and MySQL, and atm I am trying to make a website which corresponds with a database - a
Standard DES encryption script?
Can anybody point me to a tutorial or a short script that shows how to encrypt some text with salt into standard DES?I know about the crypt()-function, but I'm currently writing a PHP script that
javascript in php code causes page to display white
Hi All,Odd one this, I've got the following code (below) which is a simple log in form. The client wanted a pop to inform you when you've not completed a field and an asterix to appear.This is fine.
EXplanation help
Hey all,I am still fairly new to PHP programming and I am trying to put together a page where you select search terms from a drop down menu and it keeps the menu at your search choice in the menu
Help pulling in 'id' with "read more" link
I'm trying to create snippets of my articles in the cms I'm creating, and then have them redirect to to a single page entry of the article. Right now my snippets and "read more" links are