Jump to content

Cannot use [] for reading


Far Cry

Recommended Posts

The following script just validates some form inputs, and then puts any errors inside an array.

 

I get this error: Fatal error: Cannot use [] for reading in C:\xampp\htdocs\Game\includes\validation.php on line 104

 

I've looked around, and this still does not make any sense to me.

 

public function ValidateEmail($email, $reemail){
/*
Sanatize.
User filter_var to validate.
Make sure both emails match.
Check if email already exists or not.
*/
  trim($email);
  strip_tags($email);
  mysql_real_escape_string($email);
  
  trim($reemail);
  strip_tags($reemail);
  mysql_real_escape_string($reemail);
  
if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
  $this->valid = false;
  //Line 104 $this->error[] - "The E-Mail that you provided is not valid.";
} else {
  $this->valid = true;
}

if($email !== $reemail){
  $this->valid = false;
  $this->error[] = "The E-Mail's that you provided do not match.";
} else {
  $this->valid = true;
}
if(filter_var($email, FILTER_VALIDATE_EMAIL) && $email == $reemail){
  $checkmail = mysql_query("SELECT users.email, temp_users.email FROM users, temp_users WHERE email = '$email'");
  if(mysql_mum_rows($checkmail) == 1){
  // email is found, throw out error
  $this->valid = false;
  $this->error[] = "That E-Mail is already in use.";
  } else {
  $this->valid = true;
}
}
  return $this->error;
}

 

Line 104 is commented out.

 

Thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.