הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   [ UploadSystem ] איך התיכנות של מערכת העלאת תמונות שלי ? (https://hosts.co.il/forums/showthread.php?t=51346)

Kfir.G 04-08-07 19:13

ציטוט:

נכתב במקור על ידי hi_sorie (פרסם 535984)
תודה רבה השתמשתי בפעולה החשבונית של זה.

אני שמח שיכולתי לעזור :)

עכשיו ראיתי שאחרי שמעלים תמונה ורואים אותה יש אפשרות להעלות קובץ נוסף. עדיף בהרבה שתיתן להעלות כמה קבצים במקביל בעמוד הראשי של ההעלאה.

maor 05-08-07 01:48

ציטוט:

נכתב במקור על ידי kfir_dnd (פרסם 535958)
לא נראה לי שהבנת למה הכוונה שהתמונה הקטנה צריכה להיות ביחס לתמונה הקטנה. אם יש לך תמונה בגודל 700X500 ואתה רוצה להקטין את הרוחב שלה ל170 אז כדי לשמור על פרופורציה זה צריך להיות
170X121
לא היה לי כוח להסתבך עם הסבר על איך להגיע לזה ולכן כתבתי לך דוגמה לדרך שבה אתה יכול לעשות את זה
PHP קוד:

<?php
    $img_width
=רוחב התמונה;
    
$img_height=גובה התמונה;
    
$wanted_width=הרוחב הרצוי;
    
$prop=$wanted_width/($img_width/100);
    
$img_height=($img_height*$prop)/100;
    
$img_height=round($img_height);
    echo 
$wanted_width,"X",$img_height;
?>

אתה יכול לעשות את אותו הדבר גם עם הגובה אם אתה צריך...

זה מה שהתכוונתי שתעשה, למרות שזה הכי טוב לעשות ב GD ככה שהוא לא יטען תמונה קטנה בגודל של כמה MB
בהצלחה

Gil B 05-08-07 07:57

העיצוב באתר פשוט לא יפה, אבל הLOADING שבהתחלה יפה, אהבתי :P

YDsecurity 06-08-07 15:35

[QUOTE=YDsecurity;537090]חחחחחחחחחחחחחחח איזו מערכת פריצה אחי יש PHP J בתוך האעלת קבצים בצור קשר ועוד מלא דברים ....

ותגיד יש פה משהו מוזר שמתי לב שיש קבצים שדומים ל IPS


PHP קוד:

<?php

class db_driver {

    var 
$obj = array ( "sql_database"   => ""         ,
                       
"sql_user"       => "root"     ,
                       
"sql_pass"       => ""         ,
                       
"sql_host"       => "localhost",
                       
"sql_port"       => ""         ,
                       
"persistent"     => "0"         ,
                       
"sql_tbl_prefix"        => "ibf_"      ,
                       
"cached_queries" => array(),
                       
'debug'          => 0,
                     );
                     
     var 
$query_id      "";
     var 
$connection_id "";
     var 
$query_count   0;
     var 
$record_row    = array();
     var 
$return_die    0;
     var 
$error         "";
     var 
$failed        0;
                  
    
/*========================================================================*/
    // Connect to the database                 
    /*========================================================================*/  
                   
    
function connect() {
    
        if (
$this->obj['persistent'])
        {
            
$this->connection_id mysql_pconnect$this->obj['sql_host'] ,
                                                   
$this->obj['sql_user'] ,
                                                   
$this->obj['sql_pass'
                                                );
        }
        else
        {
            
$this->connection_id mysql_connect$this->obj['sql_host'] ,
                                                  
$this->obj['sql_user'] ,
                                                  
$this->obj['sql_pass'
                                                );
        }
        
        if ( !
mysql_select_db($this->obj['sql_database'], $this->connection_id) )
        {
            echo (
"ERROR: Cannot find database ".$this->obj['sql_database']);
        }
    }
    
    
    
    
/*========================================================================*/
    // Process a query
    /*========================================================================*/
    
    
function query($the_query$bypass=0) {
        
        
//--------------------------------------
        // Change the table prefix if needed
        //--------------------------------------
        
        
if ($bypass != 1)
        {
            if (
$this->obj['sql_tbl_prefix'] != "ibf_")
            {
               
$the_query preg_replace("/ibf_(\S+?)([\s\.,]|$)/"$this->obj['sql_tbl_prefix']."\\1\\2"$the_query);
            }
        }
        
        if (
$this->obj['debug'])
        {
            global 
$Debug$ibforums;
            
            
$Debug->startTimer();
        }
        
        
$this->query_id mysql_query($the_query$this->connection_id);
      
        if (! 
$this->query_id )
        {
            
$this->fatal_error("mySQL query error: $the_query");
        }
        
        if (
$this->obj['debug'])
        {
            
$endtime $Debug->endTimer();
            
            if ( 
preg_match"/^select/i"$the_query ) )
            {
                
$eid mysql_query("EXPLAIN $the_query"$this->connection_id);
                
$ibforums->debug_html .= "<table width='95%' border='1' cellpadding='6' cellspacing='0' bgcolor='#FFE8F3' align='center'>
                                           <tr>
                                                <td colspan='8' style='font-size:14px' bgcolor='#FFC5Cb'><b>Select Query</b></td>
                                           </tr>
                                           <tr>
                                            <td colspan='8' style='font-family:courier, monaco, arial;font-size:14px;color:black'>$the_query</td>
                                           </tr>
                                           <tr bgcolor='#FFC5Cb'>
                                             <td><b>table</b></td><td><b>type</b></td><td><b>possible_keys</b></td>
                                             <td><b>key</b></td><td><b>key_len</b></td><td><b>ref</b></td>
                                             <td><b>rows</b></td><td><b>Extra</b></td>
                                           </tr>\n"
;
                while( 
$array mysql_fetch_array($eid) )
                {
                    
$type_col '#FFFFFF';
                    
                    if (
$array['type'] == 'ref' or $array['type'] == 'eq_ref' or $array['type'] == 'const')
                    {
                        
$type_col '#D8FFD4';
                    }
                    else if (
$array['type'] == 'ALL')
                    {
                        
$type_col '#FFEEBA';
                    }
                    
                    
$ibforums->debug_html .= "<tr bgcolor='#FFFFFF'>
                                             <td>$array[table]&nbsp;</td>
                                             <td bgcolor='$type_col'>$array[type]&nbsp;</td>
                                             <td>$array[possible_keys]&nbsp;</td>
                                             <td>$array[key]&nbsp;</td>
                                             <td>$array[key_len]&nbsp;</td>
                                             <td>$array[ref]&nbsp;</td>
                                             <td>$array[rows]&nbsp;</td>
                                             <td>$array[Extra]&nbsp;</td>
                                           </tr>\n"
;
                }
                
                if (
$endtime 0.1)
                {
                    
$endtime "<span style='color:red'><b>$endtime</b></span>";
                }
                
                
$ibforums->debug_html .= "<tr>
                                          <td colspan='8' bgcolor='#FFD6DC' style='font-size:14px'><b>mySQL time</b>: $endtime</b></td>
                                          </tr>
                                          </table>\n<br />\n"
;
            }
            else
            {
              
$ibforums->debug_html .= "<table width='95%' border='1' cellpadding='6' cellspacing='0' bgcolor='#FEFEFE'  align='center'>
                                         <tr>
                                          <td style='font-size:14px' bgcolor='#EFEFEF'><b>Non Select Query</b></td>
                                         </tr>
                                         <tr>
                                          <td style='font-family:courier, monaco, arial;font-size:14px'>$the_query</td>
                                         </tr>
                                         <tr>
                                          <td style='font-size:14px' bgcolor='#EFEFEF'><b>mySQL time</b>: $endtime</span></td>
                                         </tr>
                                        </table><br />\n\n"
;
            }
        }
        
        
$this->query_count++;
        
        
$this->obj['cached_queries'][] = $the_query;
        
        return 
$this->query_id;
    }
    
    
    
/*========================================================================*/
    // Fetch a row based on the last query
    /*========================================================================*/
    
    
function fetch_row($query_id "") {
    
        if (
$query_id == "")
        {
            
$query_id $this->query_id;
        }
        
        
$this->record_row mysql_fetch_array($query_idMYSQL_ASSOC);
        
        return 
$this->record_row;
        
    }

    
/*========================================================================*/
    // Fetch the number of rows affected by the last query
    /*========================================================================*/
    
    
function get_affected_rows() {
        return 
mysql_affected_rows($this->connection_id);
    }
    
    
/*========================================================================*/
    // Fetch the number of rows in a result set
    /*========================================================================*/
    
    
function get_num_rows() {
        return 
mysql_num_rows($this->query_id);
    }
    
    
/*========================================================================*/
    // Fetch the last insert id from an sql autoincrement
    /*========================================================================*/
    
    
function get_insert_id() {
        return 
mysql_insert_id($this->connection_id);
    }  
    
    
/*========================================================================*/
    // Return the amount of queries used
    /*========================================================================*/
    
    
function get_query_cnt() {
        return 
$this->query_count;
    }
    
    
/*========================================================================*/
    // Free the result set from mySQLs memory
    /*========================================================================*/
    
    
function free_result($query_id="") {
    
           if (
$query_id == "") {
            
$query_id $this->query_id;
        }
        
        @
mysql_free_result($query_id);
    }
    
    
/*========================================================================*/
    // Shut down the database
    /*========================================================================*/
    
    
function close_db() { 
        return 
mysql_close($this->connection_id);
    }
    
    
/*========================================================================*/
    // Return an array of tables
    /*========================================================================*/
    
    
function get_table_names() {
    
        
$result     mysql_list_tables($this->obj['sql_database']);
        
$num_tables = @mysql_numrows($result);
        for (
$i 0$i $num_tables$i++)
        {
            
$tables[] = mysql_tablename($result$i);
        }
        
        
mysql_free_result($result);
        
        return 
$tables;
       }
       
       
/*========================================================================*/
    // Return an array of fields
    /*========================================================================*/
    
    
function get_result_fields($query_id="") {
    
           if (
$query_id == "")
           {
            
$query_id $this->query_id;
        }
    
        while (
$field mysql_fetch_field($query_id))
        {
            
$Fields[] = $field;
        }
        
        
//mysql_free_result($query_id);
        
        
return $Fields;
       }
    
    
/*========================================================================*/
    // Basic error handler
    /*========================================================================*/
    
    
function fatal_error($the_error) {
        global 
$INFO;
        
        
        
// Are we simply returning the error?
        
        
if ($this->return_die == 1)
        {
            
$this->error    mysql_error();
            
$this->error_no mysql_errno();
            
$this->failed   1;
            return;
        }
        
        
$the_error .= "\n\nmySQL error: ".mysql_error()."\n";
        
$the_error .= "mySQL error code: ".$this->error_no."\n";
        
$the_error .= "Date: ".date("l dS of F Y h:i:s A");
        
        
$out "<html><head><title>Database Error</title>
               <style>P,BODY{ font-family:arial,sans-serif; font-size:11px; }</style></head><body>
               &nbsp;<br><br><blockquote><b>There appears to be an error with the site database.</b><br>
               You can try to refresh the page by clicking <a href=\"javascript:window.location=window.location;\">here</a>, if this
               does not fix the error, you can contact the site administrator by clicking <a href='mailto:sorya@zahav.net.il?subject=SQL+Error'>here</a>
               <br><br><b>Error Returned</b><br>
               <form name='mysql'><textarea rows=\"15\" cols=\"60\">"
.htmlspecialchars($the_error)."</textarea></form><br>We apologise for any inconvenience</blockquote></body></html>";
               
    
        echo(
$out);
        die(
"");
    }
    
    
/*========================================================================*/
    // Create an array from a multidimensional array returning formatted
    // strings ready to use in an INSERT query, saves having to manually format
    // the (INSERT INTO table) ('field', 'field', 'field') VALUES ('val', 'val')
    /*========================================================================*/
    
    
function compile_db_insert_string($data) {
    
        
$field_names  "";
        
$field_values "";
        
        foreach (
$data as $k => $v)
        {
            
$v preg_replace"/'/""\\'"$v );
            
//$v = preg_replace( "/#/", "\\#", $v );
            
$field_names  .= "$k,";
            
$field_values .= "'$v',";
        }
        
        
$field_names  preg_replace"/,$/" "" $field_names  );
        
$field_values preg_replace"/,$/" "" $field_values );
        
        return array( 
'FIELD_NAMES'  => $field_names,
                      
'FIELD_VALUES' => $field_values,
                    );
    }
    
    
/*========================================================================*/
    // Create an array from a multidimensional array returning a formatted
    // string ready to use in an UPDATE query, saves having to manually format
    // the FIELD='val', FIELD='val', FIELD='val'
    /*========================================================================*/
    
    
