Бъгна ми се

jooorooo

Registered
дай кода на логин.пхп

имам чувството че session() не ти е на 2-ри ред или имаш поленце преди <?php
 

jooorooo

Registered
http://farfun.freehostia.com/login/login.php

http://farfun.freehostia.com/login/register.php

а дори си мисля че може и от фреима да е.
 

djvato

Registered
как няма да се бъгва ... на мен ми се бъгна и опера и мозила и всичко докато го отворя :roll:
 

wingmanz

Registered
Warning: Cannot modify header information - headers already sent by (output started at /home/www/farfun.freehostia.com/login/login.php:10) in /home/www/farfun.freehostia.com/login/login.php on line 229

Warning: Cannot modify header information - headers already sent by (output started at /home/www/farfun.freehostia.com/login/login.php:10) in /home/www/farfun.freehostia.com/login/login.php on line 230
Вие успешно влязохте в акаунта си.

Статистика:
Последно регистриран: wingmanz
Брой потребители:15
Online: 2
 

imorala

Registered
<?
oB_start();
// allows you to use cookies.
include("config.php");
if (!$logged[username])
{
if (!$_POST[login])
{
echo("
<center><form method=\"POST\">
<table>
<tr>
<td align=\"right\">
Потребител: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\">
</td>
</tr>
<tr>
<td align=\"right\">
Парола: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"password\">
</td></tr><tr>
<td align=\"center\">
<input type=\"submit\" name=\"login\" value=\"Влез\">
</td></tr><tr>
<td align=\"center\">
<a href=\"register.php\">Регистрирай се</a>
</td></tr></table></form></center>");
}
if ($_POST[login]) {
// the form has been submitted. We continue...
$username=$_POST['username'];
$password = md5($_POST[password]);
// the above lines set variables with the submitted information.
$info = mysql_query("SELECT * FROM register WHERE username = '$username'") or die(mysql_error());
$data = mysql_fetch_array($info);
if($data[password] != $password) {
// the password was not the user's password!
echo "Грешен потребител или парола!";
}else{
// the password was right!
$query = mysql_query("SELECT * FROM register WHERE username = '$username'") or die(mysql_error());
$user = mysql_fetch_array($query);
// gets the user's information
setcookie("id", $user[id],time()+(60*60*24*5), "/", "");
setcookie("pass", $user[password],time()+(60*60*24*5), "/", "");
// the above lines set 2 cookies. 1 with the user's id and another with his/her password.
echo ("<meta http-equiv=\"Refresh\" content=\"0; URL=\"/>Вие успешно влязохте в акаунта си.");
// modify the above line...add in your site url instead of yoursite.com
}
}
}
else
{
// we now display the user controls.
echo ("<center>Добре дошли <b>$logged[username]</b><br /></center>
<a href=\"editprofile.php\">Промени профила си</a><br />
<a href=\"members.php\">Виж всички регистрирани потребители</a><br />
<a href=\"search.php\">Търси за потребители</a><br />
<a href=\"logout.php\">Излез от акаунта си</a>");
}

echo'<br><br>
Статистика:<br>';

$last = mysql_query("SELECT id, username FROM register ORDER BY id DESC LIMIT 1");
while($q=mysql_fetch_assoc($last)){
echo "<b>Последно регистриран:</b>
<a href='members.php?user=". $q['username'] ."'>".$q['username']."</a><br />";}


$register = mysql_query("SELECT count(id) as total FROM register");
while($c=mysql_fetch_array($register)){
echo "<b>Брой потребители:</b>" .$c['total']. ""; }

echo '<br>';


$ip = $_SERVER['REMOTE_ADDR'];
$time = time();
$cutoff = 15; //online cut of time
$exists = 0;
$users = 0;
$user = "";

$fp = fopen ("online.txt","r+"); //if the file exists open it

while (!feof($fp))
{
$user[] = chop(fgets($fp,65536));
}
fseek($fp,0,SEEK_SET);


foreach ($user as $line)
{
list($oldip,$oldtime) = explode('|',$line);
if ($oldip == $ip) {$oldtime = $time;$exists = 1;} //check to see if the user is already in the text file
if ($time < $oldtime + ($cutoff * 60)) //see if the last time the user visited is past the cut off time
{
fputs($fp,"$oldip|$oldtime\n"); //write the old data to the text file
$users = $users + 1; // add one to the user count
}
}


if ($exists == 0) //if the user isn't in the text file already:
{
fputs($fp,"$ip|$time\n"); //write the new data to the text file
$users = $users + 1; //add one to the user count
}


fclose ($fp); //close the text file
print "<b>Online:</b> $users"; //display the number of users online


?>
<center>
<?PHP
$username=$logged[username];
$avatar = 'avatari/'.$username.'.gif';
if(empty($avatar)){
echo "<img src='avatari/nqma.jpg'>";
}
else {
echo "<img border=0 src=$avatar>";
} ?>



това е на логина
 

imorala

Registered
ето го и регистера
<center><?php
ob_start();
// allows you to use cookies
include("config.php");
//gets the config page
if ($_POST[register]) {
$username = $_POST[username];
$password = $_POST[pass];
$cpassword = $_POST[cpass];
$email = $_POST[emai1];
//the above lines set variables with the user submitted information
if($username==NULL|$password==NULL|$cpassword==NULL|$email==NULL) {
//checks to make sure no fields were left blank
echo "A field was left blank.";
}else{
//none were left blank! We continue...
if($password != $cpassword) {
// the passwords are not the same!
echo "Passwords do not match";
}else{
// the passwords are the same! we continue...
$password = md5($password);
// encrypts the password
$checkname = mysql_query("SELECT username FROM register WHERE username='$username'");
$checkname= mysql_num_rows($checkname);
$checkemail = mysql_query("SELECT email FROM register WHERE email='$email'");
$checkemail = mysql_num_rows($checkemail);
if ($checkemail>0|$checkname>0) {
// oops...someone has already registered with that username or email!
echo "The username or email is already in use";
}else{
// noone is using that email or username! We continue...
$username = htmlspecialchars($username);
$password = htmlspecialchars($password);
$email = htmlspecialchars($email);
// the above lines make it so that there is no html in the user submitted information.
//Everything seems good, lets insert.
$query = mysql_query("INSERT INTO `register` (username, password, email) VALUES('$username','$password','$email')");
// inserts the information into the database.
echo "You have successfully registered!";
}
}
}
}
else
{
// the form has not been submitted...so now we display it.
echo ("
<center>
<form method=\"POST\">
Потребителско име: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\"><br />
Парола: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"pass\"><br />
Повторете паролата: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"cpass\"><br />
Email адрес: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"emai1\"><br />
<input name=\"register\" type=\"submit\" value=\"Регистрирай се\">
</form>
</center>
");
}
?>
 

jooorooo

Registered
ето го и регистера
<center><?php

този центер го махни от там.. трябва да <?php е в самото начало на 1-ви ред, а ob_start(); на 2-ри
 

flex

Registered
проблема не е при регистрацията ! тя си бачка проблема е логина ако може да го погледнете ще съм ви много благодарен!
 

djvato

Registered
flex каза:
проблема не е при регистрацията ! тя си бачка проблема е логина ако може да го погледнете ще съм ви много благодарен!
ми като неработи тоз логин намерете си други в сайта има сигурно 10 урока за логин с база без база и т.н. :?:
 

djvato

Registered
imorala каза:
да ама немога да се управя с маиску тра помоля някои да го направи ти ще можеш ли
само не разбрах с кое трябва да се оправя?
 

Горе