Ma io posso fare una cosa del genere?
Nel senso che non mi trovo mai a soddisfare la condizione per cui caricare index_ins.php...codice:<?php if(IsSet($_POST['PHPSESSID']) && !IsSet($_COOKIE['PHPSESSID'])){ $PHPSESSID=$_POST['PHPSESSID']; session_start(); $_SESSION['posted_login']=$_POST['login']; $_SESSION['posted_pwd']=$_POST['pwd']; header("Location: http://localhost/inserimento/index.php?PHPSESSID=$PHPSESSID"); } session_start(); //Controllo username e password da login $login_r=$_SESSION['posted_login']; $pwd_r=$_SESSION['posted_pwd']; $conn_string="host=localhost dbname=autorized_users user=searcher password=***"; //connessione al database degli utenti autorizzati $conn=pg_connect($conn_string) or die("ERRORE DI CONNESSIONE"); //query di verifica $query="SELECT pwduser FROM usr_table WHERE username='$login_r'"; $result=pg_query($conn,$query); $pwd_true=pg_fetch_row($result); if(strcmp($$_POST['pwd'],$pwd_true[0])==0){ $_SESSION['logged_in']=TRUE; $_SESSION['user']=$login_r; } //Il problema sembra essere che $login_r non viene mai assegnato a $_SESSION['user'] //Puo' essere che sia causato dal fatto che ho due session_start anche su uno sta dentro un if? //logout if($_GET['logout']==1){ $_SESSION=array(); session_destroy(); header("Location: http://localhost/inserimento/index.php"); exit; } ?> <!doctype html public "-//W3C//DTD html 4.0 //en"> <html> <head> <title>---</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <meta name="generator" content="HAPedit 3.1"> <link rel="stylesheet" type="text/css" href="../style.css"> </head> <body> <?php $PHPSESSID=session_id(); if(!IsSet($_SESSION['user'])){ //Pagina di login require "login.html"; } else { require "index_ins.php"; } ?> </body> </html>

Rispondi quotando