online/offline

http://web-tourist.net/login/login/newsearch.php?wtsearch=n&newsearch=online%2Foffline

за друго незнам ..
 
justspy каза:
http://web-tourist.net/login/login/newsearch.php?wtsearch=n&newsearch=online%2Foffline

за друго незнам ..
едното е за форум др нз закакво е не ми говори нищо :( др поредложения моля ви помогнетеми
 
Код:
CREATE TABLE `users` (
`id` int(225) NOT NULL auto_increment,
`username` varchar(225) NOT NULL,
`password` varchar(225) NOT NULL,
`email` varchar(225) NOT NULL,
`ip` varchar(225) NOT NULL,
`skype` varchar(225) NOT NULL,
`level` varchar(225) NOT NULL,
`date` timestamp NOT NULL default '0000-00-00 00:00:00' on update CURRENT_TIMESTAMP,
`session` varchar(32) NOT NULL,
`activi` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM ;
логин
Код:
<?php
session_start();
?>
<?php
include ("inc/head.php");
$Login=(isset($_POST['Login']));
if($Login) {
$username = $_POST['username'];
$password1 = md5($_POST['password1']);
$ses = session_id();
$query = mysql_query("SELECT * FROM `users` WHERE session='$ses'");
$red = mysql_num_rows($query);
if ($red != NULL)
{
echo "Вие вече сте влезли с потребителско име:";
$my_ime = mysql_result($query, "0", "username");
echo " <a href='?p=logout'>Излез [ <b>".$my_ime."</b> ]</a>";
}
else
{
$query2 = mysql_query("SELECT * FROM `users` WHERE username='$username'");
$r = mysql_num_rows($query2);
if ($r != NULL)
{
$query3 = mysql_query("SELECT * FROM `users` WHERE username='$username' AND password='$password1'");
$r2 = mysql_num_rows($query3);
if ($r2 != NULL)
{
$query4 = mysql_query("UPDATE `users` SET session='$ses' WHERE username='$username' AND password='$password1'");
echo "<p class='margin'><center>Здравейте ,<b>".$username."</b>! <br />Моля почакай 1 секунда, за да бъдеш прехвърлен към началото.</p><br />";
echo '<meta http-equiv="refresh" content="1;url=index.php">';
$_SESSION['activi'] = true;
if ($_SESSION['activi'] == true){
$query5 = mysql_query("UPDATE `users` SET activi='true' WHERE username='$username' AND password='$password1'");
}
}
else
{
echo "Грешна парола за потребител: <b>".$username."</b> !";
}
}
else
{
echo "Няма такъв потребител !";
}
}
}
else
{
echo '';
?>
<form id="form1" name="form1" method="post" >
<table align="center" id="font2">
<tr>
<td align="right">Потребител : </td>
<td><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td align="right">Парола : </td>
<td><input name="password1" type="password" id="password1"></td>
</tr>
<tr>
<td colspan="0" align="center">
<input name="Login" type="submit" id="Login" value="Влез">
</td>
</tr>
</table>
</form>
<br>
<div align="center"><a href="?p=reg">Регистрация</a><br />
<?php
}
?>

профил



Код:
<?php
session_start();
include ("inc/head.php");
$ses = session_id();
$query = mysql_query("SELECT * FROM `users` WHERE session='$ses'");
$red = mysql_num_rows($query);
if ($red != NULL) {
$my_ime = mysql_result($query, "0", "username");
if($_GET['username'] == NULL) {
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Информация</td>
</tr>
<tr>
<td>';
echo '<center>Не сте избрали юзър!</center>';
echo '
</td>
</tr>
</table>';
}
else {
echo '
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Разглеждане на профил</td>
</tr>
<tr>
<td>';
if (!isset($_GET['username'])){
$getusername = mysql_query("SELECT * from users order by id asc");
while ($user = mysql_fetch_array($getusername)) {
}
}
else {
$getusername = mysql_query("SELECT * from users where username = '$_GET[username]'");
$usernamenum = mysql_num_rows($getusername);
if ($usernamenum == 0) {
echo ("Няма потребител");
}
else {
$profile = mysql_fetch_array($getusername);
echo'
<table width="60%" border="0">
<tr>
<td colspan="2" rowspan="2" align="center">Информация</td>
</tr>
<tr>
<td> </td></tr>
<tr>
<td>Потребителско име:</td>
<td>'.$profile['username'].'</td>
</tr>
<tr>
<td>Ранг:</td>
<td>';
if($profile['level'] == "1") {
echo "Потребител";
}
if($profile['level'] == "2") {
echo "Модератор";
}
if($profile['level'] == "3") {
echo "Администратор";
}
if($profile['level'] == "4") {
echo "VIP";
}
echo '</td>
</tr>
<tr>
<td>Дата на регистрация:</td>
<td>'.$profile['date'].'</td>
</tr>
<tr>
<td colspan="2"><hr /></td>
</tr>
<tr>
<td>Статус:</td>
<td>';
if($profile['activi'] == true) {
echo 'Онлайн е';
}
else {
echo 'Офлайн е';
}
echo '</td>
</tr>
<tr>
<td>Skype:</td>
<td>';
if($profile['skype'] == NULL) {
echo 'Не е указано';
}
else {
echo $profile['skype'];
}
echo '</td>
</tr>
<tr>
<td align="left">Ел. поща:</td>
<td>';
if($profile['email'] == NULL) {
echo 'Не е указан';
}
else {
echo $profile['email'];
}
echo '
</table>
';
}
}
echo '</td>
</tr>
</table>';
}
}
else
{
@no_session();
}
?>

и логаут
Код:
<?php
include ("inc/head.php");
echo '<center>Изход от системата</center>
<br />';
$ses = session_id();
$q = mysql_query("SELECT * FROM `users` WHERE session='$ses'");
$r = mysql_num_rows($q);
if ($r != NULL)
{
$name = mysql_result($q, "0", "username");
$q2 = mysqL_query("UPDATE `users` SET session='' WHERE username='$name'");
$q3 = mysqL_query("UPDATE `users` SET activi='' WHERE username='$name'");
echo 'Успешно изязохте.';
}
else
{
echo "Не сте логнат";
}
?>
 
Вие дадохте една точка за support на sorRy .
Натиснете тук за да се върнете в темата.
 

Горе