Reply to Re: $HTTP_REFERER crashes my system like clockwork

Your name:

Reply:


Posted by walterbyrd on 11/17/85 11:53

> > Benjamin Esham wrote:
> >

Okay, I think I may be making some progress. My authenticate.php now
starts like this:

<?php
#if either form field is empty return to the log-in page
if (!isset($_POST['username']) || !isset($_POST['password']))
{
header("Location: index.html");
exit();
}

And that seems to work.

> The $username and $password were empty because you have register_globals
> off; this means that you can only access your form variables through $_POST.
> *This is the way it should be!* Turning register_globals on is potentially
> a great security risk.

Okay, from now on I will have register_globals on. Er, how do I do
that?

> This error is caused by sending output before headers. "Output" is usually
> your outputted HTML code, but *any text at all*, including whitespace, that
> comes before the opening <?php

I am certain that is not the case. I have absolutely nothing before the
<?php or after the ?>, not even white space.

> By the way, I'm not sure whether using HTTP_REFERER is the best way to
> return to the previous page. You're probably better off just doing a
>
> header('Location: login_form.php');
>

Did that. It works. Thanks.

> Hope this helps! Feel free to post again if your script continues to give
> you trouble.

My script is still giving me trouble, only now in a different part.

This line:

setcookie("admin", $username, time()+18000);

Is giving me this error:

Warning: Cannot modify header information - headers already sent by
(output started at C:\xampp\htdocs\WMS\authenticate.php:29) in
C:\xampp\htdocs\WMS\authenticate.php on line 30

I am certain that $username is set correctly. I checked.

And this line (directly after the setcookie line)

header("Location: table_list1.php");

is giving me this error:

Warning: Cannot modify header information - headers already sent by
(output started at C:\xampp\htdocs\WMS\authenticate.php:29) in
C:\xampp\htdocs\WMS\authenticate.php on line 32

I am certain that the file table_list1.php is correct, it's there. And
it works fine when run on my remote web-site.

> --
> Benjamin D. Esham
> bdesham@gmail.com | AIM: bdesham128 | Jabber: same as e-mail
> ...and that's why I'm not wearing any pants.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация