Beiträge von andy78
-
-
auf http://hn.vc gibts 5 GB kostenlosen space mit php5, mysql, pop3, smtp, ftp, subdomains, alias domains, auf wunsch TopLevelDomains (kostenpflichtig) und vielem mehr.
-
Hallo ihr lieben,
nach der umstellung auf php5 funktioniert der upload nicht mehr.
Kann evtl. jemand helfen?GUI_SOFTWARE_DEPOT_DIR verweist auf /srv/www/ispcp/gui/software (die Rechte sind korrekt)
PHP
Alles anzeigenfunction formatFilesize($byte) { $string = "Byte"; if($byte>1024) { $byte/=1024; $string="KB"; } if($byte>1024) { $byte/=1024; $string="MB"; } if($byte>1024) { $byte/=1024; $string="GB"; } if(number_format($byte,0)!=$byte) $byte=number_format($byte,2); return $byte." ".$string; } if (isset($_POST['Button'])) { $success = 1; if ($_FILES['sw_file']['name'] != '' AND !empty($_POST['sw_wget'])) { set_page_message(tr('You have to choose between file-upload and wget-function.')); $success = 0; } elseif ($_FILES['sw_file']['name'] == '' AND empty($_POST['sw_wget'])) { set_page_message(tr('You must select a file to upload/download.')); $success = 0; } else { if ($_FILES['sw_file']['name'] && $_FILES['sw_file']['name'] != "none") { if (substr($_FILES['sw_file']['name'], -7) != '.tar.gz') { set_page_message(tr('File needs to be a .tar.gz-archive')); $success = 0; } $file = 0; } else { if (substr($_POST['sw_wget'], -7) != '.tar.gz') { set_page_message(tr('File needs to be a .tar.gz-archive')); $success = 0; } $file = 1; } } if ($success == 1) { $user_id = $_SESSION['user_id']; $upload = 1; if($file == 0) { $fname = $_FILES['sw_file']['name']; } elseif($file == 1) { $fname = substr($_POST['sw_wget'], (strrpos($_POST['sw_wget'], '/')+1)); } $filename = substr($fname, 0, -7); $extension = substr($fname, -7); $query=" INSERT INTO `web_software` ( `reseller_id`, `software_name`, `software_version`, `software_language`, `software_type`, `software_db`, `software_archive`, `software_installfile`, `software_prefix`, `software_link`, `software_desc`, `software_active`, `software_status`, `software_depot` ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) "; $rs = exec_query($sql, $query, array($user_id, "waiting_for_input", "waiting_for_input", "waiting_for_input", "waiting_for_input", "0", $filename, "waiting_for_input", "waiting_for_input", "waiting_for_input", "waiting_for_input", "1", "toadd", "yes")); $sw_id = $sql->Insert_ID(); if ($file == 0) { $dest_dir = $cfg->GUI_SOFTWARE_DEPOT_DIR.'/'.$filename.'-'.$sw_id.$extension; if (!is_dir($cfg->GUI_SOFTWARE_DEPOT_DIR)) { @mkdir($cfg->GUI_SOFTWARE_DEPOT_DIR,0755,true); } if (!move_uploaded_file($_FILES['sw_file']['tmp_name'], $dest_dir)) { // Delete software entry $query = "DELETE FROM `web_software` WHERE `software_id` = ?"; exec_query($sql, $query, array($sw_id)); $sw_wget = ""; set_page_message(tr('ERROR: Could not upload file. Max. upload filesize (%1$d MB) reached?', ini_get('upload_max_filesize'))); $upload = 0; } } if ($file == 1) { $sw_wget = $_POST['sw_wget']; $dest_dir = $cfg->GUI_SOFTWARE_DEPOT_DIR.'/'.$filename.'-'.$sw_id.$extension; // Reading filesize $parts = parse_url($sw_wget); $connection = fsockopen($parts['host'],80,$errno,$errstr,30); if($connection) { fputs($connection,"GET ".$sw_wget." HTTP/1.1\r\nHost: ".$parts['host']."\r\n\r\n"); $size = 0; while(!isset($length) || ($size <= 500 && !feof($connection))) { $tstr = fgets($connection,128); $size += strlen($tstr); if(substr($tstr,0,14) == 'Content-Length') { $length = substr($tstr,15); } } if($length) { $remote_file_size = $length; } else { $remote_file_size = 0; } $show_remote_file_size = formatFilesize($remote_file_size); if($remote_file_size < 1){ // Delete software entry $query = "DELETE FROM `web_software` WHERE `software_id` = ?"; exec_query($sql, $query, array($sw_id)); $show_max_remote_filesize = formatFilesize($cfg->MAX_REMOTE_FILESIZE); set_page_message(tr('ERROR: Your remote filesize (%1$d B) is lower than 1 Byte. Please check your URL!', $show_remote_file_size)); $upload = 0; } elseif($remote_file_size > $cfg->MAX_REMOTE_FILESIZE) { // Delete software entry $query = "DELETE FROM `web_software` WHERE `software_id` = ?"; exec_query($sql, $query, array($sw_id)); $show_max_remote_filesize = formatFilesize($cfg->MAX_REMOTE_FILESIZE); set_page_message(tr('ERROR: Max. remote filesize (%1$d MB) is reached. Your remote file ist %2$d MB', $show_max_remote_filesize, $show_remote_file_size)); $upload = 0; } else { $remote_file = @file_get_contents($sw_wget); if($remote_file) { $output_file = fopen($dest_dir,'w+'); fwrite($output_file,$remote_file); fclose($output_file); } else { // Delete software entry $query = "DELETE FROM `web_software` WHERE `software_id` = ?"; exec_query($sql, $query, array($sw_id)); set_page_message(tr('ERROR: Remote File not found!')); $upload = 0; } } }else{ // Delete software entry $query = "DELETE FROM `web_software` WHERE `software_id` = ?"; exec_query($sql, $query, array($sw_id)); set_page_message(tr('ERROR: Could not upload file. File not found!')); $upload = 0; } } if ($upload == 1) { $tpl->assign( array( 'VAL_WGET' => '' ) ); send_request(); set_page_message(tr('File was successfully uploaded.')); } else { $tpl->assign( array( 'VAL_WGET' => $sw_wget ) ); } } else { $tpl->assign( array( 'VAL_WGET' => $_POST['sw_wget'] ) ); } } else { $tpl->assign( array( 'VAL_WGET' => '' ) ); } // Begin function block function get_avail_software (&$tpl, &$sql) { $query=" SELECT a.`software_id` as id, a.`software_name` as name, a.`software_version` as version, a.`software_language` as language, a.`software_type` as type, a.`software_desc` as description, a.`reseller_id`, b.`admin_id`, b.`admin_name` as reseller FROM `web_software` a, `admin` b WHERE a.`software_active` = 0 AND a.`reseller_id` = b.`admin_id` AND a.software_depot = 'no' ORDER BY a.`reseller_id` ASC, a.`software_type` ASC, a.`software_name` ASC "; $rs = exec_query($sql, $query, array()); if ($rs->RecordCount() > 0) { while(!$rs->EOF) { $import_url = "software_import.php?id=".$rs->fields['id']; $act_url = "software_activate.php?id=".$rs->fields['id']; $del_url = "software_delete.php?id=".$rs->fields['id']; $dow_url = "software_download.php?id=".$rs->fields['id']; $tpl->assign( array( 'TR_NAME' => $rs->fields['name'], 'TR_TOOLTIP' => $rs->fields['description'], 'TR_VERSION' => $rs->fields['version'], 'TR_LANGUAGE' => $rs->fields['language'], 'TR_TYPE' => $rs->fields['type'], 'TR_RESELLER' => $rs->fields['reseller'], 'DOWNLOAD_LINK' => $dow_url, 'TR_DOWNLOAD' => tr('Download'), 'ACTIVATE_LINK' => $act_url, 'IMPORT_LINK' => $import_url, 'TR_ACTIVATION' => tr('Activate'), 'TR_IMPORT' => tr('Import'), 'DELETE_LINK' => $del_url, 'TR_DELETE' => tr('Delete'), ) ); $tpl->parse('LIST_SOFTWARE', '.list_software'); $rs->MoveNext(); } $tpl->assign('NO_SOFTWARE_LIST', ''); } else { $tpl->assign( array( 'NO_SOFTWARE' => tr('No software is waiting for activation') ) ); $tpl->parse('NO_SOFTWARE_LIST', '.no_software_list'); $tpl->assign('LIST_SOFTWARE', ''); } return $rs->RecordCount(); } ...
besten Dank im voraus!!!
Andreas