Малко помощ?

  • Автор Автор html
  • Начална дата Начална дата

html

Registered
Здравейте!Интегрирах си сайт с phpBB и искам да направя така че да теглят само регистрирани и сложих тоя код:
Код:
<?
if ($userdata['user_active']>0)
{echo"Трябва да си логнат за да теглиш файлове";}
else{останалия код}
но като се логна ми излиза "Трябва да си логнат за да теглиш файлове" ,а като излеза от акаунта си ми позволява да тегля.Точно обратното се получава.Ня кой да ми помогле :cry:
 
<?
if ($userdata['user_active']>1)
{echo"Трябва да си логнат за да теглиш файлове";}
else{останалия код}


???
 
html каза:
Здравейте!Интегрирах си сайт с phpBB и искам да направя така че да теглят само регистрирани и сложих тоя код:
Код:
<?
if ($userdata['user_active']>0)
{echo"Трябва да си логнат за да теглиш файлове";}
else{останалия код}
но като се логна ми излиза "Трябва да си логнат за да теглиш файлове" ,а като излеза от акаунта си ми позволява да тегля.Точно обратното се получава.Ня кой да ми помогле :cry:

Код:
<?
if ($userdata['user_active']=0)
{echo"Трябва да си логнат за да теглиш файлове";}
else{останалия код}

Ето така е! :wink:

Ти правиш обратна проверка. Твоя код се чете така: Ако $userdata е по-голямо от 0 (демек ако е логнат) Да се изпълни echo"Трябва да си логнат за да теглиш файлове"; . Ако $userdata е равно на нула значи не е логнат, а ако е по-голямо от нула значи не е!
 
html каза:
:!: Пак не се получава

Неможе да не става!

EDIT:: Сигурен ли си, че имаш това
Код:
 <?
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);
?>
в началото на страницата?
 
Като е на 0 нищо като е на 1 ми показва че не мога да тегля дори и когато вляза в акаунта си
 
Код:
<html>
<head>
<body>
<html>
<head>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">
<body>
<div id="content">
<ul id="ul">
<li><a href="index.php">Начало</a></li> <li><a href="subs.php">Субтитри</a></li> <li><a href="forum/index.php">Форум</a></li> <li><a href="soft.php">Софтуер</a>
</ul>
<img src="img/logo.gif" border="0" align="center" alt="ex-design">
<div class="login">
<?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);
?>
 <?
if ($userdata['user_active']>0)
{

echo '

<table border="0" style="font-size:12px;" cellpadding="0" cellspacing="0" class="login" >
<tr>
<td style="font-size:12px; color:#3e3e3e;" height="20"><b><font color="#3e3e3e" size="1">Потребител:  </font></b>
</td>
<td style="font-size:12px;" height="20"><a
href="'.$phpbb_root_path.'profile.php?mode=viewprofile&u='.$userdata['username'].' ">'. $userdata['username'].'</a>
</td>
<td height="20" ><a class="user" href="'.$phpbb_root_path.'login.php?logout=true&sid='.$userdata['session_id'].'">   [Изход]</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><font color="#3e3e3e">Потребител:</font></b>
</td>
<td class="left" height="25">
<input type="text" name="username" size="10" maxlength="25">
</td>
<td class="left" height="25">
<b><font color="#3e3e3e">Парола:</font></b>
</td>
<td class="left" height="25">
<input type="password" name="password" size="10" maxlength="25">
</td>
<td class="left" height="35">
<input type="submit" name="login" value="Вход" class="submit">
</td>
<td class="left" height="20" >
<a href="'.$phpbb_root_path.'profile.php?mode=register">Регистрация</a>
</td>
</tr>
</table>
</form>

';

}

?>
</div>
<center>
<?php
include 'form.php';
?>
</center>

<table width="750">
	<tr>
    <td align="left" width="640" bgcolor="#000000">Име</a></td>
    <td align="left" width="55" bgcolor="#000000">Големина</td>
    <td align="left" width="55" bgcolor="#000000">Година</td>
  </tr>
 </table>
<?php
if ($userdata['user_active']=0)
{echo"Трябва да си логнат за да теглиш файлове";}
else{
include "indexx.php";
}
?>
</div>
</head>
</html>
 
Пробвай така:

Код:
if ($userdata['user_active']>0)
{ КОДА ДЕТО ТЕГЛИШ }
else 
    echo "Не сте логнат";

EDIT:: Чакай, ще ти го направя целият! :wink:
 
Виж така:

Код:
<?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);
?>
<html>
<head>
<body>
<html>
<head>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">
<body>
<div id="content">
<ul id="ul">
<li><a href="index.php">Начало</a></li> <li><a href="subs.php">Субтитри</a></li> <li><a href="forum/index.php">Форум</a></li> <li><a href="soft.php">Софтуер</a>
</ul>
<img src="img/logo.gif" border="0" align="center" alt="ex-design">
<div class="login">
<?
if ($userdata['user_active']>0){

echo '

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



</div>
<center>';
include 'form.php';
?>
</center>

<table width="750">
   <tr>
    <td align="left" width="640" bgcolor="#000000">Име</a></td>
    <td align="left" width="55" bgcolor="#000000">Големина</td>
    <td align="left" width="55" bgcolor="#000000">Година</td>
  </tr>
 </table>
<?php
include "indexx.php";
}

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><font color="#3e3e3e">Потребител:</font></b>
</td>
<td class="left" height="25">
<input type="text" name="username" size="10" maxlength="25">
</td>
<td class="left" height="25">
<b><font color="#3e3e3e">Парола:</font></b>
</td>
<td class="left" height="25">
<input type="password" name="password" size="10" maxlength="25">
</td>
<td class="left" height="35">
<input type="submit" name="login" value="Вход" class="submit">
</td>
<td class="left" height="20" >
<a href="'.$phpbb_root_path.'profile.php?mode=register">Регистрация</a>
</td>
</tr>
</table>
</form>

</div>
<center>';
include 'form.php';
}
?>
</div>

</head>
</html>

Направил съм тази таблица да се появява само ако си логнат, ако искаш ще го направя да излиза винаги
 

Back
Горе