Current location: Hot Scripts Forums » General Community » Script Requests » User Image Upload Script


User Image Upload Script

Reply
  #11 (permalink)  
Old 07-15-08, 09:16 PM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Do you still need a program that will fetch the data from the database and allow you to read it?
__________________
Jerry Broughton
Reply With Quote
  #12 (permalink)  
Old 07-15-08, 09:34 PM
Phrozen44 Phrozen44 is offline
Newbie Coder
 
Join Date: Jul 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
If it would not be to much trouble for you then sure, why not? While I can read the data in the database itself, a program to speed it up sure would be welcomed. Thanks again! -Phrozen44
Reply With Quote
  #13 (permalink)  
Old 07-16-08, 12:15 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Ok, here is a simple viewer with a paging system built in.
This will allow you to flip through the records.
I included a reset in case you want to reset it back to the beginning.

This program uses $_SESSION arrays to store the records, so it only queries the database once.

Use the reset to force the database to be queried again and reset the pointer ($ct) to the first record.

Copy and save this program with a file name like viewer.php

Then ftp it to your site in the same location as the other program.

Then you can use it by typing in you web address and viewer.php.

Example: http://YourWebAddress.com/viewer.php

PHP Code:

<?php session_start(); ?>
<html>
<head>
<title></title>
<style>
table
{
 background:#fafafa;
 color:#3399cc;
 width:750px;
 }
.no_border
{
 border:0px;
 }
</style>
</head>
<body>
<?php
if(!empty($_GET["rst"])){unset($_SESSION["name"]);}
if(empty(
$_SESSION["name"]))
{
 
$ct 0;
 
// Insert the values for these variables //
 
$server   ""// MySql server         *required*
 
$username ""// MySQL username       *required*
 
$password ""// MySQL password       *optional*
 
$dbname   ""// MySQL database name  *required*
 
$table    ""// MySql table name     *required*
 
$path     "images/";
 
//////////////////////////////////////////
 
mysql_connect($server,$username,$password) or die("Could not connect to server ".mysql_error());
 
mysql_select_db($dbname) or die(mysql_error());
 
$results mysql_query("SELECT * FROM $table") or die(mysql_error());
 if(
$results)
 {
  while(
$row mysql_fetch_assoc($results))
  {
   
$_SESSION["name"][] = $row["name"];
   
$_SESSION["basename"][] = str_replace($path,"",$row["name"]);
   
$_SESSION["size"][] = $row["size"];
   
$_SESSION["width"][] = $row["width"];
   
$_SESSION["height"][] = $row["height"];
   
$_SESSION["mime_type"][] = $row["mime_type"];
   
$_SESSION["comments"][] = $row["comments"];
   }
  }
 
mysql_free_result($results);
 
mysql_close();
 }
if(!empty(
$_GET["action"]))
{
 
$ct $_GET["action"] == "prev" $_GET["ct"] - $_GET["ct"] + 1;
 if(
$ct 0){$ct 0;}
 if(
$ct>=count($_SESSION["name"])){$ct count($_SESSION["name"]) - 1;}
 }
$p $ct != "Prev" "";
$n $ct count($_SESSION["name"]) - "Next" "";
echo 
"<table border='1'>
       <tr><td colspan='5' align='center'><img src='"
.$_SESSION["name"][$ct]."' width='".$_SESSION["width"][$ct]."' height='".$_SESSION["height"][$ct]."' /></td></tr>
       <tr><td align='center'>"
.$_SESSION["basename"][$ct]."</td><td align='center'>Width - ".$_SESSION["width"][$ct]."px</td><td align='center'>Height - ".$_SESSION["height"][$ct]."px</td><td align='center'>Size - ".$_SESSION["size"][$ct]."</td><td align='center'>Mime - ".$_SESSION["mime_type"][$ct]."</td></tr>
       <tr><td colspan='5' align='center'>"
.$_SESSION["comments"][$ct]."</td></tr>
       <tr><td class='no_border' align='center'><a href='?ct=
$ct&action=prev'>$p</a></td><td class='no_border' colspan='3' align='center'><a href='?rst=reset'>Reset</a></td><td class='no_border' align='center'><a href='?ct=$ct&action=next'>$n</a></td></tr>
      </table>"
;
?>
</body>
</html>
__________________
Jerry Broughton

Last edited by job0107; 07-16-08 at 12:33 AM.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
image upload getfilesize Deansatch PHP 5 04-02-08 05:44 AM
Image Gallery + User Fields interfx Script Requests 0 04-08-06 12:57 PM
Image Hosting Script, Willing To Pay $$$ ObliviatorKK Job Offers & Assistance 0 01-01-05 05:04 PM
upload script which copys image name in db marky7890 PHP 1 05-18-04 05:17 PM
Help with my upload script TheMetsAreBad PHP 2 12-04-03 06:10 PM


All times are GMT -5. The time now is 09:19 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.