Witam !
Dzisiaj postanowiłem udostępnic innym dodawanie filmików na www. Skopiowałem skrypt z movies online (gdzie było dodawania) pozamieniałem tabele w kodzie. Ok wszystko śmiga.
Ale teraz jest takie moje pytanie, Czy mozna dopisac do tego, aby mozna bylo wrzucac miniaturki o fomracie *.gif, wrzucało ją do folderu images/flashe/ i zeby wymagalo tylko i wylacznie nazwy jaka jest podana w tytule (jezeli bedzie ciezko to bez tego wymagania)
Daje tu kod pliku "game_add.php"
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright (c) 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
+----------------------------------------------------*/
require_once "maincore.php";
require_once "subheader.php";
require_once "side_left.php";
include LOCALE.LOCALESET."admin/admin-games.php";
if (!iMEMBER) { header("Location:../../index.php"); exit; }
$result = dbquery("SELECT * FROM ".$db_prefix."game_cats");
if (dbrows($result) != 0) {
if (isset($_POST['save'])) {
$subject = stripinput($_POST['subject']);
$body = addslash($_POST['body']);
$body2 = addslash($_POST['body2']);
$breaks = isset($_POST['line_breaks']) ? "y" : "n";
$comments = isset($_POST['game_comments']) ? "1" : "0";
$ratings = isset($_POST['game_ratings']) ? "1" : "0";
if (isset($game_id)) {
$result = dbquery("UPDATE ".$db_prefix."game SET game_cat='".$_POST['game_cat']."', game_subject='$subject', game_snippet='$body', game_article='$body2', game_breaks='$breaks', game_allow_comments='$comments', game_allow_ratings='$ratings' WHERE game_id='$game_id'");
opentable($locale['500']);
echo "<center><br>
".$locale['501']."<br><br>
<a href='game_add.php'>".$locale['502']."</a><br><br>
<a href='index.php'>Strona Główna</a><br><br>
</center>\n";
closetable();
} else {
$result = dbquery("INSERT INTO ".$db_prefix."game VALUES('', '".$_POST['game_cat']."', '$subject', '$body', '$body2', '$breaks', '".$userdata['user_id']."', '".time()."', '0', '$comments', '$ratings')");
opentable($locale['504']);
echo "<center><br>
".$locale['505']."<br><br>
<a href='game_add.php'>".$locale['502']."</a><br><br>
<a href='index.php'>Strona Główna</a><br><br>
</center>\n";
closetable();
}
} else if (isset($_POST['delete'])) {
$result = dbquery("DELETE FROM ".$db_prefix."game WHERE game_id='$game_id'");
$result = dbquery("DELETE FROM ".$db_prefix."comments WHERE comment_item_id='$game_id' and comment_type='K'");
$result = dbquery("DELETE FROM ".$db_prefix."ratings WHERE rating_item_id='$game_id' and rating_type='K'");
opentable($locale['506']);
echo "<center><br>
".$locale['507']."<br><br>
<a href='game_add.php'>".$locale['502']."</a><br><br>
<a href='index.php'>Strona Główna</a><br><br>
</center>\n";
closetable();
} else {
if (isset($_POST['preview'])) {
$game_cat = $_POST['game_cat'];
$subject = stripinput($_POST['subject']);
$body = phpentities(stripslash($_POST['body']));
$body2 = phpentities(stripslash($_POST['body2']));
$bodypreview = str_replace("src='".str_replace("../", "", IMAGES_A), "src='".IMAGES_A, stripslash($_POST['body']));
$body2preview = str_replace("src='".str_replace("../", "", IMAGES_A), "src='".IMAGES_A, stripslash($_POST['body2']));
if (isset($_POST['line_breaks'])) {
$breaks = " checked";
$bodypreview = nl2br($bodypreview);
$body2preview = nl2br($body2preview);
}
$comments = isset($_POST['game_comments']) ? " checked" : "";
$ratings = isset($_POST['game_ratings']) ? " checked" : "";
opentable($subject);
echo "$bodypreview\n";
closetable();
tablebreak();
opentable($subject);
echo "$body2preview\n";
closetable();
tablebreak();
}
if (isset($_POST['edit'])) {
$result = dbquery("SELECT * FROM ".$db_prefix."game WHERE game_id='$game_id'");
if (dbrows($result) != 0) {
$data = dbarray($result);
$game_cat = $data['game_cat'];
$subject = $data['game_subject'];
$body = phpentities(stripslashes($data['game_snippet']));
$body2 = phpentities(stripslashes($data['game_article']));
$breaks = ($data['game_breaks'] == "y" ? " checked" : "");
$comments = ($data['game_allow_comments'] == "1" ? " checked" : "");
$ratings = ($data['game_allow_ratings'] == "1" ? " checked" : "");
}
}
if (isset($game_id)) {
$action = FUSION_SELF."?game_id=$game_id";
opentable($locale['500']);
} else {
if (!isset($_POST['preview'])) {
$subject = "";
$body = "";
$body2 = "";
$breaks = " checked";
$comments = " checked";
$ratings = " checked";
}
$action = FUSION_SELF;
opentable($locale['504']);
}
$result = dbquery("SELECT * FROM ".$db_prefix."game_cats ORDER BY game_cat_name DESC");
$catlist = ""; $sel = "";
while ($data = dbarray($result)) {
if (isset($game_cat)) $sel = ($game_cat == $data['game_cat_id'] ? " selected" : "");
$catlist .= "<option value='".$data['game_cat_id']."'$sel>".$data['game_cat_name']."</option>\n";
}
$image_files = makefilelist(IMAGES_A, ".|..|index.php", true);
$image_list = makefileopts($image_files);
echo "<form name='inputform' method='post' action='$action' onSubmit='return ValidateForm(this)'>
<table align='center' cellspacing='0' cellpadding='0'>
<tr>
<td width='100' class='tbl'>Kategoria:</td>
<td class='tbl'><select name='game_cat' class='textbox' style='width:250px;'>
$catlist</select></td>
</tr>
<tr>
<td width='100' class='tbl'>Tytuł:</td>
<td class='tbl'><input type='text' name='subject' value='$subject' class='textbox' style='width:250px;'></td>
</tr>
<tr>
<td valign='top' width='100' class='tbl'>Link: </td>
<td class='tbl'><input type='text' name='body2' value='$body2' class='textbox' style='width:300px;'></td>
</tr>
<tr>
<td align='center' colspan='2' class='tbl'><br>
<input type='submit' name='save' value='".$locale['516']."' class='button'></td>
</tr>
</table>
</form>\n";
closetable();
echo "<script language=\"JavaScript\">
function Deletegame() {
return confirm('".$locale['552']."');
}
function ValidateForm(frm) {
if(frm.subject.value=='') {
alert('".$locale['550']."');
return false;
}
}
</script>\n";
}
} else {
opentable($locale['517']);
echo "<center>".$locale['518']."<br>\n".$locale['519']."<br>
<a href='game_cats_admin.php'>".$locale['520']."</a>".$locale['521']."</center>\n";
closetable();
}
echo "</td>\n";
require_once "side_right.php";
require_once BASEDIR."footer.php";
?>
Inni go mogą wykorzystac do własnych potrzeb ;) |