Przedszkolak
Postów: 8
Data rejestracji: 01.12.2007 13:39
ZBANOWANY: Dożywotnio
|
A więc tak na php coś tam sie znam zmodyfikowałem troszkę ten skrypt...
Najlepiej jak podam kod php 2 plikow upload
Upload 1 służy do dodawania opisu i dodawania plików
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Orginal von: pirdani
| eMail: pirdani@
| Web: http://www.lucky-garden-geithain.de
| ---------------------------------------------------+
| Angepasst für V.6 - 2005 EdEdster (Stefan Noss)
| http://www.edsterathome.de/
| ---------------------------------------------------+
| 2006 Artur Wiebe <>
| http://wibix.de/
| ---------------------------------------------------+
| Copyright © 2002 - 2005 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
if(iUSER < $down_settings['uploadbereich']) {
echo $locale['PDP_159'];
return;
}
?>
<script type="text/javascript">
function verify(frm) {
/*
if(frm.bezeichnung.value=="" || frm.beschreibung.value==""
|| frm.copyright.value=="") {
alert("FIXME: Formular ist teilweise leer.");
return false;
}
*/
if(frm.download.value=="" && frm.link_extern.value=="") {
alert("<?php echo $locale['PDP_136']; ?>");
return false;
}
/*
if(frm.download.value!="" && frm.link_extern.value!="") {
alert("FIXME: Bitte nur eine Downloadquelle.");
return false;
}
*/
return true;
}
</script>
<?php
echo "<form name='uploadform' method='post' action='".FUSION_SELF
."?funk=uploaden2' enctype='multipart/form-data'"
." onSubmit='return verify(this);'>
<table cellspacing='1' class='tbl-border' width='100%'>
<tr>
<td colspan='2' class='tbl2'><b>".$locale['PDP_141']
."</b><br><small>".$locale['PDP_142']."</small></td>
</tr>
<tr>
<td class='tbl2' width='100'>".$locale['PDP_143']."</td>
<td class='tbl1'>
<select size='1' class='textbox' name='kategorie' />";
$sql_cat = dbquery("SELECT * FROM ".DB_PREFIX."prodownload_cats ORDER BY name");
while($cats = dbarray($sql_cat)) {
if($cats['top_cat']==0) {
$info = " (".$locale['PDP_144'].")";
} else {
$info = " (".array_shift(dbarray(dbquery("SELECT name"
." FROM ".DB_PREFIX."prodownload_cats"
." WHERE cat='".$cats['top_cat']."'"))).")";
}
echo "<option value='".$cats['cat']."'>".$cats['name']."$info</option>";
}
echo "</select>
</td>
</tr>
<tr>
<td class='tbl2' width='100'>".$locale['PDP_145']."</td>
<td class='tbl1'><input type='text' style='width:100%;' size='50'"
." maxlength='255' class='textbox' name='bezeichnung' /></td>
</tr>
<tr>
<td class='tbl2'>".$locale['PDP_146']."</td>
<td class='tbl1'><textarea style='width:100%' cols='45' rows='10'"
." class='textbox' name='beschreibung'></textarea></td>
</tr>
<tr>
<td class='tbl2'>".$locale['PDP_147']."</td>
<td class='tbl1'><input type='text' size='50' style='width:100%;'"
." value='© ".$userdata['user_name']." ".date("Y")."'"
." maxlength='255' class='textbox' name='copyright' /></td>
</tr>
<tr>
<td class='tbl2'>".$locale['PDP_148']."</td>
<td class='tbl1'><select size='1' class='textbox' name='lizenz' />
<option value='0'>".$locale['PDP_149']."</option>";
$sql_lizenz = dbquery("SELECT * FROM ".DB_PREFIX."prodownloads_lizenz"
." ORDER BY name");
while($data_l = dbarray($sql_lizenz)) {
echo "<option value='".$data_l['id']."'>".$data_l['name']."</option>";
}
echo "</select><br>
<input type='checkbox' checked name='lizenz_okay' />"
.$locale['PDP_150']."<br>
<input type='checkbox' checked name='lizenz_packet' />"
.$locale['PDP_151']."<br>
<input type='checkbox' name='lizenz_http' />"
.$locale['PDP_152']
."<input type='text' size='50' maxlength='255' class='textbox'"
." name='lizenz_url' />
</td>
</tr>
<tr>
<td class='tbl2'>".$locale['PDP_153']."<br><span class='small2'>"
.implode(", ", $ext1)."</span></td>
<td class='tbl1'><input type='file' name='screenshot'"
." class='textbox' size='50'></td>
</tr>
<tr>
<td class='tbl2'>".$locale['PDP_155']."<br><span class='small2'>"
.implode(", ", $ext2)."</span></td>
<td class='tbl1'><input type='file' name='download' class='textbox'"
." size='50'></td>
</tr>
<tr>
<td class='tbl2'>"./*$locale['PDP_157'].*/"</td>
<td class='tbl2'><input type='submit' value='".$locale['PDP_158']."'"
." class='button' name='uploaden' /></td>
</tr>
</table>
</form>";
?>
Drugi służy do wysyłania plików na serwer
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Orginal von: pirdani
| eMail: pirdani@
| Web: http://www.lucky-garden-geithain.de
| ---------------------------------------------------+
| Angepasst für V.6 - 2005 EdEdster (Stefan Noss)
| http://www.edsterathome.de/
| ---------------------------------------------------+
| 2006 Artur Wiebe <>
| http://wibix.de/
| ---------------------------------------------------+
| Copyright © 2002 - 2005 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
if(iUSER < $down_settings['downbereich']) {
echo $locale['PDP_138'];
return;
}
$upload1 = $_FILES['screenshot'];
$upload2 = $_FILES['download'];
if($upload2['size'] > $maxupfilesize) {
echo "<b>".$locale['PDP_300']."</b><p>"
.$locale['PDP_134']." ".($maxupfilesize/1024)."KB ("
.($maxupfilesize/1024/1024)." MB)".$locale['PDP_135'];
//Datenbank Eintrag
} else {
$bezeichnung = stripinput(censorwords($_POST['bezeichnung']));
$beschreibung = stripinput(censorwords($_POST['beschreibung']));
$copyright = stripinput(censorwords($_POST['copyright']));
$lizenz_okay = (isset($_POST['lizenz_okay']) ? "Y" : "N");
$lizenz_packet = (isset($_POST['lizenz_packet']) ? "Y" : "N");
$lizenz_url = $_POST['lizenz_http'];
$kategorie = $_POST['kategorie'];
$lizenz = $_POST['lizenz'];
$check = (iUSER>=$down_settings['uploadsaktivieren'] ? "Y" : "N");
$sql_insert = dbquery("INSERT INTO ".DB_PREFIX."prodownloads"
."(cat, name, beschreibung, copyright"
.",lizenz_id, lizenz_okay, lizenz_packet, lizenz_url"
.",link_extern, down, bild, downloads, user_id"
.",datestamp, status)"
." VALUES "
."('$kategorie', '$bezeichnung', '$beschreibung', '$copyright'"
.",'$lizenz', '$lizenz_okay', '$lizenz_packet', '$lizenz_url'"
.",'$link_extern', '', '', '0', '".$userdata['user_id']."'"
.",'".time()."', '$check')");
$id_eintrag = mysql_insert_id();
//Upload
if($upload1['name']!="" && !empty($upload1['name'])) {
if(is_uploaded_file($upload1['tmp_name'])
&& $upload1['size']<=$maxfilesize)
{
$upload1_ext = strrchr($upload1['name'], '.');
if(in_array($upload1_ext, $ext1)) {
$posext1 = strrpos($upload1['name'], ".");
$fileoext1 = substr($upload1['name'],
0, $posext1);
$upload1_name = $fileoext1."[$id_eintrag]"
.$upload1_ext;
move_uploaded_file($upload1['tmp_name'],
$uploadimage.$upload1_name);
chmod($uploadimage.$upload1_name, 0644);
$sql_update1 = dbquery("UPDATE "
.DB_PREFIX."prodownloads"
." SET bild='$upload1_name'"
." WHERE id='$id_eintrag'");
echo $locale['PDP_127'].'<br>';
} else {
echo $locale['PDP_128'].'<br>';
}
} else {
echo $locale['PDP_129']." ".($maxfilesize/1024)
."KB (".($maxfilesize/1024/1024)." MB)"
.$locale['PDP_130']."<br>";
}
} else {
echo $locale['PDP_131'].'<br>';
}
if($upload2['name']!="" && !empty($upload2['name'])) {
if(is_uploaded_file($upload2['tmp_name'])
&& $upload2['size'] <= $maxfilesize)
{
$upload2_ext = strrchr($upload2['name'], '.');
if(in_array($upload2_ext, $ext2)) {
$posext2 = strrpos($upload2['name'], ".");
$fileoext2 = substr($upload2['name'], 0,
$posext2);
$upload2_name = $fileoext2."[$id_eintrag]"
.$upload2_ext;
move_uploaded_file($upload2['tmp_name'],
$uploadfile.$upload2_name);
chmod($uploadfile.$upload2_name, 0644);
$sql_update2 = dbquery("UPDATE "
.DB_PREFIX."prodownloads"
." SET down='$upload2_name'"
." WHERE id='$id_eintrag'");
echo $locale['PDP_132']."<br>";
} else {
echo $locale['PDP_133']."<br>";
}
} else {
echo $locale['PDP_134']." ".($maxfilesize/1024)."KB ("
.($maxfilesize/1024/1024)." MB)"
.$locale['PDP_135']."<br>";
}
} else {
echo $locale['PDP_136']."<br>";
}
echo "<br><br><a href='".FUSION_SELF
."?catid=$kategorie'>".$locale['PDP_137']."</a>";
}
//PN bei neuem Download
switch($down_settings['pmsystem']) {
case 0:
dbquery("INSERT INTO ".DB_PREFIX."messages"
."(message_to, message_from"
.",message_subject"
.",message_message"
.",message_smileys, message_read, message_datestamp)"
." VALUES "
."('".$down_settings['defektpm']."', '".$userdata['user_id']."'"
.",'".$locale['PDP_139']."'"
.", '".$locale['PDP_140']
."<br>[url=".$settings['siteurl']
."infusions/pro_download_panel/admin/admin.php"
."?adminpage=downloads]".$locale['PDP_140_1']."[/url]'"
.",'y', '0', '".time()."')");
break;
}
?>
Dzięki za wszelka pomoc
Edytowane przez Milka dnia 08.12.2007 21:14:20
|
Postów: 19885 Pomógł: 767
v7.02.03 Data rejestracji: 23.02.2005 18:12
|
aresp2p napisał/a:
No ok a jeżeli użytkownik doda plik to co teraz??
To odrzucisz, po to jest akceptacja.
Daj info, ze tylko pliki z zewnetrznych serwerow beda zatwierdzane.
Sprawdz najnowsza wersje, czy nie ma mozliwosci wylaczenia jednej z opcji: http://wibix.de/i...php?did=19
Wibix sporo zmienial w miedzyczasie, wiec jest bardzo prawdopodobne, ze juz ta opcja jest aktywna.
Ja moge sprawdzic dopiero pozniej..
Zawsze mozna usunac czesc kodu odpowiedzialna za upload na serwer, ale mysle, ze warto pierwsze sprawdzic najnowsza wersje tego downloadu.
Edit: Jesli nadal bedziesz niezadowolony z opcji, ktore daje pod tym wzgledem standard, to daj znac, napisze, co i gdzie usunac, zeby zostala mozliwosc dodawania plikow i zdjec tylko z zewnetrznych serwerow.
Edytowane przez Pieka dnia 08.12.2007 20:20:15
Jestem jaki jestem
|