View Single Post
ישן 26-12-06, 16:47   # 3
opsite
משתמש תחת חוזה ניסיון
 
מיני פרופיל
תאריך הצטרפות: Jun 2006
גיל: 35
הודעות: 1,854
שלח הודעה באמצעות ICO אל opsite

opsite לא מחובר  

PHP קוד:
<?php

 
<center><table style="margin-top:20px;width:790px;height:274px;"><tr><td style="border:1px #AAAAAA solid;height:100%;background-color:#FFFFFF;padding:20px;text-align:center;" valign=top>

<?
include 
"config2.php";

if (!isset(
$HTTP_POST_FILES['userfile'])) exit;

if (
is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) {

if (
$HTTP_POST_FILES['userfile']['size']>$max_size) {
        echo 
"<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">File Size too Big!</font><br>\n"; exit; }
if ((
$HTTP_POST_FILES['userfile']['type']=="image/gif") || ($HTTP_POST_FILES['userfile']['type']=="image/pjpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/jpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/png")) {

        if (
file_exists("./".$path $HTTP_POST_FILES['userfile']['name'])) {
                echo 
"<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">שם הקובץ קיים כבר.</font><br>\n"; exit; }

//generate random number
$zufall rand(123,999999);
$fupl "$zufall";
$imgtext $zufall .$HTTP_POST_FILES['userfile']['name'];
$userip $_SERVER['REMOTE_ADDR'];
$time time();

        
$res copy($HTTP_POST_FILES['userfile']['tmp_name'], "./".$path .$fupl .$HTTP_POST_FILES['userfile']['name']);

        if (!
$res) { echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">העלאת התמונה נכשלה , נא נסה שנית</font><br>\n"; exit; } else {
    
$filelist fopen("./imgfiles/".$imgtext.".txt","w");
    
fwrite($filelist"images/" ."|".$imgtext."|"$zufall ."|"$userip ."|"$time."|\n"); 
        
?>
<br>

<?
$domst 
"";
$drecks "/";
$imgf $fupl.$HTTP_POST_FILES['userfile']['name'];
$thbf $tpath.$imgf;
$urlf $domst .$domain .$drecks .$path .$imgf;


//create thumbnails
function createthumb($name,$filename,$new_w,$new_h){
    
$system=explode('.',$name);
    if (
preg_match('/jpg|jpeg|JPG/',$system[1])){
        
$src_img=imagecreatefromjpeg($name);
    }
    if (
preg_match('/png|PNG/',$system[1])){
        
$src_img=imagecreatefrompng($name);
    }
    if (
preg_match('/gif|GIF/',$system[1])){
        
$src_img=imagecreatefromgif($name);
    }

$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
if (
$old_x $old_y) {
    
$thumb_w=$new_w;
    
$thumb_h=$old_y*($new_h/$old_x);
}
if (
$old_x $old_y) {
    
$thumb_w=$old_x*($new_w/$old_y);
    
$thumb_h=$new_h;
}
if (
$old_x == $old_y) {
    
$thumb_w=$new_w;
    
$thumb_h=$new_h;
}

$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
    
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); 


if (
preg_match("/png/",$system[1]))
{
    
imagepng($dst_img,$filename); 

if (
preg_match("/gif/",$system[1]))
{
    
imagegif($dst_img,$filename);
}
else {
    
imagejpeg($dst_img,$filename); 
}
imagedestroy($dst_img); 
imagedestroy($src_img); 
}

createthumb($path.$imgf,$tpath.$imgf,$tsize,$tsize);
?>


<table class="table_decoration" align="center" border="0" cellpadding="5" cellspacing="0" width="760"><tbody><tr><td><br>
    <div align="center">
        <table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td valign="bottom">
</td><td width="20">&nbsp;</td><td valign="top"><p>&nbsp;</p>
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td><br><center><a href='viewer.php?id=<? echo $imgf?>'><img src='<? echo $thbf ?>' border="0"></a></center>
</td><td width="10">&nbsp;</td><td>



                
</td></tr></tbody></table></td></tr></tbody></table></div>
    <p align="center">
    <br>
    &nbsp;<input name="thetext" type="text" id="thetext" style="width: 500px;" onClick="highlight(this);" value="<? echo $urlf?>" size="70"><br><br>


</td></tr></tbody></table><div class="links" align="center">
</div>
</body></html></tr>
<?

}
} else { echo 
"<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">סוג קובץ לא נתמך</font><br>\n"; exit; }
}
?>
</table>
<br><br>

</center></td></tr></table><p style="margin:3px;text-align:center">
__________________
צחי אוחיון , מתכנת אתרים , בונה אתרים , קידוד אתרים .
Php - Html - Css - Js
פרטים נוספים : 052-5-819366 -> eMail - zahiohayon@gmail.com
העלאת קבצים|מזרחית|סינגלים
  Reply With Quote