לוגו אתר Fresh          
 
 
  אפשרות תפריט  ראשי     אפשרות תפריט  צ'אט     אפשרות תפריט  מבזקים     אפשרות תפריט  צור קשר     חץ שמאלה ‎print ‎"Hello World!"; if‎ ‎not rules.‎know ‎then rules.‎read(); חץ ימינה  

לך אחורה   לובי הפורומים > מחשבים > תכנות ובניית אתרים
שמור לעצמך קישור לדף זה באתרי שמירת קישורים חברתיים
תגובה
 
כלי אשכול חפש באשכול זה



  #1  
ישן 26-02-2006, 14:39
צלמית המשתמש של Xebu
  Xebu Xebu אינו מחובר  
 
חבר מתאריך: 04.03.05
הודעות: 1,745
שלח הודעה דרך ICQ אל Xebu שלח הודעה דרך MSN אל Xebu
בעיה קטנה בהעלאת תמונות

שלום, יש בעיה קטנה במערכת העלאת תמונות שלי.

יש לי את הקוד הבא:

קוד PHP:
<?php

         
foreach (glob("store/*") as $filename) {?>
            <div align="center"><a href="<?= $filename ?>" target="_blank"><img src="<?= $filename ?>" width="200" height="200" class="img"></a><? echo "<font class='texts'><br>לחץ להגדלה</div><br></font>"; }
         ?> 
<?
if (@phpversion() < '4.1.0') {
    $_FILE = $HTTP_POST_FILES;
    $_GET = $HTTP_GET_VARS;
    $_POST = $HTTP_POST_VARS;
}
clearstatcache();
error_reporting(E_ALL & ~E_NOTICE);
$fum_vers = "1.3"; # do not edit this line, the script will not work!!!
$fum_info_full = "File Upload Manager v$fum_vers";
function authDo($auth_userToCheck, $auth_passToCheck) 
{
global $auth_usern, $auth_passw;
$auth_encodedPass = md5($auth_passw);
 
if ($auth_userToCheck == $auth_usern && $auth_passToCheck == $auth_encodedPass) {
$auth_check = TRUE;
} else {
$auth_check = FALSE;

return $auth_check;
}
 
if (isset($logout)) {
setcookie ('fum_user', "",time()-3600); 
setcookie ('fum_pass', "",time()-3600);
}
 
if (isset($login)) {
$auth_password_en = md5($auth_formPass); 
$auth_username_en = $auth_formUser;
if (authDo($auth_username_en, $auth_password_en)) { 
setcookie ('fum_user', $auth_username_en,time()+3600); 
setcookie ('fum_pass', $auth_password_en,time()+3600); 
$auth_msg = "<b>Authentication successful!</b> The cookies have been set.<br><br>".
$auth_msg . "Your password (MD5 encrypted) is: $auth_password_en";
} else { 
$auth_msg = "<b>Authentication error!</b>";
}
}
if (($_GET[act]=="dl")&&$_GET[file]) 
{
if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && isset($fum_user) && !isset($logout))) { 
if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && authDo($fum_user, $fum_pass))) {
$value_de=base64_decode($_GET[file]);
$dl_full=$dir_store."/".$value_de;
$dl_name=$value_de;
if (!file_exists($dl_full))

echo"ERROR: Cannot download file, it does not exist.<br>»<a href=\"$_SERVER[PHP_SELF]\">back</a>"; 
exit();

 
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$dl_name");
header("Content-Length: ".filesize($dl_full));
header("Accept-Ranges: bytes");
header("Pragma: no-cache");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-transfer-encoding: binary");
 
@readfile($dl_full);
 
exit();
}
}
}
function getlast($toget)
{
$pos=strrpos($toget,".");
$lastext=substr($toget,$pos+1);
return $lastext;
}
function replace($o)
{
$o=str_replace("/","",$o);
$o=str_replace("\\","",$o);
$o=str_replace(":","",$o);
$o=str_replace("*","",$o);
$o=str_replace("?","",$o);
$o=str_replace("<","",$o);
$o=str_replace(">","",$o);
$o=str_replace("\"","",$o);
$o=str_replace("|","",$o);
 
return $o;
}
?>
<!-- <?=$fum_info_full?> -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="smallvillehighcss.css" type="text/css">
<?
if ($auth_ReqPass == 1) 

