ForumCała strona

Nawigacja

Aktualnie online

Gości online: 9

Użytkowników online: 0

Łącznie użytkowników: 25,400
Najnowszy użytkownik: AlojzyBartek

Logowanie

Nazwa użytkownika

Hasło



Zarejestruj się

Odzyskaj hasło

Shoutbox

Musisz zalogować się, aby móc dodać wiadomość.

Zbigniew@
17.11.2024 11:33:24
Nie ten grzeszy kto pije, ale ten, kto się nie upije.

JazOOn
16.11.2024 20:46:18
tja

Zbigniew@
15.11.2024 18:58:17
Kto pije, ten nie bije.

JazOOn
31.10.2024 20:49:47
Kto pije?

piterus
30.10.2024 19:45:48
I będziemy śpiewać: "Kiedy 20 blisko, przebadaj wszystko, przebadaj wszystko..." Pfft

Pobierz nową wersję
Pobierz podręcznik
Zobacz inne oficjalne Supporty
Statystyki supportu
PHP-Fuson PL na Facebooku

RSS

Polecamy hosting SferaHost.pl

Zobacz temat

 Drukuj temat
downloads - mała modyfikacja - problem
djkrolik
Witam. chciałbym zrobić pewną rzecz lecz do końca tego nie potrafię. A mianowicie:
Zrobiłem sobie na stronie 2 downloady. W folderze administration zrobiłem plik downloads.php i downloads2.php oraz w bazie danych dodałem tabele _fusion_downloads2 no i oczywiście fusion_downloads2_cats. Downloads 1 i Downloads 2 działają poprawnie ale chciałbym żeby można było robić coś takiego:

