проблем със сесиите (май...)

SandPrince

Registered
вчера си активирах старата версия на сайтa (impact-bg.net) - оправих всичко което имаше да се оправи. и си мислех че всичко е наред.

да ама неее.... :(

влизам си аз през логин формата на индекса , слагам отметка да ме запомни и така.... всичко ОК. обаче като затворя сайта и влезна пак - ми дава че не съм логнат.

Също и друг проблем - когато си посетя някой урок също прави проблем. даже два... :idea:
1. ако съм логнат ми се явава формата за коментари (както трябва да е!). реша ли да пусна коментар ми презарежда и дава че не съм логнат.
2. понякога като влезна в някой урок да го разглеждам даже не отчита че съм логнат...

и си мисля че всичко това е от сесиите. целия сайт е напълно интегриран със phpBB2 форума.

как мога да го оправя че адски дразни така...
 
според мен е от сесиите явно са различни от тези на пхпбб трябва да са едни и същи, за да знае какво да търси бисквитата
 
Код:
 setcookie("1", 2,time()+(60*60*24*5), "/", "");
като 1 ти е името на бисквитката, а 2 е променливата която ше запазваш примерно $_POST['username']
 
trevata каза:
Код:
 setcookie("1", 2,time()+(60*60*24*5), "/", "");
като 1 ти е името на бисквитката, а 2 е променливата която ше запазваш примерно $_POST['username']

e никъде немам такова нещо в сайта. ето кода на header.php

Код:
<?php
include"Src.php";
?> 
<?php
define('IN_PHPBB', true); 
$phpbb_root_path ='forum/'; 
include($phpbb_root_path . 'config.php'); 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 
$userdata = session_pagestart($user_ip, PAGE_INDEX);
include ("config.php");
$conn = mysql_connect($server, $dbusername, $dbpassword)or die("siatat ne moje d ase svarje kam db");
mysql_select_db($db_name, $conn) or die("Unable to select database");
?>
<?php
include("baned.php");
include("detect.php");

$sid = ( isset($_GET['sid']) ) ? '?sid='.$_GET['sid'] : '';
if ($userdata['user_new_privmsg'] != 0) {

$l_message_new = ( $userdata['user_new_privmsg'] == 1 ) ? '<a class="navigation" href="forum/privmsg.php?folder=inbox"> 1 ново ЛС</a>' : '
<a class="navigation" href="forum/privmsg.php?folder=inbox"> '.$userdata['user_new_privmsg'].' нови ЛС-та</a>';
} else {
$l_message_new = '<a class="navigation" href="forum/privmsg.php?folder=inbox"> Съобщения</a>';
}
if ($userdata['user_active']==0) {

$l_message_new = '<a class="navigation" href="forum/login.php?redirect=privmsg.php&folder=inbox"> Не сте влезли!</a>';

}
if (!isset($title)) {
$title = "Начало";
}
?> 
<html>

<head>
<meta http-equiv="Content-Language" content="bg">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<meta name="keywords" content="photoshop, illustrator, indesign, coreldraw, fireworks, flash , imageready,tutorial, bg , uroci">
<meta name="description" content="Уроци за графичен дизайн по photoshop, illustrator, indesign, coreldraw, fireworks, flash , imageready">
<title>Impact-bg - <?php echo $title; ?></title>
<script type="text/javascript" language="javascript"> window.onerror = function(){return true;} </script>
<script type="text/javascript" src="files/form.js"></script>
<script type="text/javascript" src="files/smile.js"></script>
<script type="text/javascript" src="files/bbcode.js"></script>
<script type="text/javascript" src="files/overlib.js"></script>
<LINK REL="SHORTCUT ICON" HREF="favicon.ico">
<link rel="stylesheet" href="impact.css" type="text/css">
</head>

<body link="#408CC8" vlink="#408CC8" alink="#408CC8" text="#333333">
  
 
  <center>
   <table align="center" cellpadding="0" cellspacing="0" width="778" style="border-bottom:1px solid #75BAFF; border-left:1px solid #75BAFF; border-right:1px solid #75BAFF; ">   
	<tr>
     <td background="images/tabfon.jpg" align="left" height="90" valign="top">
		<a href="http://www.impact-bg.net/"><img border="0" src="images/hedarche.gif"></a></td>
    </tr>
    <tr>
	<td>
   
   
   <table cellpadding="0" cellspacing="0" width="150">
    <tbody><tr>
    
     <td class="left" valign="top" width="130" bgcolor="#B1CCE0">
     
      <table width="150">
       <tbody><tr>
        <td id="navigation" height="25" width="150" align="left">
         <a class="navigation" href="http://www.impact-bg.net/index.php<?php echo $sid; ?>"> Начало</a>
        </td>
       </tr>
       	<tr>
        <td id="navigation" height="25" width="150" align="left">
         <a class="navigation" href="http://www.impact-bg.net/forum/index.php<?php echo $sid; ?>"> Форуми</a></td>
       </tr>
       	<tr>
        <td id="navigation" height="25" width="150" align="left">
         <a class="navigation" href="http://www.impact-bg.net/view.php<?php echo $sid; ?>"> Уроци</a></td>
       </tr>
            <tr><td id="navigation" height="25" width="150" align="left">
               <a class="navigation" href="http://www.impact-bg.net/forum/album.php<?php echo $sid; ?>"> Албум</a>
            </td></tr>
      	<tr>
        <td id="navigation" height="25" width="150" align="left">
         <a class="navigation" href="http://www.impact-bg.net/forum/favorite.php<?php echo $sid; ?>"> Любими теми</a></td>
       </tr>
       	<tr>
        <td id="navigation" height="25" width="150" align="left">
         <a class="navigation" href="http://www.impact-bg.net/resursi.php<?php echo $sid; ?>"> Ресурси</a></td>
       </tr>
       <tr>
        <td id="navigation" height="25" width="150" align="left">
         <a class="navigation" href="http://www.impact-bg.net/friends.php<?php echo $sid; ?>"> Приятели</a></td>
       </tr>
            <tr><td align="top" id="navigation" height="25" width="150" align="left">
               <a class="navigation" href="http://www.impact-bg.net/forum/faq.php<?php echo $sid; ?>"> FAQ</a>
            </td></tr>
            <tr><td align="top" id="navigation" height="25" width="150" align="left">
               <a class="navigation" href="http://www.impact-bg.net/forum/search.php<?php echo $sid; ?>"> Търсене</a>
            </td></tr>
            <tr><td id="navigation" height="25" width="150" align="left">

               <a class="navigation" href="http://www.impact-bg.net/forum/memberlist.php<?php echo $sid; ?>"> Потребители</a>
            </td></tr>
            <tr><td id="navigation" height="25" width="150" align="left">
               <a class="navigation" href="http://www.impact-bg.net/forum/groupcp.php<?php echo $sid; ?>"> Групи</a>
            </td></tr>
<?php
if ($userdata['user_active']==0) {
echo '            <tr><td id="navigation" height="25" width="150" align="left">
               <a class="navigation" href="http://www.impact-bg.net/forum/profile.php?mode=register"> Регистрация</a>
            </td></tr>';
} else {
echo '            <tr><td id="navigation" height="25" width="150" align="left">
               <a class="navigation" href="http://www.impact-bg.net/forum/profile.php?mode=editprofile'.$sid.'"> Профил</a>
            </td></tr>';
}
?>
<tr><td id="navigation" height="25" width="150" align="left"><?php
echo $l_message_new;
?>
</td></tr>
		<?php
		if ($userdata[user_active]==1)
			{
				echo '<tr>
		<td id="navigation" height="25" width="150" align="left"><a class="navigation" href="http://www.impact-bg.net/add.php'.$sid.'"> Напиши урок</a>        </td>
       </tr>
	   <tr>
		<td id="navigation" height="25" width="150" align="left"><a class="navigation" href="http://www.impact-bg.net/addcat.php'.$sid.'"> Категории</a>        </td>
       </tr>
	   <tr>
		<td id="navigation" height="25" width="150" align="left"><a class="navigation" href="http://www.impact-bg.net/visitor.php'.$sid.'"> Контрол</a>        </td>
       </tr>
	   <tr>
		<td id="navigation" height="25" width="150" align="left"><a class="navigation" href="http://www.impact-bg.net/pagent.php'.$sid.'"> Потребители</a>        </td>
       </tr>
	   <tr>
		<td id="navigation" height="25" width="150" align="left"><a class="navigation" href="http://www.impact-bg.net/comentari.php'.$sid.'"> Коментари</a>        </td>
       </tr>';
			}
		?>
	          </table>
      
       
      <table border="0" width="125">
       <tbody>
       <tr> 
        <td class="left" height="20" width="119"> <?php
if ($userdata['user_active']>0)
{
if ( $userdata['user_posts'] >= 0 && $userdata['user_posts'] <= 149 ) {
$rank = "Нов";
}
if ( $userdata['user_posts'] >= 150 && $userdata['user_posts'] <= 319 ) {
$rank = "Потребител";
}
if ( $userdata['user_posts'] >= 320 ) {
$rank = "Активен";
}
if ( $userdata['user_rank'] == 1 ) {
$rank = "Admin";
}
if ( $userdata['user_rank'] == 2 ) {
$rank = "Модератор";
}
echo '

<table border="0" style="font-size:12px;" cellpadding="0" cellspacing="0" >
<tr>
<td style="font-size:12px;" height="20"><b>Потребител</b>
</td>
</tr>
<tr>
<td style="font-size:12px;" height="20"><a
href="'.$phpbb_root_path.'profile.php?mode=viewprofile&u='.$userdata['username'].' "><span style="text-decoration: none"><font size="3"><b>'. $userdata['username'].'</b></font></span></a>
</td>
</tr>
<tr>
<td style="font-size:12px;" height="20">
<span style="text-decoration: none"><font size="3"><b>'. $rank .'</b></font></span>
</td>
</tr>
<tr>
<td height="20" ><a class="user" href="'.$phpbb_root_path.'login.php?logout=true&sid='.$userdata['session_id'].'"><span style="text-decoration: none"><font size="4">Изход</font></span></a></td>
</tr>
<tr>
<td height="5">
</td>
</tr>
</table>

';
}
else
{

echo '

<form action="'.$phpbb_root_path.'login.php" method="post" style="margin: 0px;">
<input type="hidden" name="redirect" value="../index.php" />
<table border="0" style="font-size:12px;" width="130" cellspacing="0" cellpadding="0">
<tr>
<td class="left" height="25">
<b>Потребител:</b>
</td>
</tr>
<tr>
<td class="left" height="25">
<input type="text" name="username" size="20" maxlength="35">
</td>
</tr>
<tr>
<td class="left" height="25">
<b>Парола:</b>
</td>
</tr>
<tr>
<td class="left" height="25">
<input type="password" name="password" size="20" maxlength="35">
</td>
</tr>
<tr>
<td>
Запомни ме: <input type="checkbox" name="autologin" checked >
</td>
</tr>
<tr>
<td class="left" height="35">
<input type="submit" name="login" value="Вход">
</td>
</tr>
<tr>
<td class="left" height="20" >
<a href="'.$phpbb_root_path.'profile.php?mode=register"><b>Регистрация</b></a>
</td>
</tr>
<tr>
<td class="left" height="20">
<a href="'.$phpbb_root_path.'profile.php?mode=sendpassword"><b>Забравена парола</b></a>
</td>
</tr>
</table>
</form>

';

}
?> 
</td>
       </tr>
       <tr> 
        <td class="left" height="5" width="119">
        </td>
       </tr>
       </tbody></table>
     <table border="0" width="100%" id="table11">
		<tr>
			<td><?php
//onlinename users
	$user_forum_sql = ( !empty($forum_id) ) ? "AND s.session_page = " . intval($forum_id) : '';
	$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_level, s.session_logged_in, s.session_ip
		FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
		WHERE u.user_id = s.session_user_id
			AND s.session_time >= ".( time() - 300 ) . "
			$user_forum_sql
		ORDER BY u.username ASC, s.session_ip ASC";
		$result = $db->sql_query($sql);

	$prev_user_id = 0;
	while( $row = $db->sql_fetchrow($result) )
	{
		if ( $row['session_logged_in'] )
		{
			if ( $row['user_id'] != $prev_user_id )
			{
				
			$user_online_link = $row['username'] . ', ';
					
			}
		}
	}
	
	if ( empty($online_userlist) )
	{
		$online_userlist = 'Няма онлайн потребители!';
	}

//online user names
			
			
$users_count = mysql_query("SELECT COUNT(user_id) FROM ".$table_prefix."users");
$users_count_result = mysql_fetch_array($users_count);

$last_user = mysql_query("SELECT username FROM ".$table_prefix."users WHERE user_id =(SELECT MAX(user_id) FROM ".$table_prefix."users) ");
$last_user_result = mysql_fetch_array($last_user);

$time = time()-60*5;
$online_count = mysql_query("SELECT COUNT(user_id) FROM ".$table_prefix."users where user_session_time > '$time' ");
$online_count_result = mysql_fetch_array($online_count);

echo "Регистрирани: ".$users_count_result['COUNT(user_id)']."<br>
Последно регистриран: ".$last_user_result['username']."<br>
Онлайн: <a onmouseover="return overlib('".$online_userlist."');" onmouseout="return nd();">".$online_count_result['COUNT(user_id)']."</a>";
?>
</td>
		</tr>
		</table>
     <table border="0" width="100%" id="table29">
		<tr>
			<td>
			<table align="left" border="0" width="100%" id="table30">
				<tr>
					<td>
					<p align="center">
<script  type="text/javascript">

</script>
<noscript><a href="http://www.tyxo.bg/?24794" title="Tyxo.bg counter" target="_blank"><img src="http://cnt.tyxo.bg/24794" width="80" height="15" border="0" alt="Tyxo.bg counter" /></a></noscript>
<br/><a href="http://wthost.net/seo_web_site_check.php?sait=referer" 
target="_blank"><img src="http://wthost.net/prcheck.php" 
width="80" height="15" border="0" alt="seo google"></a></td>
				</tr>
				<tr>
					<td>
					<p align="left"><a title="музикална търсачка" href="http://club4e.com" target="_blank" >Mузикална търсачка</a><br />
<a title="My Portfolio System" href="http://my-portfolio-system.freehostia.com" target="_blank" >My Portfolio System</a></br/>
<a href="http://www.kaldata.com/" title="Bulgarian IT News, Software, Hardware" target="_blank">IT Новини</a> <br/>
<a href="http://danlex.freeforums.org">DANLEX Форуми</a><br/>
<a href="http://www.webleit.com">Webleit.com - уроци</a></br/>
<a href="http://translators-bg.net/">Български преводи</a></br/>
<a href="http://mybgblog.com/">MyBGblog</a><br/>
<a href="http://bg-portal.net" title="Влез и се забавлявай!">BG-PORTAL.NET</a><br/>
<a href="http://make-bg.com" target="_blank">Направи си сам</a><br/>
<a href="http://arows.net" target="_blank">Безплатни домейни</a></td>
				</tr>
				</table>
			</td>
		</tr>
		</table>
 
Тука нема кво да гледаш след като логина е през форума.... Като се логнеш от форума прави ли ти тия магарии ??
 
SandPrince каза:
trevata каза:
Тука нема кво да гледаш след като логина е през форума.... Като се логнеш от форума прави ли ти тия магарии ??

мда прави ги. :(
Еми значи е от форума :) (бива ме в логиката :P )
 
Проблема е не в сесиите, а в кукитата. Не се създават 3-те важни кукита за логина. Демек не можеш да си възстановиш сесията. А тя си работи само докато не излезеш от страницата иначе.

Ето имената на кукитата дето трябва да ги има: phpbb2mysql_t, phpbb2mysql_sid, phpbb2mysql_data

Съветвам те да си изтеглиш от някъде /forum/includes/sessions.php и да смениш твоя с този. Защото съм 98% сигурен, че е от тоя файл. Eто моя.

http://gamerbg.com/forum/includes/sessions.txt
 
санд може да се оправи с пренаписване на линковете....
навсякъде трябва да има по едно sid=некви глупости
 
аз имам същия проблем само че с мозилла а под интернет експлорер си е наред всичко ...
 

Back
Горе