kefirek napisał/a:
Baza danych wyglądała by tak wchodzisz w dodatkowe strony i jako nazwa wpisz np. aaa i wklej ten kod i daj podgląd
<?php
$result = dbquery("DROP TABLE IF EXISTS ".$db_prefix."notatki");
$result = dbquery("CREATE TABLE ".$db_prefix."notatki (
`notatka_id` smallint(5) unsigned NOT NULL auto_increment,
`data` int(10) unsigned NOT NULL default '0',
`Tytuł` varchar(200) NOT NULL default '',
`Tresc` TEXT NOT NULL default '',
`unser_id` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`notatka_id`)
) TYPE=MyISAM;");
if (!$result) $fail = "1";
?>
Teraz edytujesz plik infusions\user_info_panel\ user_info_panel.php
I dodajesz w nim to co na czerwono
openside($userdata['user_name']);
$msg_count = dbcount("(message_id)", "messages", "message_to='".$userdata['user_id']."' AND message_read='0'AND message_folder='0'");
echo "<img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."edit_profile.php' class='side'>".$locale['080']."</a><br>
<img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."messages.php' class='side'>".$locale['081']."</a><br>
<img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."members.php' class='side'>".$locale['082']."</a><br>
[color=red][b]<img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."notatki.php' class='side'>Moje notatki</a><br>[/b][/color]
\n";
if (iADMIN && (iUSER_RIGHTS != "" || iUSER_RIGHTS != "C")) {
I na końcu tworzysz plik notatki.php w którym można dodawać edytować notaki itp.
I oto kod pliku notatki.php
<?php
require_once "maincore.php";
require_once "subheader.php";
require_once "side_left.php";
opentable('Notatki');
echo "
<table align='center' cellpadding='0' cellspacing='0' class='tbl'>
<tr>
<td width='130' align='center'><a href='".BASEDIR."notatki.php?akc=1'>Dodaj notatke</a><br></td>
<td width='130' align='center'><a href='".BASEDIR."notatki.php?akc=2'>Zarządzanie notatkami</a><br></td>
<td width='130' align='center'><a href='".BASEDIR."notatki.php?akc=3'>Moje notatki</a><br></td>
</tr>
</table>
<br><br><br>";
if ($akc == "1") {
if (isset($_POST['submit1'])) {
$tytul = strip_tags(trim($_POST['tytul']));
$tresc = strip_tags(trim($_POST['tresc']));
if (!get_magic_quotes_gpc())
{
$tytul = addslashes($tytul);
$tresc = addslashes($tresc);
}
$result = dbquery("INSERT INTO ".$db_prefix."notatki (data, Tytuł, Tresc, unser_id) VALUES ('".time()."', '$tytul', '$tresc', '".$userdata['user_id']."')");
echo "<center>Dane zostały zapisane prawidłowo</center>";
}else{
echo "
<form name='act1' method='post'>
<table align='center' cellpadding='0' cellspacing='0' class='tbl'>
<tr>
<td width='100'>Tytuł</td>
<td width='100'><input type='text' name='tytul' maxlength='50' class='textbox' style='width: 100px;'></td>
</tr>
<tr>
<tr>
<td valign='top' width='90'>Treść</td>
<td><textarea name='tresc' rows='10' class='textbox' style='width: 320px'></textarea></td>
</tr>
<tr>
<td align='center' colspan='2'>
<input type='submit' name='submit1' value='Wyślij' class='textbox'>
<input type='reset' value='Wyszyść' class='textbox'>
</td>
</tr>
</table>
</form>";
}
} elseif ($akc == "2") {
if (isset($_GET['edit'])) {
$notatka_id=$_GET['edit'];
$wynik = dbquery("SELECT * FROM ".$db_prefix."notatki WHERE notatka_id='$notatka_id'");
$r = dbarray($wynik);
$tytul = stripslashes($r['Tytuł']);
$tresc = stripslashes($r['Tresc']);
if (isset($_POST['submit12'])) {
$tytul = strip_tags(trim($_POST['tytul']));
$tresc = strip_tags(trim($_POST['tresc']));
if (!get_magic_quotes_gpc())
{
$tytul = addslashes($tytul);
$tresc = addslashes($tresc);
}
$zapytanie = dbquery("UPDATE ".$db_prefix."notatki SET data='".time()."', Tytuł='$tytul', Tresc='$tresc', unser_id='".$userdata['user_id']."' WHERE notatka_id='$notatka_id'");
echo "<center>Dane zostały zapisane prawidłowo</center>";
} else {
echo "
<form name='act1' method='post'>
<table align='center' cellpadding='0' cellspacing='0' class='tbl'>
<tr>
<td width='100'>Tytuł</td>
<td width='100'><input type='text' name='tytul' value='$tytul' maxlength='50' class='textbox' style='width: 100px;'></td>
</tr>
<tr>
</tr>
<tr>
<tr>
<td valign='top' width='90'>Treść</td>
<td><textarea name='tresc' rows='10' class='textbox' style='width: 320px'>$tresc</textarea></td>
</tr>
<tr>
<td align='center' colspan='2'>
<input type='submit' name='submit12' value='Wyślij' class='textbox'>
<input type='reset' value='Wyszyść' class='textbox'>
</td>
</tr>
</table>
</form>";
}
} else {
echo "<table align='center' cellpadding='0' cellspacing='0' class='tbl'>
<tr>
<td width='80' align='center'><b>Tytuł</b></td>
<td width='80' align='center'></td>
</tr>";
dbquery("DELETE FROM ".$db_prefix."notatki WHERE `notatka_id`='".mysql_real_escape_string($_GET['notatka_id'])."'");
$wynik = dbquery("SELECT * FROM ".$db_prefix."notatki ORDER BY data");
if(dbrows($wynik) > 0) {
while($r = dbarray($wynik))
{
echo "
<tr>
<td width='80' align='center'>".$r['Tytuł']."</td>
<td width='80' align='center'><a href=\"notatki.php?akc=2&edit={$r['notatka_id']}\">Edytuj</a> <a href=\"notatki.php?akc=2¬atka_id={$r['notatka_id']}\">Usuń</a></td>
</tr>";
}
} else { echo "<tr><td align='center' colspan='2'>Brak notatek w bazie</td></tr>"; }
echo "</table>";
}
} elseif ($akc == "3") {
echo "<table align='center' cellpadding='0' cellspacing='0' class='tbl'>
<tr>
<td width='120'>Tytuł</td>
<td width='120'>treść</td>
<td width='120'>Data dodania</td>
</tr>";
$wynik = dbquery("SELECT * FROM ".$db_prefix."notatki WHERE unser_id='".$userdata['user_id']."' ORDER BY data");
if(dbrows($wynik) > 0) {
while($r = dbarray($wynik))
{
echo "<table align='center' cellpadding='0' cellspacing='0' class='tbl'>
<tr>
<td width='120'>".$r['Tytuł']."</td>
<td width='120'>".$r['Tresc']."</td>
<td width='120'>".showdate("shortdate", $r['data'])."</td>
</tr>";
}
} else { echo "<tr><td align='center' colspan='3'>Brak notatek w bazie</td></tr>"; }
echo "</table>";
}
closetable();
require_once "side_right.php";
require_once "footer.php";
?>