1. Pewna osoba (admin) dodaje plik używając Downloads1 (http://mojastrona/administration/downloads.php)

2. Ja jako admin główny wchodze (http://mojastrona/administration/downloads2.php) - chcę aby tutaj wczytywało mi dane z bazy danych z tabeli fusion_downloads.
I np edytuje sobie dodany do downloadu plik przez admina (pkt 1) ale klikając na "Zapisz" chcialbym aby dane zapisały się w bazie danych w tabeli fusion_downloads2.

Chcę aby miało to zastosowane podobne do np wysyłania przez userów linków, newsów, artów przez funkcję która jest wbudowana w cmsie (submit.php) i robiąc operację opisaną w punkcie 2 działało by to jako publikacja tego co wysłała osoba (pkt 1).

Wszystko sobie przygotowałem ale nie potrafię zrobić tego żeby jakby download2.php działał na 2 tabele w bazie. Czytał z tabeli fusion_downloads a przy edycji i kliknięciu na "Zapisz" zapisywał do tabeli fusion_downloads2.

Jaka musi być zawartość pliku download2.php aby działało to tak jak opisałem wyżej.

Bardzo prosze o pomoc i z góry bardzo dziękuję.

P.S Chodzi o download z najnowszej wersji extreme- packa. Nie ma działu extreme-fusion dlatego napisałem to tutaj.

Kod z pliku downloads.php

<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+---------------------------------------------------------+
| Copyright (c) 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
+---------------------------------------------------------*/
require_once "../maincore.php";
require_once BASEDIR."subheader.php";
require_once ADMIN."navigation.php";
include LOCALE.LOCALESET."admin/downloads.php";

if (!checkrights("D")) fallback("../index.php");
if (isset($download_id) && !isNum($download_id)) fallback(FUSION_SELF);
if (!isset($step)) $step = "";

function makelistofcats($cat, $level, $cat_up=0)
{
global $db_prefix, $editlist;
$r = dbquery("SELECT * FROM ".$db_prefix."download_cats WHERE download_cat_up='".$cat."' ORDER BY download_cat_name");
while ($d = dbarray($r))
{
if ($cat_up == $d['download_cat_id']) $selected="selected"; else $selected="";
//echo "<option value='".$d['download_cat_id']."' ".$selected.">".$d['download_cat_name']."</option>";
$editlist .= "<option value='".$d['download_cat_id']."' ".$selected.">";
for ($x=0; $x<$level; $x++) $editlist .= " ";
$editlist .= $d['download_cat_name']."</option>";

$temp = dbquery("SELECT * FROM ".$db_prefix."download_cats WHERE download_cat_up='".$d['download_cat_id']."' ORDER BY download_cat_name");
if (dbrows($temp)) makelistofcats($d['download_cat_id'], $level+1, $cat_up);
}
}


$result = dbquery("SELECT * FROM ".$db_prefix."download_cats");
if (dbrows($result) != 0) {
if ($step == "delete") {
$result = dbquery("SELECT * FROM ".$db_prefix."downloads WHERE download_id='$download_id'");
$data = dbarray($result);
$url = BASEDIR.$data['download_url'];
unlink($url);
$temp = dbarray(dbquery("SELECT download_cat from ".$db_prefix."downloads WHERE download_id='$download_id'"));
$result = dbquery("DELETE FROM ".$db_prefix."downloads WHERE download_id='$download_id'");
$result = dbquery("UPDATE ".$db_prefix."download_cats SET download_cat_datestamp='".time()."' WHERE download_cat_id='".$temp['download_cat']."'");
redirect("downloads.php?download_cat_id=$download_cat_id");
}
if (isset($_POST['save_download'])) {
$download_title = stripinput($_POST['download_title']);
$download_description = stripinput($_POST['download_description']);
if ($download_type == "upload") {
$upload_maxsize = 2097152;
$upload_extensions = array(
".exe",
".zip",
".rar",
".tar",
".jpg",
".gif",
".png",
".psd",
".xls"
);
$upload_folder = BASEDIR."downloads/";
$upload = $_FILES['upload'];
if ($upload['name'] != "" && !empty($upload['name']) && is_uploaded_file($upload['tmp_name']) && $upload['size'] <= $upload_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);
} else {
$upload_error = $locale['824'];
}
} else {
$upload_error = $locale['825'];
}
$download_url = "downloads/".$upload_name;
}
if ($download_type == "url") {
$download_url = stripinput($_POST['download_url']);
}
$download_license = stripinput($_POST['download_license']);
$download_os = stripinput($_POST['download_os']);
$download_version = stripinput($_POST['download_version']);
$download_filesize = stripinput($_POST['download_filesize']);
$download_image = stripinput($_POST['download_image']);
$download_adres = stripinput($_POST['download_adres']);
if ($step == "edit") {
$result = dbquery("SELECT * FROM ".$db_prefix."downloads WHERE download_id='$download_id'");
$data = dbarray($result);
$url = $data['download_url'];
if ($url != $download_url) {
$url = BASEDIR.$data['download_url'];
unlink($url);
}
$result = dbquery("UPDATE ".$db_prefix."downloads SET download_title='$download_title', download_description='$download_description', download_url='$download_url', download_cat='$download_cat', download_license='$download_license', download_os='$download_os', download_version='$download_version', download_filesize='$download_filesize', download_datestamp='".time()."', download_image='$download_image', download_adres='$download_adres' WHERE download_id='$download_id'");
$result = dbquery("UPDATE ".$db_prefix."download_cats SET download_cat_datestamp='".time()."' WHERE download_cat_id='".$download_cat."'");
redirect("downloads.php?download_cat_id=$download_cat");
} else {
$result = dbquery("INSERT INTO ".$db_prefix."downloads (download_title, download_description, download_url, download_cat, download_license, download_os, download_version, download_filesize, download_datestamp, download_count, download_image, download_adres) VALUES('$download_title', '$download_description', '$download_url', '$download_cat', '$download_license', '$download_os', '$download_version', '$download_filesize', '".time()."', '0', '$download_image', '$download_adres')");
$result = dbquery("UPDATE ".$db_prefix."download_cats SET download_cat_datestamp='".time()."' WHERE download_cat_id='".$download_cat."'");
redirect("downloads.php?download_cat_id=$download_cat");
}
}
if ($step == "edit") {
$result = dbquery("SELECT * FROM ".$db_prefix."downloads WHERE download_id='$download_id'");
$data = dbarray($result);
$download_title = $data['download_title'];
$download_description = $data['download_description'];
$download_url = $data['download_url'];
$download_license = $data['download_license'];
$download_os = $data['download_os'];
$download_version = $data['download_version'];
$download_filesize = $data['download_filesize'];
$download_image = $data['download_image'];
$download_adres = $data['download_adres'];
$formaction = FUSION_SELF."?step=edit&download_cat_id=$download_cat_id&download_id=$download_id";
opentable($locale['470']);
} else {
$download_title = ""; $download_description = ""; $download_url = ""; $download_license = "";
$download_os = ""; $download_version = ""; $download_filesize = ""; $download_image = ""; $download_adres = "";
$formaction = FUSION_SELF;
opentable($locale['471']);
}
$editlist = ""; $sel = "";
$result2 = dbquery("SELECT * FROM ".$db_prefix."download_cats WHERE download_cat_up='-1' ORDER BY download_cat_name");
if (dbrows($result2) != 0) {
while ($data2 = dbarray($result2)) {
if ($step == "edit") $sel = ($data['download_cat'] == $data2['download_cat_id'] ? " selected" : "");
$editlist .= "<optgroup label='".$data2['download_cat_name']."'>";
if ($step == "add") makelistofcats($data2['download_cat_id'], 1, $download_cat_id);
else makelistofcats($data2['download_cat_id'], 1, (isset($_GET['download_cat_id']) ? $_GET['download_cat_id'] : "") );
echo "</optgroup>";
}

}
echo "<form name='inputform' method='post' action='$formaction' enctype='multipart/form-data'>
<table align='center' width='530' cellspacing='0' cellpadding='0'>
<tr>
<td width='80' class='tbl'>".$locale['480']."</td>
<td class='tbl'><input type='text' name='download_title' value='$download_title' class='textbox' style='width:380px;'></td>
</tr>
<tr>
<td width='80' class='tbl'>".$locale['481']."</td>
<td class='tbl'><textarea name='download_description' rows='5' class='textbox' style='width:380px;'>".$download_description."</textarea></td>
</tr>
<tr>
<td class='tbl'></td><td class='tbl'>
<input type='button' value='b' class='button' style='font-weight:bold;width:25px;' onClick=\"addText('download_description', '', '');\">
<input type='button' value='i' class='button' style='font-style:italic;width:25px;' onClick=\"addText('download_description', '', '');\">
<input type='button' value='u' class='button' style='text-decoration:underline;width:25px;' onClick=\"addText('download_description', '', '');\">
<input type='button' value='url' class='button' style='width:30px;' onClick=\"addText('download_description', '[url]', '[/url]');\">
<input type='button' value='mail' class='button' style='width:35px;' onClick=\"addText('download_description', '[mail]', '[/mail]');\">
<input type='button' value='img' class='button' style='width:30px;' onClick=\"addText('download_description', '[img]', '[/img]');\">
<input type='button' value='center' class='button' style='width:45px;' onClick=\"addText('download_description', '
', '
');\">
<input type='button' value='small' class='button' style='width:40px;' onClick=\"addText('download_description', '', '');\">
<input type='button' value='code' class='button' style='width:40px;' onClick=\"addText('download_description', '
Pobierz kod źródłowy  Rozwiń Kod źródłowy
');\">
<input type='button' value='quote' class='button' style='width:45px;' onClick=\"addText('download_description', '
', '
');\">
</td>
</tr>
<tr>
<td width='80' class='tbl'>Screen:</td>
<td class='tbl'><input type='text' name='download_image' value='$download_image' class='textbox' style='width:380px;'></td>
</tr>
<tr>
<td width='80' class='tbl'><table width='100%' cellspacing='0' cellpadding='0'><tr><td align='left'>".$locale['D_001']."</td><td align='right' ><input type='radio' name='download_type' value='upload'></td></tr></table></td>
<td class='tbl'><input type='file' name='upload' class='textbox' style='width:380px;'></td>
</tr>
<tr>
<td class='tbl'></td><td class='tbl'>";
if (isset($_POST['save_download'])) {
if (isset($upload_error)) {
echo "<div class='scapmain'>".$upload_error."<br></div><span class='small'></td>";
} else {
echo "<div class='scapmain'>".$locale['823']."</div><span class='small'></td>";
}
} else {
echo "<span class='small'>".$locale['D_002']."</span><br>".$locale['D_003']."</td>";
}
echo "
</tr>
<tr>
<td width='80' class='tbl'><table width='100%' cellspacing='0' cellpadding='0'><tr><td align='left'>".$locale['482']."</td><td align='right' ><input type='radio' name='download_type' value='url'></td></tr></table></td>
<td class='tbl'><input type='text' name='download_url' value='$download_url' class='textbox' style='width:360px;'></td>
</tr>
<tr>
<td class='tbl'></td><td class='tbl'><span class='small'>".$locale['D_004']."<br>".$locale['D_003']."</span></td>
</tr>
<tr>
<td width='80' class='tbl'>".$locale['483']."</td>
<td class='tbl'><select name='download_cat' class='textbox' style='font-size:10px;'>
$editlist</select></td>
</tr>
<tr>
<td width='80' class='tbl'>".$locale['484']."</td>
<td class='tbl'><input type='text' name='download_license' value='$download_license' class='textbox' style='width:150px;'></td>
</tr>
<tr>
<td width='80' class='tbl'>".$locale['D_005']."</td>
<td class='tbl'><input type='text' name='download_adres' value='$download_adres' class='textbox' style='width:150px;'></td>
</tr>
<tr>
<td width='80' class='tbl'>".$locale['485']."</td>
<td class='tbl'><input type='text' name='download_os' value='$download_os' class='textbox' style='width:150px;'></td>
</tr>
<tr>
<td width='80' class='tbl'>".$locale['486']."</td>
<td class='tbl'><input type='text' name='download_version' value='$download_version' class='textbox' style='width:150px;'></td>
</tr>
<tr>
<td width='80' class='tbl'>".$locale['487']."</td>
<td class='tbl'><input type='text' name='download_filesize' value='$download_filesize' class='textbox' style='width:150px;'></td>
</tr>
<tr>
<td align='center' colspan='2' class='tbl'>
<input type='submit' name='save_download' value='".$locale['488']."' class='button'></td>
</tr>
</table>
</form>\n";
closetable();
tablebreak();
opentable($locale['500']);
echo "<table align='center' width='80%' cellspacing='0' cellpadding='0' class='tbl'>\n";
$result = dbquery("SELECT * FROM ".$db_prefix."download_cats ORDER BY download_cat_name");
if (dbrows($result) != 0) {
echo "<tr>
<td class='tbl2'>".$locale['501']."</td>
<td align='right' class='tbl2'>".$locale['502']."</td>
</tr>
<tr>
<td colspan='2' height='1'></td>
</tr>\n";

$result1 = dbquery("SELECT * from ".$db_prefix."download_cats WHERE download_cat_up='-1' ORDER BY download_cat_name");
while ($data1 = dbarray($result1))
{
echo "<tr><td><strong>".$data1['download_cat_name']."</strong></td></tr>";
$result = dbquery("SELECT * FROM ".$db_prefix."download_cats WHERE download_cat_up='".$data1['download_cat_id']."' ORDER BY download_cat_name");
while ($data = dbarray($result)) {
if (!isset($download_cat_id)) $download_cat_id = "";
if ($data['download_cat_id'] == $download_cat_id) { $p_img = "off"; $div = ""; } else { $p_img = "on"; $div = "style='display:none'"; }
echo "<tr>
<td class='tbl2'> ".$data['download_cat_name']."</td>
<td class='tbl2' align='right'><img onclick=\"javascript:flipBox('".$data['download_cat_id']."')\" name='b_".$data['download_cat_id']."' border='0' src='".THEME."images/panel_".$p_img.".gif'></td>
</tr>\n";
$result2 = dbquery("SELECT * FROM ".$db_prefix."downloads WHERE download_cat='".$data['download_cat_id']."' ORDER BY download_title");
if (dbrows($result2) != 0) {
echo "<tr>
<td colspan='2'>
<div id='box_".$data['download_cat_id']."'".$div.">
<table width='100%' cellspacing='0' cellpadding='0' class='tbl'>\n";
while ($data2 = dbarray($result2)) {
echo "<tr>
<td><a href='".$data2['download_url']."' target='_blank'>".$data2['download_title']."</a></td>
<td align='right' width='100'><a href='".FUSION_SELF."?step=edit&download_cat_id=".$data['download_cat_id']."&download_id=".$data2['download_id']."'>".$locale['503']."</a> -
<a href='".FUSION_SELF."?step=delete&download_cat_id=".$data['download_cat_id']."&download_id=".$data2['download_id']."' onClick='return DeleteItem()'>".$locale['504']."</a></td>
</tr>\n";
}




echo "</table>
</div>
</td>
</tr>\n";
} else {
echo "<tr>
<td colspan='2'>
<div id='box_".$data['download_cat_id']."' style='display:none'>
<table width='100%' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td>".$locale['505']."</td>
</tr>
</table>
</div>
</td>
</tr>\n";
}
}

}
echo "</table>\n";
echo "<script>
function DeleteItem()
{
return confirm('".$locale['460']."');
}
</script>\n";
} else {
echo "<tr>
<td align='center'><br>
".$locale['506']."<br><br>
<a href='download_cats.php'>".$locale['507']."<br><br></td>
</tr>
</table>\n";
}
closetable();
} else {
opentable($locale['500']);
echo "<center>".$locale['508']."<br>
".$locale['509']."<br><br>
<a href='download_cats.php'>".$locale['510']."</a>".$locale['511']."</center>\n";
closetable();
}
tablebreak();
include_once ADMIN."file_uploads.php";
echo "</td>\n";
require_once BASEDIR."footer.php";
?>
 
Wścibski Gość
Dodany dnia 23.11.2024 17:36:19
Pan Kontekstualny

Postów: n^x
Data rejestracji: Zawsze

Polecamy hosting SferaHost.pl
IP: localhost  
Przejdź do forum:
Created by Arox Copyright (C) 2004
Copyright (C) 2004 - 2018 Ekipa PHP-Fusion.pl