Re_ problema con HEADER

arkom

Nuovo Utente
5 Mag 2009
4
0
0
Salve dopo un ennesimo tentativo di risolvere un problema di "header" con l'aiuto di gentili utenti del foruma con la soluzione:
<?php
ob_start();

echo('HTML'); // output

session_start();
?>


non ho potuto ancora risolvere il problema per la registrazione utenti in questo codice che posto, realizzata con dreamweaver cs3:
<?php session_start();?>
<?php virtual('/Connections/conn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['Username'])) {
$loginUsername=$_POST['Username'];
$password=$_POST['Password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "/utente/login_ok.php";
$MM_redirectLoginFailed = "/utente/error_login.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_conn, $conn);

$LoginRS__query=sprintf("SELECT username, user_password FROM utenti WHERE username=%s AND user_password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));

$LoginRS = mysql_query($LoginRS__query, $conn) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;

if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<---ESCLUDO QUESTO PEZZO IN QUANTO NON IMPORTANTE --->
</div>
<div id="Internal_login_b">
<form ACTION="<?php echo $loginFormAction; ?>" id="form1" name="form1" method="POST">
<table width="330" align="center">
<tr>
<td scope="col"><span class="Stile4">
<label for="Username"><strong>Username</strong></label>
</span></td>
<td><input name="Username" type="text" id="Username" maxlength="20" /></td>
</tr>
<tr>
<td scope="col"><label for="Password"><span class="Stile3">Password</span></label></td>
<td><input name="Password" type="password" id="Password" maxlength="20" /></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="button" id="button" value="Login" />
</div></td>
</tr>
</table>
</form>
</div>
Qualcuno mi potrebbe indicare esattamente come devo riscrivere il codice per evitare l'errore sugli "header"
Grazie
 

Eliox

Utente Attivo
25 Feb 2005
4.390
3
0
tutta questa parte:
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<---ESCLUDO QUESTO PEZZO IN QUANTO NON IMPORTANTE --->
</div>
<div id="Internal_login_b">
<form ACTION="<?php echo $loginFormAction; ?>" id="form1" name="form1" method="POST">
<table width="330" align="center">
<tr>
<td scope="col"><span class="Stile4">
<label for="Username"><strong>Username</strong></label>
</span></td>
<td><input name="Username" type="text" id="Username" maxlength="20" /></td>
</tr>
<tr>
<td scope="col"><label for="Password"><span class="Stile3">Password</span></label></td>
<td><input name="Password" type="password" id="Password" maxlength="20" /></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="button" id="button" value="Login" />
</div></td>
</tr>
</table>
</form>
</div>

nonè sottoposta a condizione, viene prodotta comunque in outup e genera l'errore
 

dream88

Utente Attivo
8 Apr 2009
62
0
0
Anch'io avevo il tuo stesso problema e l'ho risolto scrivendo alla fine del php questo:

ob_end_flush();

Prova a utilizzarlo...dovrebbe funzionare!
 
Discussioni simili
Autore Titolo Forum Risposte Data
gandalf1959 [PHP] problema con l'utilizzo di Header PHP 3
gandalf1959 problema con header in area riservata PHP 4
X Problema con header() include() e i siti di hosting PHP 1
L problema con la funzione header!!! AIUTO! PHP 24
P problema con header(Location....) PHP 11
G html problema table scrollable con header fisso HTML e CSS 2
H problema tabella con header e prima colonna fissi Javascript 1
I Problema con header PHP 16
T Problema con header:"troppi reindirezzamenti" PHP 3
A Problema header con dreamweaver cs3 e PHP PHP 6
A Problema con autenticazione e header() PHP 0
O problema con dvr dahua xvr5116 IP Cam e Videosorveglianza 0
G Problema con Xampp Web Server 1
andrea barletta Problema con miniature comandi Photoshop 0
I problema con alice Posta Elettronica 0
N Problema con position absolute e overflow HTML e CSS 4
L Problema con inner join PHP 11
K [php] Problema con inner join PHP 4
K [PHP] Problema con variabili concatenate. PHP 1
O problema con query PHP 4
I problema con 2 account Posta Elettronica 1
L problema collegamento file css con html HTML e CSS 1
E Problema accesso a file con app sviluppata con MIT APP INVENTOR 2 Sviluppo app per Android 0
M Problema con Try Catch PHP 0
Sergio Unia Problema con gli eventi del mouse su una data table: Javascript 2
T PROBLEMA CON SESSIONI PHP 3
T ALTRO PROBLEMA CON ARRAY PHP PHP 1
R problema con else PHP 0
T PROBLEMA CON ARRAY PHP 8
L problema con query select PHP 2
R Problema query con ricerca id numerico PHP 2
F Problema con risposta PHP 0
S problema con recupero dati tabella mysql PHP 2
Z Problema con il mio tp-l i nk Reti LAN e Wireless 1
L Problema RAM con Tomcat 8 Apache 0
napuleone problema con sort e asort PHP 4
Z Problema con INT MySQL PHP 1
Z Problema database MySQL con XAMPP PHP 0
M Problema con controllo form in real time jQuery 6
Z Problema di sincronizzazione PAYPAL con PHP PHP 1
G Problema con Get page PHP 4
P Problema con require once PHP 6
P Problema con i package Java 1
A Problema login con Safari PHP 14
F INDESIGN: problema esportazione esecutivo per la stampa con foto B/N Webdesign e Grafica 0
S problema con css bootstrap3 HTML e CSS 4
M .load() problema con caricamenti dinamici di js Javascript 0
G Problema con eccessiva nitidezza apertura Camera Raw Photoshop 0
G Problema ------- con Query PHP 1
G Problema con Query PHP 1

Discussioni simili