Jump to content

Image script help....Please?


jumpenjuhosaphat

Recommended Posts

Okay, this is a script that I am trying to get to work.  The script won't display an image.  This is a script that is to look for uploaded images in a database, and let the admin authorize the image or deny it.  I have made a few changes.  For one, where it says $limit="num,num"; I put this there because who ever wrote the script tried to pass integers to a string, and it wouldn't take, so I changed a couple of them to string values to see if that had anything to do with it.  I have been going over this script for hours, but I'm still to new to know whats wrong with it.  Could you maybe look over it and see if you can help me figure it out?
[code]
<?php
session_start();
include("../admin/config.php");

?>
<html>
<head>
<title>Admin Controls</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK REL=StyleSheet HREF=acc_style.css TYPE=text/css>
</head>
<body bgcolor="#D7EFFF" class=menutype5>
<?php include('menu.php'); ?>
<table width="750" height="10" border="0" cellpadding="0" cellspacing="0" bgcolor="FFF3C3" style="BORDER-BOTTOM: #666666 1px solid;  BORDER-TOP: #666666 1px solid; BORDER-LEFT: #666666 1px solid; BORDER-RIGHT: #666666 1px solid; table-layout: fixed; PADDING-RIGHT:5px;">
  <tr>
    <td style="PADDING-LEFT:15px; PADDING-TOP:15px; PADDING-BOTTOM:15px; PADDING-RIGHT:15px;"><table width="714" height="135" border="0" cellpadding="2" cellspacing="2">
        <tr>
          <td height="131" valign="top" bgcolor="#FFFFFF"> <table width="100%" border="0" cellspacing="3" cellpadding="3">
              <tr>
                <td width="60" rowspan="2" valign="top"> <div align="center"><img src="../account/images/icons/ded_5.gif" width="60" height="58"></div></td>
                <td width="625" height="22"><font size="4">Check Images</font></td>
              </tr>
              <tr>
                <td height="70"><font color="#999999">Member Pictures Information.<br>
                  <br>
                  Needs Checking : <?php echo"$img_needsap"; ?><br>
                  </font> </td>
              </tr>
            </table>
            <div align="center">
              <table width="676" border="0" cellspacing="2" cellpadding="2">
                <tr>
                  <td width="153" valign="top"> <div align="left">
                      <?php

                                                $limit="0,1";

include('include/img_section/img_view.php'); ?>
                    </div></td>
                  <td width="165" valign="top"> <div align="left">
                      <?php

                                                $limit="1,1";

include('include/img_section/img_view.php'); ?>
                    </div></td>
                  <td width="165" valign="top"> <div align="left">
                      <?php

  $startlimit = $startlimit_value + 2;

$endlimit = 1;

include('include/img_section/img_view.php'); ?>
                    </div></td>
                  <td width="167" valign="top"> <div align="left">
                      <?php

  $startlimit = $startlimit_value + 3;

$endlimit = 1;

include('include/img_section/img_view.php'); ?>
                    </div></td>
                </tr>
                <tr>
                  <td colspan="4">&nbsp;</td>
                </tr>
              </table>
              <table width="676" border="0" cellspacing="2" cellpadding="2">
                <tr>
                  <td width="153" valign="top"> <div align="left">
                      <?php

  $startlimit = $startlimit_value + 4;

$endlimit = 1;

include('include/img_section/img_view.php'); ?>
                    </div></td>
                  <td width="165" valign="top"> <div align="left">
                      <?php

  $startlimit = $startlimit_value + 5;

$endlimit = 1;

include('include/img_section/img_view.php'); ?>
                    </div></td>
                  <td width="165" valign="top"> <div align="left">
                      <?php

  $startlimit = $startlimit_value + 6;

$endlimit = 1;

include('include/img_section/img_view.php'); ?>
                    </div></td>
                  <td width="167" valign="top"> <div align="left">
                      <?php

  $startlimit =$startlimit_value + 7;

$endlimit = 1;

include('include/img_section/img_view.php'); ?>
                    </div></td>
                </tr>
                <tr>
                  <td colspan="4">&nbsp;</td>
                </tr>
              </table>
              <table width="676" border="0" cellspacing="2" cellpadding="2">
                <tr>
                  <td width="153" valign="top"> <div align="left">
                      <?php

  $startlimit = $startlimit_value + 8;

$endlimit = 1;

include('include/img_section/img_view.php'); ?>
                    </div></td>
                  <td width="165" valign="top"> <div align="left">
                      <?php

  $startlimit = $startlimit_value + 9;