function compile_db_update_string($data) {
        
        
$return_string "";
        
        foreach (
$data as $k => $v)
        {
            
$v preg_replace"/'/""\\'"$v );
            
$return_string .= $k "='".$v."',";
        }
        
        
$return_string preg_replace"/,$/" "" $return_string );
        
        return 
$return_string;
    }
    
    
/*========================================================================*/
    // Test to see if a field exists by forcing and trapping an error.
    // It ain't pretty, but it do the job don't it, eh?
    // Posh my ass.
    // Return 1 for exists, 0 for not exists and jello for the naked guy
    // Fun fact: The number of times I spelt 'field' as 'feild'in this part: 104
    /*========================================================================*/
    
    
function field_exists($field$table) {
        
        
$this->return_die 1;
        
$this->error "";
        
        
$this->query("SELECT COUNT($field) as count FROM $table");
        
        
$return 1;
        
        if ( 
$this->failed )
        {
            
$return 0;
        }
        
        
$this->error "";
        
$this->return_die 0;
        
$this->error_no   0;
        
$this->failed     0;
        
        return 
$return;
    }
    
// end class


?>


למי שרוצה הנה משתמש ללוח הבקרה :

*צינזרתי

אחי אם אתה לא רוצה שאני אפרסם תגיד לי

hi_sorie 06-08-07 15:45

המחלקה מאוד דומה כי אני עובד עם מחלקה לIB - היא יותר נוחה לי .
ובקשר לחור אבטחה שמצאת אני ישמח אם תיצור עמי קשר , נדבר.

RS324 06-08-07 15:47

ציטוט:

נכתב במקור על ידי hi_sorie (פרסם 537104)
המחלקה מאוד דומה כי אני עובד עם מחלקה לIB - היא יותר נוחה לי .
ובקשר לחור אבטחה שמצאת אני ישמח אם תיצור עמי קשר , נדבר.

יהיה יותר פשוט להגיד שהעתקת אותה לגמרי...

PHP קוד:

$ibforums->debug_html .= "<tr bgcolor='#FFFFFF'>
<td>$array[table]&nbsp;</td>
<td bgcolor='$type_col'>$array[type]&nbsp;</td>
<td>$array[possible_keys]&nbsp;</td>
<td>$array[key]&nbsp;</td>
<td>$array[key_len]&nbsp;</td>
<td>$array[ref]&nbsp;</td>
<td>$array[rows]&nbsp;</td>
<td>$array[Extra]&nbsp;</td>
</tr>\n"



hi_sorie 06-08-07 15:49

ציטוט:

נכתב במקור על ידי RS324 (פרסם 537108)
יהיה יותר פשוט להגיד שהעתקת אותה לגמרי...

PHP קוד:

$ibforums->debug_html .= "<tr bgcolor='#FFFFFF'>
<td>$array[table]&nbsp;</td>
<td bgcolor='$type_col'>$array[type]&nbsp;</td>
<td>$array[possible_keys]&nbsp;</td>
<td>$array[key]&nbsp;</td>
<td>$array[key_len]&nbsp;</td>
<td>$array[ref]&nbsp;</td>
<td>$array[rows]&nbsp;</td>
<td>$array[Extra]&nbsp;</td>
</tr>\n"




מזה יותר פשוט - > אמרתי אני עובד איתה - היא פולטת שגיאות בצורה יותר יפה ...
חוץ מזה אני לא צריך כלום .

YDsecurity 07-08-07 02:32

חחחח הכל גנוב
 
PHP קוד:

SQL Database : ***
SQL Password : ***
SQL Username : *** 

צינזרתי את הפרטים שלא יפרצו לו...
וואה אחי לפני כמה זמן נכתבה המערכת הכל כתוב בצורה כל כך מישונת ! |טוויסט|
אתה בטוח שהמערכת שלך בכלל ?

hi_sorie 07-08-07 12:02

ציטוט:

נכתב במקור על ידי YDsecurity (פרסם 537407)
PHP קוד:

SQL Database : ***
SQL Password : ***
SQL Username : *** 

צינזרתי את הפרטים שלא יפרצו לו...
וואה אחי לפני כמה זמן נכתבה המערכת הכל כתוב בצורה כל כך מישונת ! |טוויסט|
אתה בטוח שהמערכת שלך בכלל ?


כן ב 2005 התחלתי אותה ועזבתי וב 2007 החלטתי לסיים אותה וסיימתי

YDsecurity 07-08-07 15:19

אבל למה לגנוב ..........


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

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