Jump to content

Baconian

Members
  • Content Count

    7
  • Joined

  • Last visited

Posts posted by Baconian

  1. thanks Ingolme :) and here are the last version of code thescientist

    $resultado = mysqli_query($conexao,$sql);if($resultado){	$_SESSION['usuario_logado'] = $user;	session_write_close();	header('Location: test.php?info=User created and loged KEEP SAFE YOUR USERNAME');}

    the only difference between the final version and the first version is the session_write_close() , i don't know if the SESSION variables can be source of my problem but all work now soo it's ok

  2. i removed all echos, var_dump and html, all seems to work now '-'

    the delay persist but the headers are working.

     

    and i put the echos to see if the condition is evaluating to true, 'cause the new users are on database soo the mysqli_query must return true

  3. If the header isn't being sent then that means that the condition is not evaluating to true.

     

    SESSION variables aren't saved when you call the location header because the script hasn't finished running before leaving the page. To save the variables before sending a location header use session_write_close()

     

     

    i add a

    echo("<h3>Let the carnage begin!</h3>");

    on the begin of the file and the session_write_close() before reach the header, but still a blank page :/

    $resultado = mysqli_query($conexao,$sql);if($resultado){	echo("<h3>Yeah!</h3>");	$_SESSION['usuario_logado'] = $user;	session_write_close();	header('Location: test.php?info=User created and loged KEEP SAFE YOUR USERNAME');}

    so i tried use meta tags, apparently work, but i have a strange delay on the load of the pages

    $resultado = mysqli_query($conexao,$sql);	if($resultado){	echo("<h3>Yeah!</h3>");	$_SESSION['usuario_logado'] = $user;	session_write_close();	//header('Location: test.php?info=User created and loged KEEP SAFE YOUR USERNAME');	?><meta http-equiv="refresh" content="0;url=http://www.mydomain.com/form_test/test.php?info=User%20created%20and%20loged%20KEEP%20SAFE%20YOUR%20USERNAME"><?php}

    it's normal this delay? considering that are extremely light pages?

  4. hi guys, here i'm again!

    soo this time i have a more complex question (i think). I made a simple form site who works fine on the local server (except the part of the email who never came!). I was trying to put the files on a server and use the email account that the server provide me to receive the emails from my form site, then i found a strange error, my headers functions don't work on the server (with 1 exception), after a few minutes on google i found some answers with .php but any of them work, soo here i'm asking for some light

     

     

    here is one of the headers who doesn't work

    $resultado = mysqli_query($conexao,$sql);if($resultado){	$_SESSION['usuario_logado'] = $linha['IDUSER'];	header('Location: test.php?info=User created and loged KEEP SAFE YOUR USERNAME');} 

    and here is the only one who works

    <?php	session_start();	if (!isset($_SESSION['usuario_logado'])) {		header('Location: home.html');		exit;	}?>//this verify if a user is loged

    i tried to use ob_start(); but then i just have a blank page

    if anyone can help me will be awesome!

  5. hi guys, just introducing myself

     

    Full name: Leonardo BaldisseraAlternative name(s): Bacon, Baconian, leo, natiBirth date(dd/mm/yyyy): 28/10Gender: MaleZodiacal sign: ScorpioHeight: 1.89mWeight: 68kgEyes: ligth brownHair: goldenFavourite Movies: too many to listInterest: art, literature, programming and have funPets: sadly no, but i like cats a lot

  6. Hey guys! i'm a newbie and i'm having a problem with a simple form.

    Probably it's a simply detail but i can't get it :/ so every comment helps a lot!

     

    The form is submitted in .html but the info put on form apparently don't reach the .php file and i don't have the minimal idea of what is wrong

     

    the error is:

    Notice: Undefined index: user in C:xampphtdocsforminsert.php on line 6

    not cathing user

    .html

    <html>	<head><title>Home</title></head>	<body>	<h1>Login</h1>	<form method="post" action="insert.php" enctype="text/plain">		<input type="text" name="user" placeholder="insert your username">		<input type="submit" value="Login">	</form>        </body></html>

    .php

    <?php	session_start();	include('conectaDB.php');		$user = $_REQUEST["user"];//line 6	if(!isset($user)){echo("not cathing user");exit();}		var_dump($user);		$sql="INSERT INTO User		(IDUSER)		VALUES($user)";		var_dump($sql);	$resultado = mysqli_query($conexao,$sql);		if($resultado){echo("worked!");}	else{echo("ERROR sql insert: ".$sql);}	mysqli_close($conexao);?>

    in all browsers i've tried(chrome, firefox and IE) the result is the same :/

×
×
  • Create New...