Kod php:
<?php
/**
* @author Khulmar
* @license GNU/GPL
* @version 0.1
* @copyright (C) 2009 ComandRPG
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once('head.php');
?>
<div class="post">
<div class="postheader"><h1>Poczta</h1></div>
<div class="postcontent">
<?php
function clip ($text, $number)
{
if (strlen($text) > $number)
{
$text = preg_replace('/s+?(S+)?$/', '', substr($text, 0, $number+1));
$text = substr($text, 0, $number);
return $text.'...';
}
else return $text;
}
function close($text)
{
echo "$text";
echo '</div><div class="postfooter"></div></div>';
require_once('bottom.php');
exit;
}
$num = mysql_num_rows(mysql_query("SELECT * FROM `mail` WHERE `owner`=".$user -> get['id']." ORDER BY `id` DESC"));
if ($user -> get['rank'] == 'User') $max_num = 100;
else $max_num = 500;
if ($num < $max_num) echo '<b>Pojemność</b>: '.$num.'/'.$max_num.'<br /><br />';
else echo '<b>Pojemność</b>: <span style="color:red;">'.$num.'/'.$max_num.'</span><br /><br />';
if (!isset($_GET['czytaj']) && !isset($_GET['opcja']) && !isset($_GET['del']))
{
echo 'Odebrane | <a href="mail.php?opcja=wyslane">Wysłane</a> | <a href="mail.php?opcja=napisz">Napisz</a><br /><br />';
}
elseif (isset($_GET['opcja']) && $_GET['opcja'] == 'wyslane')
{
echo '<a href="mail.php">Odebrane</a> | Wysłane | <a href="mail.php?opcja=napisz">Napisz</a><br /><br />';
}
elseif (isset($_GET['opcja']) && $_GET['opcja'] == 'napisz')
{
echo '<a href="mail.php">Odebrane</a> | <a href="mail.php?opcja=wyslane">Wysłane</a> | Napisz<br /><br />';
}
else
{
echo '<a href="mail.php">Odebrane</a> | <a href="mail.php?opcja=wyslane">Wysłane</a> | <a href="mail.php?opcja=napisz">Napisz</a><br /><br />';
}
$bg = '#3F3F3F';
if (!isset($_GET['czytaj']) && !isset($_GET['opcja']) && !isset($_GET['del']))
{
$pobierz = mysql_query("SELECT * FROM `mail` WHERE `owner`=".$user -> get['id']." AND `type`='odebrane' ORDER BY `id` DESC");
echo '<table width="400" cellpadding="0" cellspacing="1">
<tr>
<td width="50"><p style="color:white;">Lp</p></td>
<td width="150"><p style="color:white;">Nadawca</p></td>
<td width="150"><p style="color:white;">Temat</p></td>
<td width="50"><p style="color:white;">Opcje</p></td>
</tr>';
$pobierz_num = mysql_num_rows($pobierz);
$lp = $pobierz_num;
if($pobierz_num > 0)
{
while($i = mysql_fetch_object($pobierz))
{
echo '<tr>';
if ($i -> if_read != 'N') echo '<td><p>'.$lp.' <blink>!!</blink></p></td>';
else echo '<td><p>'.$lp.'</p></td>';
echo '<td><p>'.$i -> autor.' ('.$i -> autor_id.')</p></td>
<td><p>'.clip($i -> title, 20).'</p></td>
<td><p><a href="mail.php?czytaj='.$i -> id.'">Czytaj</a><br /><a href="mail.php?del='.$i -> id.'">Skasuj</a></p></td>
</tr>';
$lp--;
}
}
else close ('</table><br />Nie masz żadnych wiadomości!');
echo '</table>';
}
if (isset($_GET['czytaj']))
{
if (ereg("^[0-9]*$", $_GET['czytaj']))
{
$check = mysql_fetch_object(mysql_query('SELECT * FROM `mail` WHERE `id`='.$_GET['czytaj'].' AND `owner`='.$user -> get['id']));
if ($check == true)
{
if (!isset($_POST['odpisz']))
{
if ($check -> if_read != 'N') mysql_query("UPDATE `mail` SET `if_read`='N' WHERE `id`=".$_GET['czytaj']);
$od = mysql_fetch_object(mysql_query("SELECT `login` FROM `konta` WHERE `id`=".$check -> owner));
echo '<table style="border:1px solid '.$bg.'; padding:5px;"><tr><td>
<b>Data wysłania:</b> '.$check -> date.' <br />
<b>Nadawca:</b> '.$check -> autor.' ('.$check -> autor_id.')<br />
<b>Odbiorca:</b> '.$od -> login.' ('.$check -> owner.')<br />
<b>Tytuł:</b> '.$check -> title.'</b>
</td></tr></table><br /><br />
'.$check -> text.'
<br /><br />
<form method="post" action="mail.php?czytaj='.$_GET['czytaj'].'#odpisz">
<textarea name="text" style="width:300px; height:200px;"></textarea><br />
<input type="submit" name="odpisz" style="width:302px;" value="Odpisz">
</form>';
}
else
{
if ($num < $max_num)
{
if (!empty($_POST['text']))
{
$date = date("Y-m-d H:i:s");
$_POST['text'] = nl2br(strip_tags($_POST['text']));
$title = $check -> title.': odp';
mysql_query("INSERT INTO `mail` (`owner`, `text`, `title`, `autor_id`, `autor`, `date`, `type`) VALUES (".$check -> autor_id.", '<span style=font-size:15px;>".$user -> get['login']."</span></i>: ".$_POST['text']."', '".$title."', ".$user -> get['id'].", '".$user -> get['login']."', '".$date."', 'odebrane')");
mysql_query("INSERT INTO `mail` (`owner`, `text`, `title`, `autor_id`, `autor`, `date`, `type`, `do_user`) VALUES (".$user -> get['id'].", '<span style=font-size:15px;>".$user -> get['login']."</span></i>: ".$_POST['text']."', '".$title."', ".$user -> get['id'].", '".$user -> get['login']."', '".$date."', 'wyslane', ".$check -> autor_id.")");
echo '<span style="color:green;">Wysłano wiadomość do usera o id '.$check -> autor_id.'</span>';
}
else echo '<span style="color:red;">Nic nie wpisano!</span>';
}
else echo '<span style="color:red;">Twoja poczta jest zapełniona. Wykasuj niektóre wiadomości, aby móc dalej pisać</span><br /><br />';
}
}
else echo '<span style="color:red;">Nie ma takiej wiadomości!</span>';
}
else echo '<span style="color:red;">Nie ma takiej wiadomości!</span>';
}
if (isset($_GET['opcja']) && $_GET['opcja'] == 'wyslane')
{
if (!isset($_GET['zobacz']))
{
$wyslane = mysql_query("SELECT * FROM `mail` WHERE `owner`=".$user -> get['id']." AND `type`='wyslane' ORDER BY id DESC");
$number = mysql_num_rows($wyslane);
echo '<table width="400" cellpadding="0" cellspacing="1">
<tr>
<td width="50"><p style="color:white;">Lp</p></td>
<td width="150"><p style="color:white;">Do</p></td>
<td width="150"><p style="color:white;">Temat</p></td>
<td width="50"><p style="color:white;">Opcje</p></td>
</tr>';
$lp = $number;
if ($number > 0)
{
while ($i = mysql_fetch_object($wyslane))
{
$do = mysql_fetch_object(mysql_query("SELECT `login` FROM `konta` WHERE `id`=".$i -> do_user));
echo '<tr>
<td style="padding:5px;">'.$lp.'</td>
<td style="padding:5px;">'.$do -> login.' ('.$i -> do_user.')</td>
<td style="padding:5px;">'.clip($i -> title, 30).'</td>
<td style="padding:5px;"><a href="mail.php?opcja=wyslane&zobacz='.$i -> id.'">Czytaj</a><br /><a href="mail.php?del='.$i -> id.'">Skasuj</a></td>
</tr>';
$lp--;
}
}
else close ('</table><br />Brak wysłanych listów!');
echo '</table>';
}
else
{
$check = mysql_fetch_object(mysql_query('SELECT * FROM `mail` WHERE `id`='.$_GET['zobacz'].' AND `owner`='.$user -> get['id']));
if ($check == true)
{
$text = nl2br(strip_tags($check -> text));
$od = mysql_fetch_object(mysql_query("SELECT `login` FROM `konta` WHERE `id`=".$check -> do_user));
echo '<table style="border:1px solid '.$bg.'; padding:5px;"><tr><td>
<b>Data wysłania:</b> '.$check -> date.' <br />
<b>Nadawca:</b> '.$check -> autor.' ('.$check -> autor_id.')<br />
<b>Odbiorca:</b> '.$od -> login.' ('.$check -> do_user.')<br />
<b>Tytuł:</b> '.$check -> title.'</b>
</td></tr></table><br /><br />
'.$check -> text.'<br /><br />';
}
else echo '<span style="color:red;">Nie ma takiej wiadomości!</span>';
}
}
if (isset($_GET['opcja']) && $_GET['opcja'] == 'napisz')
{
if (!isset($_POST['napisz']))
{
if (isset($_GET['do'])) $value = $_GET['do'];
else $value = 'Login usera';
echo '<form method="post" action="mail.php?opcja=napisz#napisz">
<input type="text" name="do" style="width:300px;" value="'.$value.'" onfocus="if (this.value == \'Login usera\') this.value = \'\';" onblur="if (this.value == \'\') this.value = \'Login usera\';"><br />
<input type="text" style="width:300px;" name="title" value="Tytuł" onfocus="if (this.value == \'Tytuł\') this.value = \'\';" onblur="if (this.value == \'\') this.value = \'Tytuł\';"><br />
<textarea name="text" style="width:300px; height:200px;"></textarea><br />
<input type="submit" name="napisz" style="width:302px;" value="Napisz">
</form>';
}
else
{
if ($num < $max_num)
{
if ($_POST['do'] == $user -> get['login'])
{
$tescik = mysql_fetch_array(mysql_query('SELECT `login`, `id` FROM `konta` WHERE `login`="'.$_POST['do'].'"'));
if ($tescik == false) close ('Użytkownik do którego wysyłasz wiadomość nie istnieje!');
if (!empty($_POST['text']) && !empty($_POST['do']) && !empty($_POST['title']))
{
$date = date("Y-m-d H:i:s");
$_POST['text'] = nl2br(strip_tags($_POST['text']));
mysql_query("INSERT INTO `mail` (`owner`, `text`, `title`, `autor_id`, `autor`, `date`, `type`) VALUES (".$tescik['id'].", '<i><span style=font-size:15px;>".$user -> get['login']."</span></i>: ".$_POST['text']."', '".$_POST['title']."', ".$user -> get['id'].", '".$user -> get['login']."', '".$date."', 'odebrane')");
mysql_query("INSERT INTO `mail` (`owner`, `text`, `title`, `autor_id`, `autor`, `date`, `type`, `do_user`) VALUES (".$user -> get['id'].", '<i><span style=font-size:15px;>".$user -> get['login']."</span></i>: ".$_POST['text']."', '".$_POST['title']."', ".$user -> get['id'].", '".$user -> get['login']."', '".$date."', 'wyslane', ".$tescik['id'].")");
echo '<span style="color:green;">Wysłano wiadomość do '.$_POST['do'].'</span>';
}
else echo '<span style="color:red;">Wypełnij wszystkie pola!</span>';
}
else echo '<span style="color:red;">Nie możesz wysyłać wiadomości do siebie!</span>';
}
else
{
echo '<span style="color:red;">Twoja poczta jest zapełniona. Wykasuj niektóre wiadomości, aby móc dalej pisać</span><br /><br />';
}
}
}
if (isset($_GET['del']))
{
if (mysql_fetch_object(mysql_query("SELECT `id` FROM `mail` WHERE `owner`=".$user -> get['id']." AND `id`=".$_GET['del'])))
{
mysql_query('DELETE FROM `mail` WHERE `id`='.$_GET['del']);
echo '<span style="color:green;">Skasowano wiadomość</span>';
}
else echo '<span style="color:red;">Nie ma takiej wiadomości!</span>';
}
?>
</div>
<div class="postfooter"></div>
</div>
<?php
require_once('bottom.php');
?>
2:
Kod php:
<?php
/**
* @author Khulmar
* @license GNU/GPL
* @version 0.1
* @copyright (C) 2009 ComandRPG
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Najlepiej by hasło było długim ciągiem znaków i liczb
$pass = 'Tu Wpisz swoje hasło';
if ($_GET['pass'] == $pass)
{
require_once("common/config.php");
require_once("common/reset.php");
reset();
exit;
}
else die ('Złe hasło!');
/*
* Instrukcja:
* Aby uruchomić resety zarejestruj się na jakiejś stronie która oferuje cronjobs (cron) np. webcron.org, webcron.pl i podaj jako adres resetu:
*
* http://twojadres.pl/execute_reset.php?pass=tu_wpisz_swoje_hasło_które_podałeś_wyżej
*
*/
?>
wpisuje wszysko dobrze pojawia się białe okno tak jakby reset się zrobił a tu lipa
Zakładki