Jump to content

erors!!! ARG!!!


TheFilmGod

Recommended Posts

Warning: preg_match() [function.preg-match]: Unknown modifier '{' in /home/content/i/n/t/internetknight/html/register_new.php on line 72

 

Warning: Wrong parameter count for array_key_exists() in /home/content/i/n/t/internetknight/html/register_new.php on line 172

 

Code for warning 1:

// Set pattern matching for user
		$u_regex = "[A-Za-z0-9_]{6,20}$";

		// If username has between 6 and 20 word characters
		if ( preg_match($u_regex, $user)) {...

 

Code for warning 2:

	if ( array_key_exists($error)) {..

 

What did I do wrong?

 

 

Link to comment
Share on other sites

1.) The syntax of your regular expression is for use with ereg()

Try:

		$u_regex = "^[A-Za-z0-9_]{6,20}$";

		// If username has between 6 and 20 word characters
		if (ereg($u_regex, $user)) {...

 

Notice i modified your expression slightly. You'll need the ^ to make sure the match is for the entire string. With your previous expression, someone could have put any characters at the beginning of the string, so long as the last 6-20 where alphanumeric or underscores.

2.) Again, the manual is your friend: www.php.net/array_key_exists

 

The function requires two parameters, the first being the key you are looking for, the second being the array in which you are searching.

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.