why on earth wont this work their is no spaces no outputs but yet i put redirect just in before configuartion .php which just holds my db connections what gives
<?php
require('configuration.php');
$voucher = $_SESSION['voucher'] ;
$result = mysql_query("SELECT used FROM codes where code='".$voucher."'");
$row =mysql_fetch_row($result);
if ( $row['used'] == "1" ) {
header('Location: invalid.php');
exit;
}
if ( $row['used'] == "0" ) {
header('Location: valid.php');
exit;
}
?>
Chances are
configuration.phphas something being output. (Remember that require/include output anything at that point in time, so any white-space or characters would also be output at that time).out of curiosity, if you do the following does it work:
If it works with the
ob_start/ob_end_flushcalls in place,configuration.phpis outputting something. However, some things to note:$_GET/$_POST/$_SESSION) directly to SQL. Even though you may be setting the session data, depending where it comes from (cookie for example) it’s very easy to start poking around your database.Locationshould be a fully-qualified path (http://mydomain.com/myfile.phpnot justmyfile.php)