Jump to content

[SOLVED] i am sorry but i am baffled. headders and what i can do to make it work


Recommended Posts

well made a simple script for a simple login nothing too hard. works fine on my local host but when i put on line. i just get the header infomation can not be sent. ect

 

hear is my script

<?php // script - login.php
// this page lets people log in to the site 

include 'includes/header.php'; 

//address error handling
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);

//set the page title and page header
define ('TITLE', 'Login');


// basic html formatting stuff
print '<h1>Simple Login Form</h1>
<p>Please enter your user name and password.</p>';

//check if the form has been submitted.
if (isset ($_POST['submit'])){

	//handle the form 
	if ((!empty ($_POST['username']))&&(!empty ($_POST['password'])) ){

		if ( ($_POST['username'] == 'j')&&($_POST['password'] == 'p') ){ // okay

			//do session stuff 
			$_SESSION['username'] = 'testing';

			//redirect the user to the welcom page 
			header ('location:welcome.php');
			exit();

		}else{//not ok 

			print '<p>The submitted username and password do not match those on file!<br />Go back and try again.</p>';

		}
	}else {//forgot a field.

		print '<p>Please make sure you enter both a username and a password!<br />Go back and try again </p>';
		}

	}else{


		// display the form  (You can edit this just make)
		print '<form action="login.php" method="post"><p>
		Username: <input type="text" name="username" size="20" /><br /><br />
		Password: <input type="password" name="password" size="20" /><br /><br />
		<input type="submit" name="submit" value="submit" /><br />
		</form>';

	}// end of main conditional.

	//complete the html formatting stuff
	print '</div>';


	?>

 

as you can see my header info is on lline 32 and i am just not sure how to change the location of this info or edit it so it works

 

can anyone help please

 

<?php // script - login.php
// this page lets people log in to the site 

//include 'includes/header.php'; I blocked this out because I'm guessing it has the <HEAD> tags?

//address error handling
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);

//set the page title and page header
//define ('TITLE', 'Login');


// basic html formatting stuff
//print '<h1>Simple Login Form</h1>
//<p>Please enter your user name and password.</p>';

//check if the form has been submitted.
if (isset ($_POST['submit'])){

	//handle the form 
	if ((!empty ($_POST['username']))&&(!empty ($_POST['password'])) ){

		if ( ($_POST['username'] == 'j')&&($_POST['password'] == 'p') ){ // okay

			//do session stuff 
			$_SESSION['username'] = 'testing';

			//redirect the user to the welcom page 
			header ('location:welcome.php');
			exit();

		}else{//not ok 

			print '<p>The submitted username and password do not match those on file!<br />Go back and try again.</p>';

		}
	}else {//forgot a field.

		print '<p>Please make sure you enter both a username and a password!<br />Go back and try again </p>';
		}

	}else{


		// display the form  (You can edit this just make)
		print '<form action="login.php" method="post"><p>
		Username: <input type="text" name="username" size="20" /><br /><br />
		Password: <input type="password" name="password" size="20" /><br /><br />
		<input type="submit" name="submit" value="submit" /><br />
		</form>';

	}// end of main conditional.

	//complete the html formatting stuff
	print '</div>';


	?>

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.