Im trying to write this script to say if email is valied insert into DB and redirect, else redirect with error message only my redirect isn’t working, im not terribly great with php and still reading up on the subject so id appreciate any advice, thanks in advance!
<?php
$userid = $usersClass->userID();
$user_email=$_POST['email_upd'];
if(!filter_var($user_email, FILTER_VALIDATE_EMAIL))
{
header('Location: http://www.mysite.co.uk/mytwitter.php?msg=invalid');
}
else
{
mysql_query(" UPDATE produgg_users SET email='$user_email' where produgg_users.id = ".$usersClass->userID()) or die(mysql_error());
header('Location: http://www.mysite.co.uk/mytwitter.php?msg=success');
}
?>
Sorry for not describing what goes wrong, what’s happening is my page isnt redirecting back to the page in the header(location)
I’ve now enabled Error reporting and im still only seeing a white page, heres my entire page code.
<?php
error_reporting(E_ALL);
require 'config.inc.php';
?>
<?php
$userid = $usersClass->userID();
$user_email=$_POST['email_upd'];
if(!filter_var($user_email, FILTER_VALIDATE_EMAIL))
{
header('Location: http://www..co.uk/mytwitter.php?msg=invalid');
}
else
{
mysql_query(" UPDATE produgg_users SET email='$user_email' where produgg_users.id = ".$usersClass->userID()) or die(mysql_error());
header('Location: http://www..co.uk/mytwitter.php?msg=success');
}
?>
I managed to get it working using the following code, I’ve rewritten it based upon what I’ve read regarding SQL injections and it works fine, I’d appreciate any advice on this, thanks!