הרשם שאלות ותשובות רשימת חברים לוח שנה הודעות מהיום

חזור   הוסטס - פורום אחסון האתרים הגדול בישראל > עיצוב גראפי, תכנות על כל שפותיו וקידום ושיווק אתרים > פורום תיכנות

   
|!|

 
 
כלים לאשכול תצורת הצגה
Prev הודעה קודמת   הודעה הבאה Next
ישן 25-07-06, 16:18   # 10
-VladK-
הוסטסניון
 
-VladK-'s Avatar
 
מיני פרופיל
תאריך הצטרפות: Apr 2006
גיל: 35
הודעות: 2,182

-VladK- לא מחובר  

ציטוט:
נכתב במקור על ידי drowkid
http://il.php.net/manual/he/function.file-exists.php
יש שם מלאה פונקציות... שאנשים כתבו... קרא אותם

עריכה:
אתה יודע יש לחצן בשם "ערוך" תישתמש בו...
תודה...אההההם יש לי עם זה בעיה
עשיתי בדיקה והכל ותראה איזה "יופי"
http://myrand.net/new/img.php?id=1

הנה הקובץ IMG:
PHP קוד:
<?
if(isset($_GET['id'])) {
    if(
is_numeric($_GET['id'])) {
        include 
'func.php';
        include 
'db.php';
        
$id = $_GET['id'];
        
$id = intval($id);
        
$select = mysql_query("SELECT * FROM `banners` WHERE `mid`='$id' ORDER BY rand()") or die(mysql_error());
        
$count = mysql_num_rows($select);
        if(
$count != 0) {
            
$select = mysql_fetch_assoc($select);
            
$url = $select['url'];
            if(
url_exists($url)) {
                
$fParts = explode(".", $url);
                
$ext = $fParts[count($fParts)-1];
                if(
$ext == "gif") {
                    
$image = imagecreatefromgif ($url);
                } elseif(
$ext == "jpg") {
                    
$image = imagecreatefromjpeg ($url);
                } elseif(
$ext == "jpeg") {
                    
$image = imagecreatefromjpeg ($url);
                } elseif(
$ext == "png") {
                    
$image = imagecreatefrompng ($url);
                }
                
$back_color = imageColorAllocate($image, 255, 255, 255);
                
$draw_color = imagecolorallocate($image, 255, 255, 255);
                
imagerectangle($image, 0, 0, imagesx($image) - 0,
                    
imagesy($image) - 0, $draw_color);
                if(
$ext == "gif") {
                    
header('Content-Type: image/gif');
                    
imagegif($image);
                } elseif(
$ext == "jpg") {
                    
header('Content-Type: image/jpeg');
                    
imagejpeg($image);
                } elseif(
$ext == "jpeg") {
                    
header('Content-Type: image/jpeg');
                    
imagejpeg($image);
                } elseif(
$ext == "png") {
                    
header('Content-Type: image/png');
                    
imagepng($image);
                }
                
imageDestroy($image);
            } else {
                
nopic();
            }
        } else {
            
nopic();
        }
    } else {
        
nopic();
    }
} else {
    
nopic();
}
function 
nopic() {
    
$url = 'http://myrand.net/nopic.gif';
    
$image = imagecreatefromgif ($url);
    
$back_color = imageColorAllocate($image, 255, 255, 255);
    
$draw_color = imagecolorallocate($image, 255, 255, 255);
    
imagerectangle($image, 0, 0, imagesx($image) - 0,
    
imagesy($image) - 0, $draw_color);
    
header('Content-Type: image/gif');
    
imagegif($image);
    
imageDestroy($image);
}
?>
הקובץ FUNC:
PHP קוד:
<?php
function url_exists($url) {
    
$a_url = parse_url($url);
    if (!isset(
$a_url['port'])) $a_url['port'] = 80;
    
$errno = 0;
    
$errstr = '';
    
$timeout = 30;
    if(isset(
$a_url['host']) && $a_url['host']!=gethostbyname($a_url['host'])) {
        
$fid = fsockopen($a_url['host'], $a_url['port'], $errno, $errstr, $timeout);
        if (!
$fid) return false;
        
$page = isset($a_url['path'])  ?$a_url['path']:'';
        
$page .= isset($a_url['query'])?'?'.$a_url['query']:'';
        
fputs($fid, 'HEAD '.$page.' HTTP/1.0'."\r\n".'Host: '.$a_url['host']."\r\n\r\n");
        
$head = fread($fid, 4096);
        
fclose($fid);
        return 
preg_match('#^HTTP/.*\s+[200|302]+\s#i', $head);
    } else {
        return 
false;
    }
}
?>

Last edited by -VladK-; 25-07-06 at 17:26..
 
 

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 


חוקי פירסום
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 מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 17:37.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