система за регистрация

flex

Registered
извинявам се за темата но ми трябва малко помощ.имам проблем със системата ми за регистация (тук)


тук регистрацията работи, а тук не.
всички неща са в една директория 2-та кода са еднакви, и пак не работи.
Защо? ако някой може да ми помоглне плс да пише!

ето кода на страницата на която става:
Код:
<html>
<head>
<meta content="text/html; charset=windows-1251" http-equiv="Content-Type">
<body background="http://farfun.freehostia.com/images/bg.gif" text="#ff0000" link="ff0000" alink="ff0000" vlink="ff0000">
<title>Добре дошли във Fun For Free</title>
<style>

</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
<table width="738" border="0" cellpadding="0" cellspacing="0" background="http://farfun.freehostia.com/images/overall_bg.gif">
	<tr>
		<td colspan="8">

			<img src="http://farfun.freehostia.com/images/index_01.gif" width="738" height="43" alt=""></td>
	</tr>
	<tr>
		<td colspan="8">
			<img src="http://farfun.freehostia.com/images/banner.gif" width="738" height="135" alt=""></td>
	</tr>
	<tr>
		<td colspan="8">
			<img src="http://farfun.freehostia.com/images/quick_bar.gif" width="738" height="12" border="0" alt="" usemap="#quicklinks"></td>

	</tr>
	<tr>
		<td colspan="8">
			<img src="http://farfun.freehostia.com/images/index_04.gif" width="738" height="10" alt=""></td>
	</tr>
	<tr>
		<td colspan="2">
			<img src="http://farfun.freehostia.com/images/index_05.gif" width="38" height="83" alt=""></td>
		<td colspan="3" background="http://farfun.freehostia.com/images/ticker.gif" width="301" height="83">

		
		
			
			

		
		
		</td>
		<td background="http://farfun.freehostia.com/images/ticker2.gif" width="359" height="83">
		
		
			
		
		
		</td>
		<td colspan="2">
			<img src="http://farfun.freehostia.com/images/index_08.gif" width="40" height="83" alt=""></td>
	</tr>
	<tr>

		<td colspan="8">
			<img src="http://farfun.freehostia.com/images/index_09.gif" width="738" height="11" alt=""></td>
	</tr>
	<tr>
		<td colspan="8">
			<img src="http://farfun.freehostia.com/images/index_10.gif" width="738" height="34" alt=""></td>
	</tr>
	<tr>
		<td>

			<img src="http://farfun.freehostia.com/images/index_11.gif" width="6" height="351" alt=""></td>
		<td valign="top" colspan="2" background="http://farfun.freehostia.com/images/nav.gif" width="146">
		
		
<script src="http://www.clocklink.com/embed.js"></script><script type="text/javascript" language="JavaScript">obj = new Object;obj.clockfile = "5010-red.swf";obj.TimeZone = "EET";obj.width = 140;obj.height = 45;obj.wmode = "transparent";showClock(obj);</script>

<br>
			<div class="navhead">Навигация</div>
			<a href="http://fun.for.free.bg/"> :: Начало</a><br>
			
		<a href="http://fun.for.free.bg/ex.html"> :: Банер размяна</a><br>
			<a href="http://fun.for.free.bg/con.html"> :: За връзка</a><br>

<div class="navhead">Влез</div>

<? 

// 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 ("Вие успешно влязохте в акаунта си."); 
// 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


?>


			<div class="navhead">Игри</div>
			<a href="http://fun.for.free.bg/arcade.html"> :: Аркадни </a><br>

			<a href="http://fun.for.free.bg/action.html"> :: Екшън</a><br>
			<a href="http://fun.for.free.bg/stradegy.html"> :: Стратегии</a><br>
			<a href="http://fun.for.free.bg/sport.html"> :: Спортни</a><br>
			
			<div class="navhead">Галерия</div>
			<a href="http://fun.for.free.bg/momi4eta.html"> :: Момичета</a><br>

			<a href="http://fun.for.free.bg/fun.html"> :: Яки</a><br>
			<a href="http://fun.for.free.bg/other.html"> :: Други</a><br>
			
<div class="navhead">Чат</div>
			<a href="http://fun.for.free.bg/java.html"> :: Java chat</a><br>
			<a href="http://fun.for.free.bg/chat.html"> :: Web chat</a><br>

			

