You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 51 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Hot or Not Module error [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
This forum is locked: you cannot post, reply to, or edit topics.  This topic is locked: you cannot edit posts or make replies.printer-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
I Z'heet Ma Drawz
Guest






PostPosted: Wed May 19, 2004 8:22 am Reply with quoteBack to top

i have phpnuke 7.0 and have installed the hot or not module from nukecops downloads page. i get this error..

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/videonob/public_html/main/includes/sql_layer.php on line 238
There are images in the database

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/videonob/public_html/main/includes/sql_layer.php on line 238
There are images inactive

can someone redirect me or tell me how to fix this in newb language...i have already done an extensive search for this here to no avail. thanks in advance to anyone who can help.
Find all posts by Anonymous
dant1259
Captain
Captain


Joined: Jan 16, 2004
Posts: 336


PostPosted: Thu Jun 02, 2005 10:51 am Reply with quoteBack to top

I did actually get a version to open in the admin panel of phpnuke 7.6

In the admin/modules/hotornot.php you must fix all the sql_fetch_row lines. then you have to fix the top of the script which authorizes the admin.

This will let in open in the admin panel but it does not yet solve all the problems

It will write data to the mysql database but it is not reading the data back. So that is where I'm currently at.

Here is the admin/modules/hotornot.php file, if you care to see what is happening
-------------------------------------------------------------------------------------
Code:
<?php

# ******************************************************************************
#   PHPnuke Hot or Not v1.0
#
#   for PHPnuke 5.5
#
#               Download at: http://www.trashbin.tk
#
#   Copyright (C) 2002 by WebStyle http://www.trashbin.tk
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
# ******************************************************************************

if(is_admin($admin)) {
    if(!is_array($admin)) {
        $adm = base64_decode($admin);
        $adm = explode(":", $adm);
        $aname = "$adm[0]";
    } else {
        $aname = "$admin[0]";
    }
   list($radminsuper) = $db->sql_fetchrow($db->sql_query("select radminsuper from ".$prefix."_authors where aid='$aname'"));
   $radminuser = 0;
   if ($Version_Num >= 7.5)  {
      $row = $db->sql_fetchrow($db->sql_query("SELECT title, admins FROM ".$prefix."_modules WHERE title='Your_Account'"));
      $row2 = $db->sql_fetchrow($db->sql_query("SELECT name, radminsuper FROM ".$prefix."_authors WHERE aid='$aname'"));
      $admins = explode(",", $row['admins']);
      for ($i=0; $i < sizeof($admins); $i++) {
         if ($row2['name'] == "$admins[$i]" AND $row['admins'] != "") {
            $radminuser = 1;
         }
      }
   } else {
      list($radminuser) = $db->sql_fetchrow($db->sql_query("select radminuser from ".$prefix."_authors where aid='$aname'"));
   }
}


if ($radminsuper == 1 || $radminuser == 1) {

   //Get module languagefile
   if(file_exists("modules/Hot_Or_Not/language/lang-$language.php")) {
      include("modules/Hot_Or_Not/language/lang-$language.php");
   }
   else {
      include("modules/Hot_Or_Not/language/lang-english.php");
   }
   //get module config file
   include("modules/Hot_Or_Not/h_config.php");
   
   //index of the admin section
   function hotornot($uploadmsg = "") {
     global $prefix, $dbi;
     include ("header.php");
     GraphicAdmin();
     OpenTable();
     echo "<center><a href=\"modules.php?name=Hot_Or_Not\"><img src=\"modules/Hot_Or_Not/images/logo.gif\" border=\"0\" alt=\"\"></a><br><br>";
     //show number of images in database!
     $result=sql_query("select * from ".$prefix."_hotornot_votes", $dbi);
     $numrows = sql_num_rows($result, $dbi);
     echo "<font class=\"content\">"._THEREARE." <b>$numrows</b> "._HOTORNOTIMAGESINDB."</font><br>";
     //show number of inactive images in database!
     $result=sql_query("select * from ".$prefix."_hotornot_votes where vote_active = 1", $dbi);
     $numrows = sql_num_rows($result, $dbi);
     echo "<font class=\"content\">"._THEREARE." <b>$numrows</b> "._HOTORNOTIMAGESINACTIVE."</font></center>";
     CloseTable();
     echo "<br>";
   
      //Add a New Category
     OpenTable();
     echo "<form method=\"post\" action=\"admin.php\">"
            ."<font class=\"option\"><b>"._ADDMAINCATEGORY."</b></font><br><br>"
            .""._NAME.": <input type=\"text\" name=\"cat_title\" size=\"30\" maxlength=\"100\"><br>"
            .""._DESCRIPTION.":<br><textarea name=\"cat_desc\" cols=\"60\" rows=\"10\"></textarea><br>"
            ."<input type=\"hidden\" name=\"op\" value=\"hotornotaddcat\">"
            ."<input type=\"submit\" value=\""._ADD."\"><br>"
            ."</form>";
     CloseTable();
     echo "<br>";
   
      //Modify a Category
      $result = sql_query("select * from ".$prefix."_hotornot_cat", $dbi);
      $numrows = sql_num_rows($result, $dbi);
      if ($numrows>0) {
         OpenTable();
         echo "<form method=\"post\" action=\"admin.php\">"
             ."<font class=\"option\"><b>"._MODCATEGORY."</b></font><br><br>";
         $result2=sql_query("select cat_id, cat_title, cat_par_id from ".$prefix."_hotornot_cat order by cat_title", $dbi);
         echo ""._CATEGORY.": <select name=\"cat_id\">";
         while(list($cat_id2, $cat_title2, $cat_par_id2) = $db->sql_fetchrow($db->sql_query($result2, $dbi))) {
          echo "<option value=\"$cat_id2\">$cat_title2</option>";
         }
         echo "</select>"
             ."<input type=\"hidden\" name=\"op\" value=\"hotornotmodcat\">"
             ."&nbsp;<input type=\"submit\" value=\""._MODIFY."\">"
             ."</form>";
         CloseTable();
         echo "<br>";
      }
      
      //View content Category
      $result = sql_query("select * from ".$prefix."_hotornot_cat", $dbi);
      $numrows = sql_num_rows($result, $dbi);
      if ($numrows>0) {
         OpenTable();
         echo "<form method=\"post\" action=\"admin.php\">"
             ."<font class=\"option\"><b>"._HOTORNOTEDITCONTENT."</b></font><br><br>";
         $result2=sql_query("select cat_id, cat_title, cat_par_id from ".$prefix."_hotornot_cat order by cat_title", $dbi);
         echo ""._CATEGORY.": <select name=\"cat_id\">";
         while(list($cat_id2, $cat_title2, $cat_par_id2) = $db->sql_fetchrow($db->sql_query($result2, $dbi))) {
          echo "<option value=\"$cat_id2\">$cat_title2</option>";
         }
         echo "</select>"
             ."<input type=\"hidden\" name=\"op\" value=\"hotornoteditcat\">"
             ."&nbsp;<input type=\"submit\" value=\""._HOTORNOTEDITC."\">"
             ."</form>";
         CloseTable();
         echo "<br>";
      }
      
      //upload image to server
      OpenTable();
      global $img_path, $img_upload_maxsize;
      echo "<form ENCTYPE=\"multipart/form-data\" method=\"post\" action=\"admin.php\">"
          ."<font class=\"option\"><b>"._HOTORNOTUPLOAD."</b></font><br><br>";
     if ($uploadmsg != "") {
        echo "<font color=\"#cc0000\"><b>$uploadmsg</b></font><br><br>";
     }
     echo "<input type=\"hidden\" name=\"op\" value=\"hotornotimageupload\">"
          ."<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$img_upload_maxsize\">"
          .""._HOTORNOTUPLOADFILE.": <input type=\"file\" name=\"userfile\" size=\"50\"><br><br>"
          .""._HOTORNOTUPLOADDIR.": <select name=\"img_updir\">";
      //get directories from img path
      if ($handle = @opendir("$img_path")) {
       while (false !== ($dir = readdir($handle))) {
         if ($dir != "." && $dir != "..") {
               //assume that there are no file in the directory!!!
               echo "<option value=\"$dir\">$dir</option>";
          }
        }
       }
       echo "</select>";
     echo "&nbsp;<input type=\"submit\" value=\""._HOTORNOTUPLOAD."\">"
          ."</form>";
      CloseTable();
      echo "<br>";

      include ("footer.php");
   }
   
   //Add category to database
   function addcategory($cat_title, $cat_desc, $cat_par_id = 0) {
       global $prefix, $dbi;
         $error = _ERRORTHECATEGORY;
         //Check if category with same name already exists
       $result = sql_query("select cat_id from ".$prefix."_hotornot_cat where cat_title='$cat_title' and cat_par_id = $cat_par_id", $dbi);
       $numrows = sql_num_rows($result, $dbi);
       if ($numrows>0) {
          //Display error msg
            include("header.php");
            GraphicAdmin();
            OpenTable();
            echo "<br><center><font class=\"option\">"
                ."<b>$error $title "._ALREADYEXIST."</b><br><br>"
                .""._GOBACK."<br><br>";
            CloseTable();
            include("footer.php");
         } else {
            //Insert category into database. By default it is inactive and not show in block!
            sql_query("insert into ".$prefix."_hotornot_cat values (NULL, '$cat_title', '$cat_desc', $cat_par_id, 1, 1, 0, 1)", $dbi);
            Header("Location: admin.php?op=hotornot");
       }
   }
   
   //Modify a category
   function modifycategory($cat_id) {
       global $prefix, $dbi;
     include ("header.php");
     GraphicAdmin();
     OpenTable();
     echo "<center><font class=\"title\"><b>"._HOTORNOTADMIN."</b></font></center>";
     CloseTable();
     echo "<br>";
     //Get Category Details
     OpenTable();
     echo "<center><font class=\"option\"><b>"._MODCATEGORY."</b></font></center><br><br>";
      $result=sql_query("select cat_title, cat_desc, cat_active, cat_block, cat_view, cat_userupload from ".$prefix."_hotornot_cat where cat_id=$cat_id", $dbi);
      list($cat_title,$cat_desc,$cat_active,$cat_block,$cat_view,$cat_userupload) = $db->sql_fetchrow($db->sql_query($result, $dbi));
      $cat_desc = stripslashes($cat_desc);
      echo "<form action=\"admin.php\" method=\"post\">"
          .""._NAME.": <input type=\"text\" name=\"cat_title\" value=\"$cat_title\" size=\"51\" maxlength=\"50\"><br><br>"
          .""._DESCRIPTION.":<br><textarea name=\"cat_desc\" cols=\"60\" rows=\"10\">$cat_desc</textarea><br><br>";
      if ($cat_active == 0) {
         $yes = " checked";
         $no = "";
      } else {      
         $yes = "";
         $no = " checked";
      }      
      echo ""._ACTIVE."?:&nbsp;<input type=\"radio\" name=\"cat_active\" value=\"0\"$yes> "._YES.""
          ." <input type=\"radio\" name=\"cat_active\" value=\"1\"$no> "._NO."<br><br>";
      if ($cat_block == 0) {
         $yes = " checked";
         $no = "";
      } else {      
         $yes = "";
         $no = " checked";
      }
      echo ""._HOTORNOTACTIVEINBLOCK."?:&nbsp;<input type=\"radio\" name=\"cat_block\" value=\"0\"$yes> "._YES.""
          ." <input type=\"radio\" name=\"cat_block\" value=\"1\"$no> "._NO."<br><br>";
      if ($cat_userupload == 0) {
         $yes = " checked";
         $no = "";
      } else {      
         $yes = "";
         $no = " checked";
      }         
      echo ""._HOTORNOTUSERUPLOAD."?:&nbsp;<input type=\"radio\" name=\"cat_userupload\" value=\"0\"$yes> "._YES.""
          ." <input type=\"radio\" name=\"cat_userupload\" value=\"1\"$no> "._NO."<br><br>";
      echo "<input type=\"hidden\" name=\"sub\" value=\"0\">"
          ."<input type=\"hidden\" name=\"cat_id\" value=\"$cat_id\">"
          ."<input type=\"hidden\" name=\"op\" value=\"hotornotsavecat\">"
            .""._VIEWPRIV."&nbsp;<select name=\"cat_view\">";
      $sel[0] = "";
      $sel[1] = "";
      $sel[2] = "";
      $sel[$cat_view] = " selected";
      echo "<option value=\"0\"".$sel[0].">"._MVALL."</option>";
      echo "<option value=\"1\"".$sel[1].">"._MVUSERS."</option>";
      echo "<option value=\"2\"".$sel[2].">"._MVADMIN."</option>"
          ."</select>"
          ."<table border=\"0\"><tr><td>"
          ."<input type=\"submit\" value=\""._SAVECHANGES."\"></form></td>"
          ."<td><form action=\"admin.php\" method=\"post\">"
          ."<input type=\"hidden\" name=\"op\" value=\"hotornoteditcat\">"
          ."<input type=\"hidden\" name=\"cat_id\" value=\"$cat_id\">"
          ."<input type=\"submit\" value=\""._HOTORNOTEDITC."\"></form></td>"
          ."<td><form action=\"admin.php\" method=\"post\">"
          ."<input type=\"hidden\" name=\"sub\" value=\"0\">"
          ."<input type=\"hidden\" name=\"cat_id\" value=\"$cat_id\">"
          ."<input type=\"hidden\" name=\"op\" value=\"hotornotdelcat\">"
          ."<input type=\"submit\" value=\""._DELETE."\"></form></td></tr></table>"; 
     CloseTable();
     include ("footer.php");
   }
   
   //Save changes category to database
   function savecategory($cat_id, $cat_title, $cat_desc, $cat_active, $cat_block, $cat_view, $cat_userupload) {
      global $prefix, $dbi;
      //check if all mandatory fields are there
      if ($cat_id > 0 && $cat_title != "" && ($cat_active == 0 || $cat_active == 1) && ($cat_block == 0 || $cat_block == 1) && ($cat_userupload == 0 || $cat_userupload == 1)&& ($cat_view == 0 || $cat_view == 1 ||$cat_view == 2)) {
         sql_query("update ".$prefix."_hotornot_cat set cat_title='$cat_title', cat_desc='$cat_desc', cat_active=$cat_active, cat_block=$cat_block, cat_view=$cat_view, cat_userupload=$cat_userupload where cat_id=$cat_id", $dbi);
      }
     Header("Location: admin.php?op=hotornot");
   }
   
   //Delete category after conformation
   function deletecategory($cat_id, $del_ok=0) {
      global $prefix, $dbi;
      if ($del_ok != 1) {
         //ask conformation
        include ("header.php");
        GraphicAdmin();
        OpenTable();      
        echo "<center><font class=\"title\"><b>"._HOTORNOTADMIN."</b></font></center>";
        CloseTable();
        echo "<br>";
        OpenTable();
        $result = sql_query("select cat_title from ".$prefix."_hotornot_cat where cat_id = $cat_id", $dbi);
        list($cat_title) = $db->sql_fetchrow($db->sql_query($result, $dbi));
        echo "<center><table border=\"0\"><tr><td colspan=\"2\"><form action=\"admin.php\" method=\"post\">";
        echo _HOTORNOTCATDELETE." $cat_title ?</td></tr>";
        echo "<tr><td align=\"right\"><input type=\"hidden\" name=\"op\" value=\"hotornotdelcat\"><input type=\"hidden\" name=\"cat_id\" value=\"$cat_id\"><input type=\"hidden\" name=\"del_ok\" value=\"1\">";
        echo "<input type=\"submit\" value=\""._YES."\"></form></td><td><form action=\"admin.php\" method=\"post\"><input type=\"hidden\" name=\"op\" value=\"hotornot\"><input type=\"submit\" value=\""._NO."\"></form></td></tr></table></center>";
        CloseTable();
        include("footer.php");
      } else {
         //make selection for deleting all the comments
         $result = sql_query("select vote_id from ".$prefix."_hotornot_votes where vote_cat_id = $cat_id", $dbi);
         while (list($vote_id) = $db->sql_fetchrow($db->sql_query($result, $dbi))) {
            $wherecomment .= "$vote_id,";
         }
         if ($wherecomment != "") {
            $wherecomment = substr($wherecomment, 0, strlen($wherecomment) - 1);
            //delete all comments
            sql_query("delete from ".$prefix."_hotornot_comments where c_vote_id in ($wherecomment)", $dbi);
         }
         //delete all images from votes table
         sql_query("delete from ".$prefix."_hotornot_votes where vote_cat_id = $cat_id", $dbi);
         //then delete category
         sql_query("delete from ".$prefix."_hotornot_cat where cat_id = $cat_id", $dbi);
        Header("Location: admin.php?op=hotornot");
      }
   }
   
   //Edit content of category
   function editcontent($cat_id) {
       global $prefix, $dbi, $img_path, $nukeurl;
     include ("header.php");
     GraphicAdmin();
     OpenTable();
     echo "<center><font class=\"title\"><b>"._HOTORNOTADMIN."</b></font></center>";
     //Get category title
     $result = sql_query("select cat_title from ".$prefix."_hotornot_cat where cat_id = $cat_id", $dbi);
     list($cat_title) = $db->sql_fetchrow($db->sql_query($result, $dbi));
     echo "<br><center><font class=\"title\">"._HOTORNOTEDITCATEGORY." <b>$cat_title</b></font></center>";
     CloseTable();
     echo "<br>";
     $result = sql_query("select vote_id, vote_active, vote_dir, vote_file from ".$prefix."_hotornot_votes where vote_cat_id = $cat_id order by vote_dir, vote_file", $dbi);
     if (sql_num_rows($result, $dbi) > 0) {
        OpenTable();
        echo "<form action=\"admin.php\" method=\"post\"><table border=\"0\" width=\"85%\">";
        echo "<tr><td><input type=\"hidden\" name=\"op\" value=\"hotornotedit\"><select name=\"vote_id\" size=\"15\">";
        //Show content of category with de- activate and add/delete options
        while (list($vote_id, $vote_active, $vote_dir, $vote_file) = $db->sql_fetchrow($db->sql_query($result, $dbi))) {
           if ($vote_active == 0) {
              $active = "";
           } else {
              $active = "(*)";
           }
           echo "<option value=\"$vote_id\">$vote_dir/$vote_file $active</option>";
        }
        echo "</select></td></tr>";
        echo "<tr><td><input type=\"hidden\" name=\"cat_id\" value=\"$cat_id\"><input type=\"submit\" value=\""._HOTORNOTEDITIMAGE."\"></td></tr>";
        echo "</table></form>";
        CloseTable();
        echo "<br>";       
      }
     OpenTable();
     //Add image form
     echo "<center><font class=\"title\"><b>"._HOTORNOTADDIMAGE."</b></font></center>";
     echo "<form action=\"admin.php\" method=\"post\"><table border=\"0\">"
           ."<tr><td>"._HOTORNOTDIR.":</td><td>$img_path/<input type=\"text\" name=\"vote_dir\" size=\"19\" maxlength=\"255\"></td></tr>"
           ."<tr><td>"._HOTORNOTFILE.":</td><td><input type=\"text\" name=\"vote_file\" size=\"51\" maxlength=\"255\"></td></tr>"
           ."<tr><td colspan=\"2\">"._HOTORNOTFULLPATH.":</td></tr>"
           ."<td colspan=\"2\" align=\"right\"><input type=\"text\" name=\"vote_link\" value=\"$nukeurl/$img_path\" size=\"81\" maxlength=\"300\"></td></tr>"
           ."<tr><td><input type=\"hidden\" name=\"op\" value=\"hotornotadd\"><input type=\"hidden\" name=\"vote_cat_id\" value=\"$cat_id\"></td>"
           ."<td align=\"right\"><input type=\"submit\" name=\"submit\" value=\""._ADD."\"></td></tr>"
           ."</table></form>"; 
     CloseTable();
     echo "<br>";
     OpenTable();
     //Add images from directory
     echo "<center><font class=\"title\"><b>"._HOTORNOTADDDIRECTORY."</b></font></center>";
     echo "<form action=\"admin.php\" method=\"post\"><table border=\"0\">"
           ."<tr><td>"._HOTORNOTDIR.":</td><td>$img_path/<input type=\"text\" name=\"dir\" size=\"51\" maxlength=\"255\"></td></tr>"
           ."<tr><td><input type=\"hidden\" name=\"preview\" value=\"1\"><input type=\"hidden\" name=\"op\" value=\"hotornotdirc\"><input type=\"hidden\" name=\"vote_cat_id\" value=\"$cat_id\"></td>"
           ."<td align=\"right\"><input type=\"submit\" name=\"submit\" value=\""._HOTORNOTPREVIEW."\"></td></tr>"
           ."</table></form>"; 
     CloseTable(); 
     include ("footer.php");
   }
   
   //Add image to database
   function addimage($vote_dir, $vote_file, $vote_link, $vote_cat_id, $redirect = true) {
      global $prefix, $dbi, $nukeurl, $img_path;
      //check if mandatory fields are filled.
      if ($vote_dir != "" && $vote_file != "") {
         //check if image already exists
         $result = sql_query("select vote_id from ".$prefix."_hotornot_votes where vote_dir = '$vote_dir' and vote_file = '$vote_file'", $dbi);
         if (sql_num_rows($result, $dbi) == 0) {
            //check if vote_link is given, otherwise default to same url on $nukeurl
            if (is_null($vote_link) || $vote_link == "") {
               $vote_link = "$nukeurl/$img_path/$vote_dir/$vote_file";
            }
            //get image fullsize size to store in database
            $img_size = getimagesize($vote_link);
            $vote_imgwidth = $img_size[0];
            $vote_imgheight = $img_size[1];
            //insert image into database!
            sql_query("insert into ".$prefix."_hotornot_votes (vote_cat_id, vote_dir, vote_file, vote_link, vote_imgwidth, vote_imgheight) values ($vote_cat_id, '$vote_dir', '$vote_file', '$vote_link', $vote_imgwidth, $vote_imgheight)", $dbi);
            $return = true;
         } else {
            $return = false;
         }
      }
      if ($redirect) {
         //go to content page of category
         editcontent($vote_cat_id);
      }
      return $return;
   }
   
   //save image changes to database
   function saveimage($vote_id, $vote_dir, $vote_file, $vote_link, $vote_active, $cat_id) {
      global $prefix, $dbi;
      //check mandatory fields
      if ($vote_id != "" && $vote_dir != "" && $vote_file != "") {
         sql_query("update ".$prefix."_hotornot_votes set vote_dir = '$vote_dir', vote_file = '$vote_file', vote_link = '$vote_link', vote_active = $vote_active where vote_id = $vote_id", $dbi);
      }
      editcontent($cat_id);
   }
   
   function deleteimage($vote_id, $cat_id) {
      global $prefix, $dbi;
      if (isset($vote_id) && $vote_id > 0) {
         //delete all its comments
         sql_query("delete from ".$prefix."_hotornot_comments where c_vote_id = $vote_id", $dbi);
         //delete image from database by id
         sql_query("delete from ".$prefix."_hotornot_votes where vote_id = $vote_id", $dbi);
      }
      editcontent($cat_id);
   }
   
   //Edit image
   function editimage($vote_id, $cat_id, $cid = 0) {
       global $prefix, $dbi, $img_path, $img_width;
     include ("header.php");
     GraphicAdmin();
     //check if comment has to be deleted
     if ($cid > 0) {
        sql_query("delete from ".$prefix."_hotornot_comments where c_id = $cid", $dbi);
     }
     //get image details
     $result = sql_query("select vote_dir, vote_file, vote_link, vote_active from ".$prefix."_hotornot_votes where vote_id = $vote_id", $dbi);
     list($vote_dir, $vote_file, $vote_link, $vote_active) = $db->sql_fetchrow($db->sql_query($result, $dbi));
     OpenTable();
     echo "<center><font class=\"title\"><b>"._HOTORNOTADMIN."</b></font></center>";
     CloseTable();
     echo "<br>";
     OpenTable();
      if ($vote_file == "") {
         //error, image does not exists
        echo "<center>"._HOTORNOTERRORIMAGE."<br>"._GOBACK."</center>";
     } else {
         if ($vote_active == 0) {
            $yes = " checked";
            $no = "";
         } else {      
            $yes = "";
            $no = " checked";
         }     
        echo "<center><font class=\"title\">"._HOTORNOTEDITIMAGE." $vote_dir/$vote_file</font></center><br>"
              ."<center><form action=\"admin.php\" method=\"post\"><table border=\"0\"><tr><td align=\"center\" colspan=\"3\">"
              ."<a target=\"fullsize\" href=\"$vote_link\"><img src=\"$img_path/$vote_dir/$vote_file\" width=\"$img_width\" border=\"0\"></a></td></tr>"
              ."<tr><td>"._HOTORNOTDIR.":</td><td colspan=\"3\"><input type=\"text\" name=\"vote_dir\" value=\"$vote_dir\" size=\"51\" maxlength=\"255\"></td></tr>"
              ."<tr><td>"._HOTORNOTFILE.":</td><td colspan=\"3\"><input type=\"text\" name=\"vote_file\" value=\"$vote_file\" size=\"51\" maxlength=\"255\"></td></tr>"
              ."<tr><td>"._HOTORNOTLINK.":</td><td colspan=\"3\"><input type=\"text\" name=\"vote_link\" value=\"$vote_link\" size=\"81\" maxlength=\"300\"></td></tr>"
              ."<tr><td>"._ACTIVE."?:</td><td colspan=\"3\"><input type=\"radio\" name=\"vote_active\" value=\"0\"$yes> "._YES.""
             ." <input type=\"radio\" name=\"vote_active\" value=\"1\"$no> "._NO."</td></tr>"   
              ."<tr><td valign=\"bottom\"><input type=\"hidden\" name=\"cat_id\" value=\"$cat_id\"><input type=\"hidden\" name=\"op\" value=\"hotornotsave\"><input type=\"hidden\" name=\"vote_id\" value=\"$vote_id\"></td>"
              ."<td width=\"10%\" valign=\"bottom\"><br><input type=\"submit\" name=\"submit\" value=\""._SAVECHANGES."\">"
              ."</form><form action=\"admin.php\" method=\"post\"><input type=\"hidden\" name=\"cat_id\" value=\"$cat_id\"><input type=\"hidden\" name=\"vote_id\" value=\"$vote_id\">"
              ."<input type=\"hidden\" name=\"op\" value=\"hotornotdel\"><input type=\"submit\" value=\""._HOTORNOTDELETE."\"></td></tr>"
              ."<tr><td colspan=\"3\" align=\"center\"><a href=\"admin.php?name=hotornot&amp;op=hotornoteditcat&amp;cat_id=$cat_id\">"._HOTORNOTBACK."</td></tr></table></center>";
       
      }
     CloseTable();
     //show comments!!
     $result = sql_query("select c_id, c_datetime, c_user, c_comment from ".$prefix."_hotornot_comments where c_vote_id = $vote_id", $dbi);
     if (sql_num_rows($result, $dbi) > 0) {
        echo "<br>";
        OpenTable();
        echo "<table border=\"0\" width=\"90%\"><tr><td align=\"center\">"._HOTORNOTCOMMENTS1."<br><br></td></tr>";
        while (list($cid, $c_datetime, $c_user, $c_comment) = $db->sql_fetchrow($db->sql_query($result, $dbi))) {
           echo "<tr><td>"._HOTORNOTPOSTEDBY.": $c_user ($c_datetime) <a href=\"admin.php?name=hotornot&amp;op=hotornotdelc&amp;cid=$cid&amp;vote_id=$vote_id&amp;cat_id=$cat_id\">["._HOTORNOTDELCOMMENT."]</a>";
           echo "<tr><td>$c_comment<hr></td></tr>";
        }
        echo "</table>";
        CloseTable();
      }
     include ("footer.php");
   }
   
   //Get content of directory!
   function getDirC($dir, $preview, $cat_id, $vote_link = "") {
       global $prefix, $dbi, $img_path, $img_type;
     include ("header.php");
     GraphicAdmin();
     OpenTable();
     //get category title
      $result=sql_query("select cat_title from ".$prefix."_hotornot_cat where cat_id = $cat_id", $dbi);
      list($cat_title) = $db->sql_fetchrow($db->sql_query($result, $dbi));
     echo "<center><font class=\"title\"><b>"._HOTORNOTADDDIRECTORY." - $img_path/$dir</b></font></center><br>";
      if ($dir != "") {
         //get files from given directory
         $path = array();
         $files = array();
         if ($handle = @opendir("$img_path/$dir")) {
          while (false !== ($file = readdir($handle))) {
             $bpush = false;
            if ($file != "." && $file != "..") {
               //check if file type is allowed!
                 foreach ($img_type as $type) {
                     if (substr($file, strlen($file) - strlen($type)) == $type) {
                       $bpush = true;
                    }
                 }
                 //if image allowed, put in array
                if ($bpush) {
                   //check if image does not already exists
                   $result = sql_query("select vote_id from ".$prefix."_hotornot_votes where vote_dir = '$dir' and vote_file = '$file'", $dbi);
                   if (sql_num_rows($result, $dbi) == 0) {
                      array_push($files, $file);
                      $file = "$dir/$file";
                      array_push($path, $file);
                   }
                }          
             }
           }
           closedir($handle);
        }
         echo "<p><table border=\"1\" width=\"85%\"><tr><th>Image Path</th><th>File Size</th></tr>";
         if (count($path) == 0) {
            echo "<tr><td colspan=\"2\" align=\"center\">No new images found in $img_path/$dir</td></tr>";
         } else {
            global $nukeurl;
            foreach ($path as $pfile) {
               //add link to preview image!
               echo "<tr><td><a href=\"$nukeurl/$img_path/$pfile\" target=\"preview\">$img_path/$pfile</a></td>";
               echo "<td>".(filesize("$img_path/$pfile")/1000)." kb</td></tr>";
            }
         }
         echo "</table></p>";
      }
     if ($preview == "") $preview = 1;
     if ($preview == 1) {
        //build form to add to database
        //default link to fullsize image!
        $vote_link = "$nukeurl/$img_path/$dir/fullsize";
        echo "<table border=\"0\"><tr><td valign=\"top\"><form action=\"admin.php\" method=\"post\">"
              ."<input type=\"hidden\" name=\"op\" value=\"hotornotdirc\">"
              ."<input type=\"hidden\" name=\"preview\" value=\"1\">"
              ."<input type=\"hidden\" name=\"vote_cat_id\" value=\"$cat_id\">"
              .""._HOTORNOTPATH.":&nbsp;$img_path/<input type=\"text\" size=\"21\" name=\"dir\" value=\"$dir\">"
              ."&nbsp;<input type=\"submit\" value=\""._HOTORNOTPREVIEW."\"></form></td></tr>"
              ."<tr><td valign=\"bottom\" align=\"left\">"
              ."<form action=\"admin.php\" method=\"post\">"
              ."<input type=\"hidden\" name=\"op\" value=\"hotornotdirc\">"
              ."<input type=\"hidden\" name=\"preview\" value=\"0\">"
              ."<input type=\"hidden\" name=\"dir\" value=\"$dir\">"
              ."<input type=\"hidden\" name=\"vote_cat_id\" value=\"$cat_id\">"
              .""._HOTORNOTFULLPATH.":<br><input type=\"text\" size=\"100\" maxlength=\"255\" name=\"vote_link\" value=\"$vote_link\"></tr>"
              ."<tr><td valign=\"bottom\" align=\"center\">"
              ."<input type=\"submit\" value=\""._HOTORNOTADDTODB."\"></form></td></tr></table>";
     }
     if ($preview == 0) {
        //add images to database!!!
        if (count($files) != 0) {
           foreach ($files as $file) {
               if ($vote_link != "") $hot_link = $vote_link."/$file";
              if (addimage($dir, $file, $hot_link, $cat_id, false)) {
                 echo "added: $dir/$file in $cat_title<br>";
              } else {
                 echo "$dir/$file already in database!<br>";
              }
           }
        }
        echo "<p><a href=\"admin.php?op=hotornoteditcat&amp;cat_id=$cat_id\">"._HOTORNOTBACKTO." $cat_title.</a></p>";
     }
      CloseTable();
      include("footer.php");
   }
   
function fiximagesizes() {
   include ("header.php");
   OpenTable();
   global $dbi, $prefix;
   $i = 1;
   echo "<table>";
   $result = sql_query("select vote_id, vote_link from ".$prefix."_hotornot_votes", $dbi);
   while(list($vote_id, $vote_link) = $db->sql_fetchrow($db->sql_query($result, $dbi))) {
      $img_size = getimagesize($vote_link);
      echo "<tr><td>$i</td><td>$vote_link</td><td>".$img_size[0]."</td><td>".$img_size[1]."</td></tr>";
      sql_query("update ".$prefix."_hotornot_votes set vote_imgwidth = ".$img_size[0].", vote_imgheight = ".$img_size[1]." where vote_id = $vote_id", $dbi);
      $i++;
   }
   echo "</table>";
   CloseTable();
   include ("footer.php");
}
   
   switch ($op) {
      case "hotornot":
         hotornot($uploadmsg);
      break;
      case "hotornotaddcat";
         addcategory($cat_title, $cat_desc);
      break;
      case "hotornotmodcat":
         modifycategory($cat_id);
      break;
      case "hotornotsavecat":
         savecategory($cat_id, $cat_title, $cat_desc, $cat_active, $cat_block, $cat_view, $cat_userupload);
      break;
      case "hotornotdelcat":
         deletecategory($cat_id, $del_ok);
      break;
      case "hotornoteditcat":
         editcontent($cat_id);
      break;
      case "hotornotadd":
         addimage($vote_dir, $vote_file, $vote_link, $vote_cat_id);
      break;
      case "hotornotdel":
         deleteimage($vote_id, $cat_id);
      break;
      case "hotornotedit":
         editimage($vote_id, $cat_id);
      break;
      case "hotornotsave":
         saveimage($vote_id, $vote_dir, $vote_file, $vote_link, $vote_active, $cat_id);
      break;
      case "hotornotdelc":
         editimage($vote_id, $cat_id, $cid);
      break;
      case "hotornotdirc":
         getDirC($dir, $preview, $vote_cat_id, $vote_link);
      break;
      case "hotornotaddvotelink":
         addvotelink($cat_id);
      break;
      case "hotornotfix":
         fiximagesizes();
      default:
         hotornot($uploadmsg);
   }
} else {
   //show message if user is not admin.
   echo "Access Denied";
}

?>
Find all posts by dant1259View user's profileSend private messageSend e-mail
dant1259
Captain
Captain


Joined: Jan 16, 2004
Posts: 336


PostPosted: Thu Jun 02, 2005 5:39 pm Reply with quoteBack to top

Ok, I have got it running successfully in 7.6 The solution was less complex than I origianlly thought.

Go ahead and do the install per the readme file in hotornot

in the admin/modules/hotornot.php file replace the top few lines for the admin authorization with the following:

Code:
if(is_admin($admin)) {
    if(!is_array($admin)) {
        $adm = base64_decode($admin);
        $adm = explode(":", $adm);
        $aname = "$adm[0]";
    } else {
        $aname = "$admin[0]";
    }
   list($radminsuper) = $db->sql_fetchrow($db->sql_query("select radminsuper from ".$prefix."_authors where aid='$aname'"));
   $radminuser = 0;
   if ($Version_Num >= 7.5)  {
      $row = $db->sql_fetchrow($db->sql_query("SELECT title, admins FROM ".$prefix."_modules WHERE title='Your_Account'"));
      $row2 = $db->sql_fetchrow($db->sql_query("SELECT name, radminsuper FROM ".$prefix."_authors WHERE aid='$aname'"));
      $admins = explode(",", $row['admins']);
      for ($i=0; $i < sizeof($admins); $i++) {
         if ($row2['name'] == "$admins[$i]" AND $row['admins'] != "") {
            $radminuser = 1;
         }
      }
   } else {
      list($radminuser) = $db->sql_fetchrow($db->sql_query("select radminuser from ".$prefix."_authors where aid='$aname'"));
   }
}


if ($radminsuper == 1 || $radminuser == 1) {


The module ran perfectly with this small fix.

If you have problems finding the module just pm me and I'll be happy to email it to you.
Find all posts by dant1259View user's profileSend private messageSend e-mail
womble
Guest






PostPosted: Tue Jun 07, 2005 1:42 am Reply with quoteBack to top

Thanks dant1259, that fixes most of my module.. but when I try to upload an image i get this warning...

Warning: strstr(): Empty delimiter. in /home/me/public_html/cms/admin/modules/hotornot_upload.php on line 67

and it doesnt upload the file..
Find all posts by Anonymous
womble
Guest






PostPosted: Tue Jun 07, 2005 1:47 am Reply with quoteBack to top

..also when I paste the code
Code:
###################################################
# Code for Hot or Not module by ::Trashbin:: 2002 #
###################################################
require_once("modules/Hot_Or_Not/rate.php");
###################################################
into my mainfile.php it breaks my site..
Find all posts by Anonymous
dant1259
Captain
Captain


Joined: Jan 16, 2004
Posts: 336


PostPosted: Tue Jun 07, 2005 3:28 am Reply with quoteBack to top

I'll have to go thru and look but make sure you have your files/folders chmod to the right permission. I'll take a look at my code later today and let you know. -- off to work
Find all posts by dant1259View user's profileSend private messageSend e-mail
womble
Guest






PostPosted: Tue Jun 07, 2005 1:00 pm Reply with quoteBack to top

The readme didnt say anything about CHMODing so I dont think I changed the permisions on any of the files.....

Ok that would be great!! Thanks!!
Find all posts by Anonymous
dant1259
Captain
Captain


Joined: Jan 16, 2004
Posts: 336


PostPosted: Tue Jun 07, 2005 3:17 pm Reply with quoteBack to top

which version of hot or not do you have. This is the one I'm running
Hot or Not Version ChicagoBase.com 1

This is the only one I found that worked. If you don't have it pm your email and I'll send it to you.

here is the file to set the permissions on
Please make sure that you have set the permissions of "Hot_Or_Not" and "users" directories to 777 or writeable by everyone.
Find all posts by dant1259View user's profileSend private messageSend e-mail
womble
Guest






PostPosted: Tue Jun 07, 2005 8:54 pm Reply with quoteBack to top

The only version ive been able to find is Hot or Not v2.0 beta 1,

And I CHMOD the 2 directories but still not working.
Find all posts by Anonymous
womble
Nuke Cadet
Nuke Cadet


Joined: Jun 08, 2005
Posts: 1


PostPosted: Wed Jun 08, 2005 1:37 am Reply with quoteBack to top

WooHoo, I fixed it

What I was doing wrong was not putting the correct 'sever' path in the rate.php file I was using my http path... so now the mainfile with the code added to it is working now Very Happy

Thanks for all your help Exclamation
Find all posts by wombleView user's profileSend private message
guest555
Guest






PostPosted: Wed Jun 15, 2005 11:31 am Reply with quoteBack to top

help im using version Hot or Not v2.0 beta 1 and i cant upload a file it says "access denied"
Find all posts by Anonymous
3CH3LON
Guest






PostPosted: Thu Jun 30, 2005 5:41 am Reply with quote