View Single Post
Old 09-07-2006, 11:06 PM  
Damian_Maxcash
So Fucking Banned
 
Join Date: Oct 2002
Location: MaxCash.com
Posts: 12,745
Quote:
Originally Posted by xanx
Thanks,

If anything is not right with this code I'm going to have a talk with my programmer. I just can't believe he would do something like that though as I have used him for over 3 years with no problems. Yet, there is enough of a similarity to have a look.
Compare this code from ./siteadmin/groupvideos.php with yours.

Code:
<?php
        include("../include/config.php");
        include("../include/function.php");
chk_admin_login();
        
        $sql = "select gname from group_own where GID=$_GET[gid]";
        $rs = $conn->execute($sql);
        STemplate::assign('gname', $rs->fields['gname']);

        $listing_per_page = 20;

        /* All videos */
        if($_GET["a"]=="")
        {
                //DELETE A video
                if($action=="del")
                {
                        $sql = "delete from group_vdo where GID=$gid and VID=$VID";
                        $conn->execute($sql);
                }

                //MAKE THE SUBQUERY
                if($_GET["a"]=="")
                        $query = " where GID=$gid";

                //PAGING
                if($page=="")
                $page = 1;
                $sql = "SELECT count(*) as total from group_vdo $query";
                $ars = $conn->Execute($sql);
                $total = $ars->fields['total'];
                $grandtotal = $total;
                $tpage = ceil($total/$listing_per_page);
                if($tpage==0) $spage=$tpage+1;
                else $spage = $tpage;
                $startfrom = ($page-1)*$listing_per_page;
                

                $page_no = "";
                for($i=1; $i<=10 and $i<=$tpage; $i++)
                {
                        if($i==$page)
                                $page_no .= "<b class='orange'>$i</b> ";
                        else
                                $page_no .= "<a href='groupvideos.php?a=$_GET[a]&status=$status&page=$i&sort=$sort' class='blue-n'>".$i."</a> ";
                }
                if($page_no!="")
                        $link = "Page $page_no of <b>$spage</b> Pages";
                else
                        $link = "<br><br><br><center>There is no $_GET[a] video available</center><br>";


//                $link = "You are in Page <b>$page</b> of <b>$spage</b>";
                if($tpage>1)
                {
                        $nextpage=$page+1;
                        $prevpage=$page-1;
                        $prevlink="<a href='groupvideos.php?a=$_GET[a]&status=$status&page=$prevpage&sort=$sort'><img src='../images/icon/previous.gif' title='Previous' alt='Previous' border='0' style='vertical-align: middle;'></a>";
                        $nextlink="<a href='groupvideos.php?a=$_GET[a]&status=$status&page=$nextpage&sort=$sort'><img src='../images/icon/next.gif' title='Next' alt='Next' border='0' style='vertical-align: middle;'></a>";
                        if($page==$tpage)
                                $link.="&nbsp;&nbsp;|&nbsp;$prevlink";
                        elseif($tpage>$page && $page>1)
                                $link.="&nbsp;&nbsp;|&nbsp;$prevlink &nbsp;&nbsp;$nextlink";
                        elseif($tpage>$page && $page<=1)
                                $link.="&nbsp;&nbsp;|&nbsp;$nextlink";
                }

                $sql="SELECT VID from group_vdo $query limit $startfrom, $listing_per_page";
                $rs = $conn->Execute($sql);
                while(!$rs->EOF)
                {
                        $gvdo[] = $rs->fields['VID'];
                        $rs->movenext();
                }
                $total = $rs->recordcount()+0;
                if($sort!="")
                        $sort=" order by $sort";
                $sql = "select * from video where VID in (".implode(",",$gvdo).") $sort";
                $rs = $conn->execute($sql);
                $videos = $rs->getrows();

                STemplate::assign('link',$link);
                STemplate::assign('grandtotal',$grandtotal+0);
                STemplate::assign('total',$total+0);
                STemplate::assign('page',$page+0);
                STemplate::assign('videos',$videos);

        }



        Stemplate::assign('err',$err);
        Stemplate::assign('msg',$msg);
        STemplate::display("siteadmin/groupvideos.tpl");
?>
That should give you the answer.
Damian_Maxcash is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote