Jump to content
php.lv forumi

logout - no reason


login08

Recommended Posts

Problema sekojosa:

 

ir izveidota autorizacija (login, pass). Autorizejoties lapa atveras(itka vis pareizi), bet lidz ko megina izdarit kadu funkciju vai kaut vai "refresh" lapu, ta izmet atkal autorizaciju (login, pass). Nesaprotu kas par vainu. Lugsu jusu palidzibu.

 

<?php 
session_start();
// Sākam ielogošanos
if (isset($_POST['username'])) {

$username= $_POST['username'];
$password= $_POST['password'];
$username = stripslashes($username);
$password = stripslashes($password);
#$username = mysql_real_escape_string($username);
#$password = mysql_real_escape_string($password);

// Pārbaudam lietotajvārdu un paroli
if ($_POST['username'] == 'abc' and $_POST['password'] == 'abc') {
$_SESSION['authorized'] = TRUE; }}

// Izlogošanās
if (isset($_REQUEST['logout'])) {
unset($_SESSION['authorized']);}

// Ja lietotājvārds / parole ir pareizi, tad
if (isset($_SESSION['authorized'])) 
{
echo '<center><a class="main2" href="logout.php">Iziet</a></center>';
?>


kods kuru izpilda ja autorizacija pareiza

<?
} 
else 
{ 

kods ja nepareiza

}?>

 

PS.

Varbut vaina ir hostinga?

Edited by login08
Link to comment
Share on other sites

Hmm.. neredzu tava koda refresh parbaudi! Varbut es kludos, bet manuprat tas nav vajadzigs (session). Kluda ir citur!

 

Uz localhost kods stradaja, ieliku hostinga (so to pamainiju) un vairs neiet!! Divi varianti vai nu es esmu stulbs, vai hostings :)

Edited by login08
Link to comment
Share on other sites

×
×
  • Create New...