<div class="navhead">Безплатни смси</div>
			<a href="http://fun.for.free.bg/chat.html"> :: Мтел</a><br>
			<a href="http://fun.for.free.bg/chat.html"> :: Глобул</a><br>
			<div class="navhead">Гласувайте за нас</div>
<br>
<span id="jiggle0" class="jc"><b><a href="http://bgtop.net/in.php/1164538218" target="_blank"><img src="http://img459.imageshack.us/img459/5311/bgtoplogo54654in6.gif"  border="0"></a>

<a href="http://mpogtop.com/in.php/1169661183" target="_blank"><img src="http://mpogtop.com/images/new/mopg88313.jpg" border="0"></a></b></span>
<br>
<div class="navhead">Брояч</div>
<br>
<!- NACHALO NA TYXO.BG BROYACH -->
<a href="http://www.tyxo.bg/?11060" title="Tyxo.bg counter" target="_blank"><script language=JavaScript>

</script><noscript><img src="http://cnt.tyxo.bg/11060" width=88 height=31       border=0
alt="Tyxo.bg counter" /></noscript></a>
<!- KRAI NA TYXO.BG BROYACH -->
		
		
		</td>
		<td>
			<img src="http://farfun.freehostia.com/images/index_13.gif" width="14" height="351" alt=""></td>

		<td valign="top" colspan="3" background="http://farfun.freehostia.com/images/content.gif" width="567">
		
            
		    <div class="contenthead"><center>Поздрави</center></div>
            <center><big><big><big><big><script language=JavaScript>
var h=(new Date()).getHours();
if (h > 22 || h < 7) document.write("Лека нощ!!(честита баба марта)");
if (h > 6 && h < 12) document.write("Добро утро!!(честита баба марта)");
if (h > 12 && h < 19) document.write("Добър ден!!(честита баба марта)");
if (h > 18 && h < 22) document. write("Добър вечер!!(честита баба марта)")
</script></big></big></big></big></center>
 <div class="contenthead"></div>

            
            <p>
			 


                                 
		    
		</td>
		<td>
			<img src="http://farfun.freehostia.com/images/index_15.gif" width="5" height="351" alt=""></td>

	</tr>
	<tr>
		<td colspan="8">
			<img src="http://farfun.freehostia.com/images/overall_bg.gif" width="738" height="19" alt=""></td>
	</tr>
	<tr>
		<td colspan="8">
			<img src="http://farfun.freehostia.com/images/index_18.gif" width="738" height="34" border="0" alt="" usemap="#copyright"></td>
	</tr>

	<tr>
		<td>
			<img src="http://farfun.freehostia.com/images/spacer.gif" width="6" height="1" alt=""></td>
		<td>
			<img src="http://farfun.freehostia.com/images/spacer.gif" width="32" height="1" alt=""></td>
		<td>
			<img src="http://farfun.freehostia.com/images/spacer.gif" width="114" height="1" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="14" height="1" alt=""></td>

		<td>
			<img src="http://farfun.freehostia.com/images/spacer.gif" width="173" height="1" alt=""></td>
		<td>
			<img src="http://farfun.freehostia.com/images/spacer.gif" width="359" height="1" alt=""></td>
		<td>
			<img src="http://farfun.freehostia.com/images/spacer.gif" width="35" height="1" alt=""></td>
		<td>
			<img src="http://farfun.freehostia.com/images/spacer.gif" width="5" height="1" alt=""></td>
	</tr>

</table>
<map name="quicklinks">

<area shape="rect" alt="" coords="617,0,650,11" href="#">
<area shape="rect" alt="" coords="567,0,609,11" href="#">
<area shape="rect" alt="" coords="532,0,560,11" href="#">
</map>

<map name="copyright">
<area shape="rect" alt="Layout Designed by: rigiozeta :: SenkouRyu ::" coords="573,16,711,26" href="http://senkouryu.net">
</map>
</center>

<div style="font-size: 0.8em; text-align: center; margin-top: 1.0em; margin-bottom: 1.0em;">
Админи <a href="http://fun.for.free.bg/imorala.html">imorala</a> & <a href="http://fun.for.free.bg/flex.html">flex</a>

</div>
</body>
</html>
и кода на страницата на която става:
Код:
<?PHP
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 ("Вие успешно влязохте в акаунта си."); 
// 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


?>

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

Back
Горе