Witam
Staram się przerobić poniższy kod tak, aby po kliknięciu w link znajdujący się w profilu użytkownika wyświetliły się dodane przez użytkownika pliki. Czy jest o w ogóle wykonalne?
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright 2002 - 2005 Nick Jones
| http://www.php-fu...
+----------------------------------------------------+
| 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
+----------------------------------------------------+
/ Member file upload system by Rayxen
/ Modified by MisterMartin75
+----------------------------------------------------*/
require_once "../../maincore.php";
require_once BASEDIR."subheader.php";
require_once BASEDIR."side_left.php";
require_once INFUSIONS."member_file_uploads/file_upload_config.php";
if (file_exists(INFUSIONS."member_file_uploads/locale/".$settings['locale'].".php")) {
include INFUSIONS."member_file_uploads/locale/".$settings['locale'].".php";
} else {
include INFUSIONS."member_file_uploads/locale/English.php";
}
if (iMEMBER) {
if (isset($del)) {
$result = dbquery("SELECT * FROM ".$db_prefix."member_files WHERE file_name = '".$del."'");
$row = dbarray($result);
if (($userdata['user_id'] == $row['file_user'] && $allow_member_delete) || iSUPERADMIN) {
unlink($upload_folder."$del");
$remove = dbquery("DELETE FROM ".$db_prefix."member_files WHERE file_name = '".$del."'");
opentable($locale['fup110']);
echo "<center><br />
".$locale['fup111']."<br /><br />
<a href='".FUSION_SELF."'>".$locale['fup112']."</a><br><br>
<a href='".ADMIN."index.php'>".$locale['fup113']."</a><br><br>
</center>\n";
closetable();
} else {
opentable($locale['fup110']);
echo "<center><br />
".$locale['fup114']."<br /><br />
<a href='".FUSION_SELF."'>".$locale['fup112']."</a><br><br>
</center>\n";
closetable();
}
tablebreak();
}
if (isset($_FILES['upload'])) {
$upload = $_FILES['upload'];
if ($upload['name'] != "" && !empty($upload['name']) && is_uploaded_file($upload['tmp_name']) && $upload['size'] <= $upload_member_maxsize) {
$upload_ext = strrchr($upload['name'],".");
if (in_array($upload_ext, $upload_extensions)) {
$upload_name = $upload['name'];
move_uploaded_file($upload['tmp_name'], $upload_folder.$upload_name);
chmod($upload_folder.$upload_name,0644);
if (dbrows(dbquery("SELECT file_name FROM ".$db_prefix."member_files WHERE file_name = '".$upload_name."'")) != 0) {
$upload_error = $locale['fup126'];
} else {
$result = dbquery("INSERT INTO ".$db_prefix."member_files VALUES ('', '".$userdata['user_id']."', '".$upload_name."')");
}
} else {
$upload_error = $locale['fup124'];
}
} else {
$upload_error = $locale['fup125'];
}
opentable($locale['fup130']);
echo "<div style='text-align:center'><br />
".(!isset($upload_error) ? $locale['fup123'] : $upload_error)."<br /><br />
</div\n";
closetable();
tablebreak();
}
// If members are allowed to delete their files, list files
if ($allow_member_delete) {
opentable($locale['fup130']);
echo "<table width='500' align='center' cellpadding='0' cellspacing='1' class='tbl-border'>
<tr>
<td class='tbl2'>".$locale['fup131']."</td>
<td class='tbl2'>".$locale['fup132']."</td>
<td class='tbl2'>".$locale['fup136']."</td>
</tr>\n";
$file_list = makefilelist($upload_folder, ".|..|index.php", true);
if (!isset($file_list)) { $file_count = 0; } else { $file_count = count($file_list); }
$x=0;
for ($i=0; $i < $file_count; $i++) {
$file_size = filesize($upload_folder.$file_list[$i]);
if (iSUPERADMIN) {
$result = dbquery("SELECT file_user FROM ".$db_prefix."member_files WHERE file_name = ' ".$file_list[$i]."'");
} else {
$result = dbquery("SELECT file_user FROM ".$db_prefix."member_files WHERE file_name = '".$file_list[$i]."' AND file_user='".$userdata['user_id']."'");
}
if (dbrows($result) != 0) {
if ($x % 2 == 0) { $row_color = "tbl1"; } else { $row_color = "tbl2"; }
echo "<tr>
<td class='$row_color'><a href='http://localhost/~humorsto/downloads/$file_list[$i]'><b>$file_list[$i]<a/></td>
<td class='$row_color'>".($file_size > 0 ? parseByteSize($file_size) : "-----")."</td>";
$file_user = dbresult($result,0);
$result2 = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_id = '".$file_user."'");
$row2 = dbarray($result2);
echo "<td class='$row_color'>".$row2['user_name']."</td>";
echo"</tr>\n";
$x++;
}
}
echo "</table>\n";
closetable();
tablebreak();
}
}
require_once BASEDIR."side_right.php";
require_once BASEDIR."footer.php";
?> Kliknij i zaczekaj na załadowanie kodu ...
//Długie kody wstawiamy w znacznik chili - chemix
PW od moderatora:
- Zmiana nazwy tematu - chemix 01.03 - 21:58
Edytowane przez Ramage dnia 01.03.2009 22:13:32
|