Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5985521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:32:29+00:00 2026-05-22T22:32:29+00:00

Im trying to write this script to say if email is valied insert into

  • 0

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');
    }

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:32:30+00:00Added an answer on May 22, 2026 at 10:32 pm

    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!

    <?php 
    
    require 'config.inc.php'; 
    
    $userid = $usersClass->userID();
    $user_email=mysql_real_escape_string($_POST['email_upd']);
    
    if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $user_email)) 
    { 
        mysql_query(" UPDATE produgg_users SET email='$user_email' where produgg_users.id = ".$usersClass->userID()) or die(mysql_error());
        echo "<meta http-equiv=\"refresh\" content=\"0;URL=/mytwitter.php?msg=email updated\">";
    } 
    else 
    { 
        echo "<meta http-equiv=\"refresh\" content=\"0;URL=/mytwitter.php?msg=email error\">";
    } 
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a python script that packages our software. This script needs
I'm trying to figure out how to write this function: template <typename Bound> Bound::result_type
I could probably write this myself, but the specific way I'm trying to accomplish
This is more of a syntax question I'm trying to write a store procedure
I hope this question is not a RTFM one. I am trying to write
I'm trying to write some code that various sites will embed, calling a script
I'm trying to write a bash script and I needed to do some floating
I'm trying to write a configure.ac file such that the resulting configure script searches
I'm trying to write a script which basically takes an array of lots of
I'm trying to write a bash script in which I connect to a samba

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.