Zroiłem skrypt jPORTALA i nie wiem co jest żle
Ps To mój pierszy skrypt
2 Fotki
http://www.korp.pl/~zibi/w/1.gif < Jakiś Błąd
http://www.korp.pl/~zibi/w/2.gif < Nie chce dodawać (IMG:
http://forum.php.pl/style_emoticons/default/sad.gif)
module/webdesign.inc.php
<?
/*****************************************************/
/* jPORTAL - internetowy system portalowy */
/*****************************************************/
/* autor: Pawel 'jaco' Jaczewski */
/* email: info@websys.pl */
/*****************************************************/
function webdesign_index() {
mysql_query(\"SELECT * FROM $webdesign_tbl ORDER BY id, autor, cena, zobacz1, zobacz2, za
m w\");
$result = mysql_query($query);
while($r=mysql_fetch_array($result)) {
echo'<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\"
style=\"text-align: left;\">
<tbody>
<tr>
<td
style=\"text-align: center; vertical-align: middle; color: rgb(255, 255, 255);\"
rowspan=\"3\" colspan=\"1\"><font size=\"-1\"><img
style=\"width: 135px; height: 123px;\" alt=\"\"
src=\"'.$r[zobacz1].'\"><br>
</font></td>
<td
style=\"color: rgb(255, 255, 255); text-align: justify; vertical-align: middle;\"><font
size=\"-1\">Autor:<br>
</font> </td>
<td
style=\"color: rgb(255, 255, 255); text-align: justify; vertical-align: middle;\"><font
size=\"-1\">'.$r[autor].'<br>
</font></td>
</tr>
<tr>
<td style=\"color: rgb(255, 255, 255); vertical-align: middle;\"><font
size=\"-1\">ID:<br>
</font></td>
<td style=\"color: rgb(255, 255, 255); vertical-align: middle;\"><font
size=\"-1\"><b>'.$r[id].'<br>
</b></font></td>
</tr>
<tr>
<td
style=\"color: rgb(255, 255, 255); text-align: justify; vertical-align: middle;\"><font
size=\"-1\">Cena:<br>
</font> </td>
<td
style=\"color: rgb(255, 255, 255); text-align: justify; vertical-align: middle;\"><font
size=\"-1\">'.$r[cena].'PLN<br>
</font></td>
</tr>
<tr>
<td
style=\"vertical-align: top; color: rgb(255, 255, 255); text-align: center;\"><font
size=\"-1\">[ <a href=\"mailto:'.$r[zamow].'\">zamów</a> ] [ <a
href=\"'.$r[zobacz2].'\">zobacz</a> ]</font> </td>
</tr>
</tbody>
</table>
<hr color=\"#FFFFFF\" align=\"center\" size=\"-1\" width=\"75%\">';
}
}
?>
admin/webdesign.adm.php
<?
/*****************************************************/
/* jPORTAL - internetowy system portalowy */
/*****************************************************/
/* autor: Pawel 'jaco' Jaczewski */
/* email: info@websys.pl */
/*****************************************************/
function module_start($cmd) {
if($cmd=='dodaj') { dodaj(); }
if($cmd=='edytuj') { edytuj(); }
if($cmd=='usun_nazwa') { usun_nazwa(); }
}
function module_main($cmd) {
if($cmd=='') {
mn_title_open();
echo 'Zarz±dzanie'; mn_title_close();
mn_text_open();
zarz();
mn_text_close();
}
if($cmd=='') {
mn_title_open();
mn_title_close();
mn_text_open();
webdesign();
mn_text_close();
}
if($cmd=='edytuj_nazwa') {
mn_title_open();
mn_title_close();
mn_text_open();
edytuj_nazwa();
mn_text_close();
}
}
function zarz() {
global $PHP_SELF, $webdesign_tbl, $access, $color, $op, $goto;
if($access=='root') {
$result = mysql_query(\"SELECT * FROM $webdesign_tbl ORDER BY id, autor, cena, zobacz1, zobacz2, za
m w\");
$il = mysql_num_rows($result);
if($il==0) {
echo '<table align=\"center\" border=\"0\" cellspacing=\"3\" cellpadding=\"0\">
<tr>
<td align=\"right\" valign=\"top\" class=\"uni_01\"><B>Brak</B></td></tr>
</table>';
} else {
echo '
<table width=\"99%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\" align=\"center\">
<tr>
<td>
<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#aaaaaa\" align=\"center\">
<tr>
<td>
<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">';
while($r = mysql_fetch_array($result)) {
$id = $r['id'];
$autor = $r['autor'];
$cena = $r['cena'];
$zobacz1 = $r['zobacz1'];
$zobacz2 = $r['zobacz2'];
$zamow = $r['zamow'];
$akcje = '[ <a href=\"'.$PHP_SELF.'?op='.$op.'&id='.$id.'&cmd=edytuj_nazwa\">edytuj</a> | <a href=\"'.$PHP_SELF.'?op='.$op.'&id='.$id.'&cmd=usun_nazwa\">usuń</a> ] ';
echo '<tr>
<td bgcolor=\"'.$bg.'\" class=\"uni_01\" width=\"28%\">'.$autor.'</td>
<td bgcolor=\"'.$bg.'\" class=\"uni_01\" width=\"28%\">'.$cena.'</td>
<td bgcolor=\"'.$bg.'\" class=\"uni_01\" width=\"28%\">'.$zobacz1.'</td>
<td bgcolor=\"'.$bg.'\" class=\"uni_01\" width=\"28%\">'.$zobacz2.'</td>
<td bgcolor=\"'.$bg.'\" class=\"uni_01\" width=\"28%\">'.$zamow.'</td>
<td bgcolor=\"'.$bg.'\" class=\"uni_01\">'.$akcje.'</td>
</tr>';
} echo '</table>
</td>
</tr>
</table>
</td>
</tr>
</table>';
}
} else { echo '<b>Nie masz odpowiednich uprawnień do wykonywania tej czynno¶ci.</b><BR>'; }
}
function webdesign() {
global $PHP_SELF, $access, $op, $goto;
if($access=='root') {
echo '<form name=\"form1\" method=\"post\" action=\"admin.php?op='.$op.'\">
<table align=\"center\" border=\"0\" cellspacing=\"3\" cellpadding=\"0\">
<tr>
<td align=\"right\" class=\"uni_01\">Autor</td>
<td class=\"next\"><input type=\"text\" name=\"autor\" size=\"35\"></td>
</tr>
<td align=\"right\" class=\"uni_01\">Cena</td>
<td class=\"next\"><input type=\"text\" name=\"cena\" size=\"35\"></td>
</tr>
<tr>
<td align=\"right\" class=\"uni_01\">Min img</td>
<td class=\"next\"><input type=\"text\" name=\"zobacz1\" size=\"35\"></td>
</tr>
<tr>
<td align=\"right\" class=\"uni_01\">Big img</td>
<td class=\"next\"><input type=\"text\" name=\"zobacz2\" size=\"15\"></td>
</tr>
<tr>
<td align=\"right\" class=\"uni_01\">E-Mail</td>
<td class=\"next\"><input type=\"text\" name=\"zamow\" size=\"15\"></td>
</tr>
</table><BR><div class=\"uni_01\" align=\"center\">
<input style=\"font-weight: bold;\" type=\"submit\" name=\"ok\" value=\"dodaj\">
<input type=\"hidden\" name=\"goto\" value=\"'.$goto.'\">
<input type=\"hidden\" name=\"cmd\" value=\"dodaj\"></div>
</form>';
} else { echo '<b>Nie masz odpowiednich uprawnień do wykonywania tej czynno¶ci.</b><BR>'; }
}
function dodaj() {
global $autor, $cena, $zobacz1, $zobacz2, $zamow, $webdesign_tbl, $PHP_SELF, $ac
cess, $op, $goto;
if($access=='root') {
$result = mysql_query(\"INSERT INTO $webdesign_tbl VALUES(NULL, '$autor', '$cena', '$zobacz1', '$zobacz2', '$zamow')\");
if($goto=='') header(\"Location: admin.php?op=$op\"); else header(\"Location: $goto\"); exit;
}
}
function edytuj_nazwa() {
global $PHP_SELF, $webdesign_tbl, $access, $op, $goto, $id;
if($access=='root') {
$result = mysql_query(\"SELECT * FROM $webdesign_tbl WHERE id=$id\");
$r = mysql_fetch_array($result);
$autor = $r['autor'];
$cena = $r['cena'];
$zobacz1 = $r['zobacz1'];
$zobacz2 = $r['zobacz2'];
$zamow = $r['zamow'];
echo'<form name=\"form2\" method=\"post\" action=\"admin.php?op='.$op.'\">
<table align=\"center\" border=\"0\" cellspacing=\"3\" cellpadding=\"0\">
<tr>
<td align=\"right\" class=\"uni_01\">Autor:</td>
<td class=\"next\">
<input type=\"text\" name=\"autor\" size=\"35\" value=\"'.$autor.'\"><input type=\"hidden\" name=\"z\" value=\"'.autor.'\">
</td>
</tr>
<tr>
<td align=\"right\" class=\"uni_01\">Cena:</td>
<td class=\"next\">
<input type=\"text\" name=\"cena\" size=\"35\" value=\"'.$cena.'\"><input type=\"hidden\" value=\"'.$cena.'\">
</td>
</tr>
<tr>
<td align=\"right\" class=\"uni_01\">Min img</td>
<td class=\"next\">
<input type=\"text\" name=\"zobacz1\" size=\"35\" value=\"'.$zobacz1.'\"><input type=\"hidden\" value=\"'.$zobacz1.'\">
</td>
</tr>
<tr>
<td align=\"right\" class=\"uni_01\">Big img</td>
<td class=\"next\">
<input type=\"text\" name=\"zobacz2\" size=\"15\" value=\"'.$zobacz2.'\"><input type=\"hidden\" value=\"'.$zobacz2.'\">
</td>
</tr>
<tr>
<td align=\"right\" class=\"uni_01\">E-Mail</td>
<td class=\"next\">
<input type=\"text\" name=\"zamow\" size=\"15\" value=\"'.$zamow.'\"><input type=\"hidden\" value=\"'.$zamow.'\">
</td>
</tr>
</table><BR><div class=\"uni_01\" align=\"center\">
<input style=\"font-weight: bold;\" type=\"submit\" name=\"ok\" value=\"zapisz\">
<input type=\"hidden\" name=\"goto\" value=\"'.$goto.'\">
<input type=\"hidden\" name=\"cmd\" value=\"edytuj\">
<input type=\"hidden\" name=\"id\" value=\"'.$id.'\">
</div>
</form>
<div class=\"uni_01\" align=\"center\">[<a href=\"javascript:history.back();\"> powrót </a>]</div>';
}
}
function edytuj() {
global $PHP_SELF, $webdesign_tbl, $id, $autor, $cena, $zobacz1, $zobacz2, $zamow
, $z, $op, $goto, $access;
if($access=='root') {
$result = mysql_query(\"UPDATE $webdesign_tbl SET autor='$autor', cena='$cena', zobacz1='$zobacz1', zobacz2='$zobacz2', zamow='$zamow', WHERE id=$id\");
if($goto=='') header(\"Location: admin.php?op=$op\"); else header(\"Location: $goto\"); exit;
}
}
function usun_nazwa() {
global $PHP_SELF, $access, $id, $webdesign_tbl, $op, $goto;
if($access=='root') {
$result = mysql_query(\"DELETE FROM $webdesign_tbl WHERE id='$id'\");
if($goto=='') header(\"Location: admin.php?op=$op\"); else header(\"Location: $goto\"); exit;
}
}
?>
admin/webdesign.name
Kod
Webdesign
<?
/*****************************************************/
/* jPORTAL - internetowy system portalowy */
/*****************************************************/
/* autor: Pawel 'jaco' Jaczewski */
/* email: info@websys.pl */
/*****************************************************/
include('config.php');
include('module/webdesign.inc.php');
function site_main() {
if($cmd=='') {
main_title_open();
main_title_close();
main_text_open();
webdesign_index();
main_text_close();
}
}
#=====================================================#
$site_title = 'Webdesign';
$meta_info = '';
include(\"theme/$theme/index.php\");
?>
Prosze O pomoc co tu jest żle (IMG:
http://forum.php.pl/style_emoticons/default/exclamation.gif)
PS
Zapytnaie SQL
CREATE TABLE webdesign (
id int(4) UNSIGNED NOT NULL AUTO_INCREMENT,
autor varchar(255) NOT NULL DEFAULT '',
cena varchar(255) NOT NULL DEFAULT '',
zobacz1 varchar(255) NOT NULL DEFAULT '',
zobacz2 varchar(255) NOT NULL DEFAULT '',
zamow varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (id)
) TYPE=MyISAM;
Ten post edytował zibi 1.09.2004, 09:28:20