$endlimit = 1;

include('include/img_section/img_view.php'); ?>
                    </div></td>
                  <td width="165" valign="top"> <div align="left">
                      <?php

  $startlimit =$startlimit_value_ten;

$endlimit = 1;

include('include/img_section/img_view.php'); ?>
                    </div></td>
                  <td width="167" valign="top"> <div align="left"> </div></td>
                </tr>
                <tr>
                  <td colspan="4">&nbsp;</td>
                </tr>
              </table>
            </div>         
            <br> </td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>[/code]
Link to comment
https://forums.phpfreaks.com/topic/28101-image-script-helpplease/
Share on other sites

Here is the included file.

[code]
<?php

// CONSTANTS
$uploaddir = "http://". $GB_WEB["WEB_URL"] ."/upload/pictures/thumbs/";
$imgdir = "include/img_section/";
// Below is the run string

$runstring = "select * from pf_images where img_ck=0 order by img_date limit $limit"; // where img_ck=0

$sql = $runstring;
$result = mysql_query($sql) or die ("couldnt get images error1".$runstring);
$counter = 0;

while ( $row = mysql_fetch_array($result,MYSQL_ASSOC) ) 

// Results for image file
$img_result[1] = $row['imgnum'];
$img_result[2] = $row['imgid'];
$img_result[3] = $row['img_ck'];
$img_result[4] = $row['img_name'];
$img_result[5] = $row['img_alt'];
$img_result[6] = $row['img_size'];
$img_result[7] = $row['img_type'];
$img_result[8] = $row['img_date'];

// Now lets find the users details for this iamge >>
$sql1 = "select distinct * from pf_login  where accountid='$img_result[2]'";
$result1 = mysql_query($sql1) or die ("couldnt get query 2");
$row = mysql_fetch_array($result1, MYSQL_ASSOC);  
 
$profile_login[1] = $row['accountid'];
$profile_login[2] = $row['accountname'];

// Now Lets sort the image value to find if its a link or an upload;

if($img_result[7] == 0){// This is a linked image NOT UPLOADED
  $showdir = "";
  }
  else{
  $showdir = $uploaddir;
  }


// The HTML code for the search table
echo"<form  method='post' action='$imgdir/img_view_update.php?imgid=$img_result[2]&imgnum=$img_result[1]&value=ck_value$img_result[1]'>
  <table width='129' border='0' cellspacing='0' cellpadding='0'>
    <tr>
      <td colspan='2'><a href='$showdir$img_result[4]'><img src='$showdir$img_result[4]' alt='$img_result[5]' width='127' height='107' border='1'></a></td>
    </tr>
    <tr>
      <td colspan='2'><div align='center'><strong><a href='http://www.msgprofiles.co.uk/myaccount_layout.php?membernumber=$profile_login[1]&membername=$profile_login[2]'>$profile_login[2]</a></strong></div></td>
    </tr>
    <tr>
      <td width='32%'>Type</td>
      <td width='68%'><div align='center'>$img_result[7]</div></td>
    </tr>
    <tr>
      <td>Size</td>
      <td><div align='center'>$img_result[6]</div></td>
    </tr>
    <tr>
      <td>Img ID</td>
      <td><div align='center'>$img_result[1]</div></td>
    </tr>
    <tr>
      <td>CK ID</td>
      <td><div align='center'>$img_result[3]</div></td>
    </tr>
    <tr>
      <td colspan='2'>&nbsp;</td>
    </tr>
    <tr>"; $ck0 = ''; $ck1 = ''; $ck2 = ''; if($img_result[3] == 0){ $ck0 = 'checked';
      } elseif ($img_result[3] == 1){ $ck1 = 'checked'; } elseif($img_result[3]
      == 2){ $ck2 = 'checked'; } echo"
      <td colspan='2'><div align='center'>0:
          <input type='radio' name='ck_value' value=0 $ck0>
          1:
          <input type='radio' name='ck_value' value=1 $ck1>
          2:
          <input type='radio' name='ck_value' value=2 $ck2>
        </div></td>
    </tr>
    <tr>
      <td colspan='2'><div align='center'><input name='update' type='submit' id='update' value='Update'>
          <br>
          <a href='$imgdir/img_delete.php?img_num=$img_result[1]'><img src='../../images/button_update.gif' width='97' height='25' border='0' alt=Delete Image></a>
        </div></td>
    </tr>
  </table>
</form>";
$counter = $counter + 1;
} ?>[/code]

I'm not sure what the $counter variable does, because it seems to me that it gets reset everytime the script iterates through.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.