Jump to content

Not Echoing Message? Help


jigsawsoul

Recommended Posts

It will not

 

echo 'Registration was successful';

 

but if the lines placed above

 

$email = mysql_real_escape_string($_POST['email']);
$password = mysql_real_escape_string($_POST['password']);

 

works fine

 

 

<?php

session_start();
ob_start();

include('../resources/config.php');
include($config["paths"]["resources"] . 'opendb.php');
include($config["paths"]["resources"] . '_library/login.php');

$_SESSION['message'] = "";
    if (empty($_POST['email'])) 
            $_SESSION['message'] .= "<li>A email address is required.<br /></li>";

    if (empty($_POST['password']))
            $_SESSION['message'] .= "<li>A password is required.<br /></li>";
            
    if ($_POST['password'] != $_POST['password2'])
            $_SESSION['message'] .= "<li>Passwords don't match<br /></li>";

    if (!empty($_SESSION['message'])) {
    		 $_SESSION['message'] .= "<br />";
             header("Location: register.php");
             exit();
    }

$email = mysql_real_escape_string($_POST['email']);
$password = mysql_real_escape_string($_POST['password']);

$result = mysql_query("SELECT email FROM projectlogin WHERE email = '$email'");
$emailcheck = mysql_num_rows($result) or die(mysql_error());

echo 'Registration was successful';

if($emailcheck > 0){
	$_SESSION["message"] = 
	   "<li>Email address already in use.<br /><br /></li>";
	header ('Location: register.php');
	exit;
}

echo 'Registration was successful';

include($config["paths"]["resources"] . 'closedb.php');

?>

 

Anyone see a problem or why this might be happening?

 

Link to comment
Share on other sites

Adding this code doesn't do anything or display a problem anywhere? anyone have a better idea??? i really stuck :)

 

ini_set ("display_errors", "1"); 
error_reporting(E_ALL);

 

<?php
ini_set ("display_errors", "1"); 
error_reporting(E_ALL);


session_start();
ob_start();

include('../resources/config.php');
include($config["paths"]["resources"] . 'opendb.php');
include($config["paths"]["resources"] . '_library/login.php');

$_SESSION['message'] = "";
    if (empty($_POST['email'])) 
            $_SESSION['message'] .= "<li>A email address is required.<br /></li>";

    if (empty($_POST['password']))
            $_SESSION['message'] .= "<li>A password is required.<br /></li>";
            
    if ($_POST['password'] != $_POST['password2'])
            $_SESSION['message'] .= "<li>Passwords don't match<br /></li>";

    if (!empty($_SESSION['message'])) {
    		 $_SESSION['message'] .= "<br />";
             header("Location: register.php");
             exit();
    }

$email = mysql_real_escape_string($_POST['email']);
$password = mysql_real_escape_string($_POST['password']);

$result = mysql_query("SELECT email FROM projectlogin WHERE email = '$email'");
$emailcheck = mysql_num_rows($result) or die(mysql_error());

echo 'Registration was successful';

if($emailcheck > 0){
	$_SESSION["message"] = 
	   "<li>Email address already in use.<br /><br /></li>";
	header ('Location: register.php');
	exit;
}

echo 'Registration was successful';

include($config["paths"]["resources"] . 'closedb.php');

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.