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

  • SEARCH
  • Home
  • 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 5945415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:40:42+00:00 2026-05-22T16:40:42+00:00

This is the weirdest bug I’ve ever encountered and I am at wits end

  • 0

This is the weirdest bug I’ve ever encountered and I am at wits end here. It just started on the script even know the only thing I changed was running the capitalizing function on the first and last name variables.

The problem is with the “$lname” variable. I’ve got the script in debug, and I have it echoing out “$lname” throughout each process, and it’s only after I set it to the _SESSION variable that it changes into an array. Nothing I do seems to work. Everytime the user returns to the form it unsets all the session vars, but I’ve even tried changing the name of “$_SESSION[‘reglname’]; and I still get the same thing happening.

I’m at wits end here, and if you read through this you can see I’ve tried just about everything to force it through as a string. I guess I can edit the subsequent scripts to account for it being an array, but I’d rather figure out what the hells going on here so I can avoid it in the future! PLEASE HELP!

//Start session
session_start();

unset($_SESSION['ERRMSG_ARR']);

//Include database connection details
require_once("$DOCUMENT_ROOT/../SQLlogin.php");

//Array to store validation errors
$errmsg_arr = array();

//Validation error flag
$errflag = false;

//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
    die('Failed to connect to server: ' . mysql_error());
}

//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
    die("Unable to select database");
}

//Function to sanitize values received from the form. Prevents SQL injection
function clean($str) {
    $str = @trim($str);
    if(get_magic_quotes_gpc()) {
        $str = stripslashes($str);
    }
    return mysql_real_escape_string($str);
}

//Sanitize the POST values
$fname = clean($_POST['FirstName']);
$lname = clean($_POST['LastName']);
$email = clean($_POST['Email']);
$cemail = clean($_POST['ConfirmEmail']);
$bday = clean($_POST['BirthDay']);
$bmonth = clean($_POST['BirthMonth']);
$byear = clean($_POST['BirthYear']);

echo $lname;

//Capitalize first and last name
$fname = ucwords($fname);
$lname = ucwords($lname);

//Collate and format birthdate
if ($bmonth < 10){
    $bdate = clean("0".$bmonth."/".$bday."/".$byear);
}else{
    $bdate = clean($bmonth."/".$bday."/".$byear);
}

//Echo out vars to check
echo $fname."<br />".$lname;

//Server-side validations
if($fname == '' || strlen($fname) < 2 || strlen($fname) > 24 || strpbrk($fname, " ")) {
    $errmsg_arr[] = '*First name must be greater than 2 characters, less than 24, and contain no spaces!';
    $errflag = true;
}
if($lname == '' || strlen($lname) < 2 || strlen($lname) > 24 || strpbrk($lname, " ")) {
    $errmsg_arr[] = '*Last name must be greater than 2 characters, less than 24, and contain no spaces!';
    $errflag = true;
}
if(!ereg("[a-zA-Z]+", $fname, $lname)){
    $errmsg_arr[] = '*First and last name can contain only letters!';
    $errflag = true;
}
if ($email == '' || strlen($email) < 2 || strlen($email) > 32) {
    $errmsg_arr[] = '*Email address must be greater than 3 and less than 32 characters!';
    $errflag = true;
}
if ($cemail == '') {
    $errmsg_arr[] = '*Email address must be greater than 3 and less than 32 characters!';
    $errflag = true;
}
if ($email != $cemail) {
    $errmsg_arr[] = '*Email addresses do not match!';
    $errflag = true;
}
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){
    $errmsg_arr[] = '*The email address entered appears to be invalid. Please enter a valid email address';
    $errflag = true;
}
if($bday == '') {
    $errmsg_arr[] = '*Birthday field left blank!';
    $errflag = true;
}
if($bmonth == '') {
    $errmsg_arr[] = '*Birth month field left blank';
    $errflag = true;
}
if($byear == '') {
    $errmsg_arr[] = '*Birth year field left blank';
    $errflag = true;
}
$year = date(Y);
if(($year - $byear) < 18){
    $errmsg_arr[] = '*You must be 18 years or older to register as a Hoppr client!';
    $errflag = true;
}
$allowed_age = 18;
$bdatecheck = strtotime($byear.'-'.$bmonth.'-'.$bday);
$age = (time()-$bdatecheck)/31536000;
if($age >= $allowed_age) {

}else{
    $errmsg_arr[] = '*You must be 18 years or older to register as a Hoppr client!';
    $errflag = true;
}

//If there are input validations, redirect back to the registration form
if($errflag) {
    $_SESSION['ERRMSG_ARR'] = $errmsg_arr;
    session_write_close();
    header("location: http://www.thehoppr.com/clients/registration.php");
    exit();
}

echo $_SESSION['reglname'];

//Set registration session vars
$_SESSION['regstep'] = (int) 0;
$_SESSION['regfname'] = (string) $fname;
(string) $_SESSION['reglname'] = (string) $lname;
$_SESSION['regemail'] = (string) $email;
$_SESSION['regbdate'] = (string) $bdate;

echo $_SESSION['reglname'];

//Perform the email check query
$checkqry = "SELECT * FROM clients WHERE email='".mysql_real_escape_string($email)."'";
$checkresult = mysql_query($checkqry);
$checkAry = mysql_fetch_array($checkresult, MYSQL_ASSOC);
if (empty($checkAry)){
    //No email found, send user to step 2
    $_SESSION['regstep'] = (int) 2;
}else{
    //Dupl email found, check for Hoppr registration
    $isReg = $checkAry['isReg'];
    if ($isReg == 0) {
        global $checkAry;
        //Email found but not registered. Send user to Facebook merge page
        $_SESSION['regstep'] = (int) 1;
        $_SESSION['regfbname'] = $checkAry['firstname']." ".$checkAry['lastname'];
        $_SESSION['regfbpic'] = $checkAry['imgURL'];
        $_SESSION['regfbid'] = $checkAry['facebookID'];
        $_SESSION['regfbbday'] = $checkAry['birthday'];
    }else{
        //Email found and is registered. Ask user for a different email
    }
}
  • 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-22T16:40:43+00:00Added an answer on May 22, 2026 at 4:40 pm

    Here’s your problem:

    if(!ereg("[a-zA-Z]+", $fname, $lname)){
    

    I think you want:

    if(!ereg("[a-zA-Z]+", $fname.$lname)){
    

    The Ereg will store matches in param 3.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, this is by far the weirdest bug I have ever encountered. It's pretty
I just found a solution to one of the weirdest bug i have ever
I have encountered the weirdest display bug with my UISearchBar . Here is my
This is the weirdest error I have ever encountered. This MVC web project was
This is the weirdest thing I've ever encountered in my programming life. self.walls =
I just run into the weirdest thing I've ever encounter. Consider this test page:
this is the weirdest error I've ever got on Rails. Any idea what this
I know this one is the weirdest of all weird questions I have asked
This is the weirdest thing ever. So I can see these files and cat
This is the weirdest thing that has ever happened to me since I am

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.