if (isset($login) || isset($logout)) {
echo("<meta http-equiv='refresh' content='2;url=$_SERVER[PHP_SELF]'>");
}
}
?>
</head>
<body bgcolor="#ffffff"><br><br>
<center>
<? 
if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && isset($fum_user) && !isset($logout))) { 
if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && authDo($fum_user, $fum_pass))) {
?>
<?
if (!eregi("777",decoct(fileperms($dir_store))))
{
echo"<br><br><b><h4><font color=\"FF0000\">ERROR: cannot access the upload store file directory. please chmod the \"$dir_store\" directory with value 0777 (xrw-xrw-xrw)!</h4></font></b><br>»<a href=\"$_SERVER[PHP_SELF]\">refresh</a>";
}
else
{
if (!$_FILES[fileupload])
{
?>
<div align="right"><font class="headline3"><?= $note['upload']; ?></font></div>
<table width="560" cellspacing="0" cellpadding="0" border="0" class="img" style="padding-top:5px;padding-left=5px;padding-bottom:5px;padding-right:5px">
<form method="post" enctype="multipart/form-data">
<tr>
    <td><font class="texts">קובץ:</font></td><td><input type="file" name="fileupload" class="textfield" size="30"></td>
</tr>
<tr>
    <td><font class="texts">סוגי קבצים מותרים:</font></td><td>
<?
for($i=0;$i<count($file_ext_allow);$i++)
{
if (($i<>count($file_ext_allow)-1))$commas=", ";else $commas="";
list($key,$value)=each($file_ext_allow);
echo "<font class='texts'>$value.$commas</font>";
}
?>
    </td>
</tr>
<tr>
    <td><font class="texts">הגבלת גודל קובץ:</font></td>
<td>
<b><?
if ($file_size_ind >= 1048576) 
{
    $file_size_ind_rnd = round(($file_size_ind/1024000),3) . " MB";

elseif ($file_size_ind >= 1024) 

    $file_size_ind_rnd = round(($file_size_ind/1024),2) . " KB";

elseif ($file_size_ind >= 0) 
{
    $file_size_ind_rnd = $file_size_ind . " bytes";

else 
{
    $file_size_ind_rnd = "0 bytes";
}
 
echo "<font class='texts'>$file_size_ind_rnd</font>";
?></b>
</td>
</tr>
<tr>
    <td colspan="2"><input type="submit" value="תעלה" class="button">&nbsp;<input type="reset" value="נקה" class="button"></td>
</tr>
</form>
</table>
<?
if ((!$_GET[act]||!$_GET[file])&&$_GET[act]!="delall")
{
$opendir = @opendir($dir_store);
while ($readdir = @readdir($opendir))
{
    if ($readdir<>"." && $readdir<>".." && $readdir != "index.html")
    {
     $filearr[] = $readdir;
    }
    $sort=array();
    for($i=1;$i<=count($filearr);$i++)
    {
     $key = sizeof($filearr)-$i;
     $file = $filearr[$key];
     $sort[$i]=$file;
    }
    asort($sort);
}
?>
<br>
<br>
<? 
if ($file_list_allow == 1 && (count($filearr) >= 1)) 
{
?>
<table width="560" cellspacing="0" cellpadding="0" border="0" class="table_decoration" style="padding-left:6px">
<tr bgcolor="#DBDBDB">
    <td align="left" width="46%">FILE NAME</td>
    <td align="center" width="12%">FILE TYPE</td>
    <td align="center" width="12%">FILE SIZE</td>
    <td align="center" width="30%">FUNCTIONS</td>
</tr>
<?
    for($i=1;$i<=count($sort);$i++)
    {
     list($key,$value)=each($sort);
     if ($value)
     {
     $value_en = base64_encode($value);
     $value_view=$value;
 
     if (strlen($value) >= 48) 
     { 
        $value_view = substr($value_view, 0, 45) . '...';
     }
?>
<tr>
    <td width="30%"><?="<a href=\"?act=view&file=$value_en\">$value_view</a>"?></td>
    <td align="center" width="5%"><? echo strtoupper(getlast($value)); ?></td>
    <td align="center" width="5%"><?
     $value_full = $dir_store."/".$value;
     $file_size = filesize($value_full);
 
if ($file_size >= 1048576) 
{
$show_filesize = number_format(($file_size / 1048576),2) . " MB";

elseif ($file_size >= 1024) 
{
$show_filesize = number_format(($file_size / 1024),2) . " KB";

elseif ($file_size >= 0) 
{
$show_filesize = $file_size . " bytes";

else 
{
$show_filesize = "0 bytes";
}
echo "$show_filesize";
 
?></td>
    <td align="center" width="5%"><?="<a title=\"View File\" href=\"?act=view&file=$value_en\">&lt;view&gt;</a>"?> | 
<?
if ($file_del_allow == 1) 

echo"<a title=\"Download file\" href=\"?act=dl&file=$value_en\">&lt;dl&gt;</a>";

else 

echo"<a title=\"Download file\" href=\"?act=dl&file=$value_en\">&lt;download&gt;</a>"; 

if ($file_del_allow == 1) 

echo"&nbsp;|&nbsp;<a title=\"Delete file\" href=\"javascript:;\" onClick=\"cf=confirm('Are you sure you want to delete this file?');if (cf)window.location='?act=del&file=$value_en'; return false;\">&lt;delete&gt;</a>";

else 

echo"&nbsp;"; 

?>
    </td>
</tr>
<?
    }
    else
    {
     echo"<br>";
    }
    }
?>
</table></center>
<?
}
}
elseif (($_GET[act]=="view")&&$_GET[file])
{
$value_de = base64_decode($_GET[file]);
echo"<script language=\"javascript\">\nViewPopup = window.open(\"$dir_store/$value_de\", \"fum_viewfile\", \"toolbar=no,status=no,menubar=no,scrollbars=yes,res  izable=yes,location=no,width=640,height=480\")\nViewPopup.document.bgColor=\"#F7F7F7\"\nViewPopup.document.close()\n</script>";
echo"<br><img src=\"$dir_img/info.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">file opened!</font></b><br>»<a href=\"$_SERVER[PHP_SELF]\">back</a><br><br><br>If the file did not display, you must <b>disable</b> your popup manager, or enable javascript in your browser.";
}
elseif (($_GET[act]=="del")&&$_GET[file])
{
$value_de = base64_decode($_GET[file]);
@unlink($dir_store."/$value_de");
echo"<br><img src=\"$dir_img/info.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">file has been deleted!</font></b><br>»<a href=\"$_SERVER[PHP_SELF]\">back</a>";
}
if ($_GET[act]=="delall")
{
$handle = opendir($dir_store);
while($file=readdir($handle))
if (($file != ".")&&($file != ".."))
@unlink($dir_store."/".$file);
closedir($handle);
echo"<br><img src=\"$dir_img/info.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">all files have been deleted!</font></b><br>»<a href=\"$_SERVER[PHP_SELF]\">back</a>";
}
}
else
{
echo"<br><br>";
$uploadpath=$dir_store."/";
$source=$_FILES[fileupload][tmp_name];
$fileupload_name=$_FILES[fileupload][name];
$weight=$_FILES[fileupload][size];
for($i=0;$i<count($file_ext_allow);$i++)
{
if (getlast($fileupload_name)!=$file_ext_allow[$i])
    $test.="~~";
}
$exp=explode("~~",$test);
if (count($exp)==(count($file_ext_allow)+1))
{
echo"<br><img src=\"$dir_img/error.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">ERROR: your file type is not allowed (".getlast($fileupload_name).")</font>, or you didn't specify a file to upload.</b><br>»<a href=\"$_SERVER[PHP_SELF]\">back</a>";
}
else
{
if ($weight>$file_size_ind)
{
    echo"<br><img src=\"$dir_img/error.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">ERROR: please get the file size less than ".$file_size_ind." BYTES (".round(($file_size_ind/1024),2)." KB)</font></b><br>»<a href=\"$_SERVER[PHP_SELF]\">back</a>";
}
else
{
    foreach($_FILES[fileupload] as $key=>$value)
    {
     echo"<font color=\"#3399FF\">$key</font> : $value <br>";
    }
    echo "<br>";
    $dest = ''; 
    if (($source != 'none') && ($source != '' ))
    {
     $dest=$uploadpath.$fileupload_name;
     if ($dest != '')
     {
     if (file_exists($uploadpath.$fileupload_name))
     {
     echo"<br><img src=\"$dir_img/error.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">ERROR: that file has already been uploaded before, please choose another file</font></b><br>»<a href=\"$_SERVER[PHP_SELF]\">back</a>";
     }
     else
     {
     if (copy($source,$dest))
     {
        if ($_POST[rename])
        {
         $_POST[rename]=replace($_POST[rename]);
         $exfile=explode(".",$fileupload_name);
 
         if (@rename("$dir_store/$fileupload_name","$dir_store/$_POST[rename].".getlast($fileupload_name))) 
         {
         echo"<br><img src=\"$dir_img/info.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">file has been renamed to $_POST[rename].".getlast($fileupload_name)."!</font></b></font><br>";
         }
        }
        echo"<br><img src=\"$dir_img/info.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">file has been uploaded!</font></b><br>»<a href=\"$_SERVER[PHP_SELF]\">back</a>";
     }
     else
     {
        echo"<br><img src=\"$dir_img/error.gif\" width=\"15\" height=\"15\">&nbsp;<b><font size=\"2\">ERROR: cannot upload, please chmod the dir to 777</font></b><br>»<a href=\"$_SERVER[PHP_SELF]\">back</a>";
     }
     }
     }
    }
}
}
}
}
</html>


למי שאין כוח לקרוא את הכל, זה בעיקרון מעלה את התמונה לתקייה ואז מוציא את תמונות משם (ביקשתי לזה עזרה שבוע שעבר אם מישהו זוכר) ועכשיו יש לי שאלה, יש אפשרות אישזהי שנגיד ברגע שהתמונות עוברות נגיד מעל 10, אז נוצר עוד עמוד והתמונות ממשיכות שם. ואז אחרי עוד 10 נוצר עוד עמוד.. וכך האלה? ואם כן, אז מישהו יכול להגיד לי איך אולי?
ועוד דבר אחד, כרגע התמונות יוצאות כך:
תמונה שהועלתה על ידי גולש באתר ולכן אין אנו יכולים לדעת מה היא מכילה
(תמונה מתחת לתמונה וכולם בגודל קבוע)

ואני רוצה שהם יצאו ככה:
תמונה שהועלתה על ידי גולש באתר ולכן אין אנו יכולים לדעת מה היא מכילה
(תמונה ליד תמונה)

מישהו יודע איך אפשר לעשות את זה? :[
_____________________________________
תמונה שהועלתה על ידי גולש באתר ולכן אין אנו יכולים לדעת מה היא מכילה
Nikon D50 | Sigma 70-200mm F/2.8 APO EX HSM | Sigma 10-20mm F/4-5.6 EX DC HSM | Nikkor 50mm F/1.8D | Nikon SB-800
*מי שלוקח תגובות אלה ברצינות, עושה זאת על אחריותו בלבד!*

תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
תגובה

כלי אשכול חפש באשכול זה
חפש באשכול זה:

חיפוש מתקדם
מצבי תצוגה דרג אשכול זה
דרג אשכול זה:

מזער את תיבת המידע אפשרויות משלוח הודעות
אתה לא יכול לפתוח אשכולות חדשים
אתה לא יכול להגיב לאשכולות
אתה לא יכול לצרף קבצים
אתה לא יכול לערוך את ההודעות שלך

קוד vB פעיל
קוד [IMG] פעיל
קוד HTML כבוי
מעבר לפורום



כל הזמנים המוצגים בדף זה הם לפי איזור זמן GMT +2. השעה כעת היא 04:50

הדף נוצר ב 0.09 שניות עם 12 שאילתות

הפורום מבוסס על vBulletin, גירסא 3.0.6
כל הזכויות לתוכנת הפורומים שמורות © 2024 - 2000 לחברת Jelsoft Enterprises.
כל הזכויות שמורות ל Fresh.co.il ©

צור קשר | תקנון האתר