[PHP] preg_match() [function.preg-match] Error. Help

Re: preg_match() [function.preg-match] Error. Help

no idea try something like this

if( preg_match( '/'.$_name . "\@" . $_host . $_tlds.'/i', $email ) ){
 
What are those variables? Some more script would be useful...also use tags next time.
 
PHP:
<?php

    include_once 'http://neocrave.net/login/classes/mysql'. EXT;

    class User extends mysql{


        var $mysql;

        

        function __construct(   ) {

            $this->mysql = new mysql();

 

            if( phpversion( ) < 5 ){

                $this->mysql->__construct( );

            }

 

            foreach( $_POST as $key => $val ) {

                $_POST[$key] = stripslashes( strip_tags( htmlspecialchars( $val, ENT_QUOTES ) ) );

                $$key = stripslashes( strip_tags( htmlspecialchars( $val, ENT_QUOTES ) ) );

            }

            foreach( $_GET as $key => $val ){

                $_GET[$key] = stripslashes( strip_tags( htmlspecialchars( $val, ENT_QUOTES ) ) );

                $$key = stripslashes( strip_tags( htmlspecialchars( $val, ENT_QUOTES ) ) );

            }

            foreach( $_SESSION as $key => $val ){

                $_SESSION[$key] = stripslashes( strip_tags( htmlspecialchars( $val, ENT_QUOTES ) ) );

                $$key = stripslashes( strip_tags( htmlspecialchars( $val, ENT_QUOTES ) ) );

            }

            foreach( $_COOKIE as $key => $val ){

                $_COOKIE[$key] = stripslashes( strip_tags( htmlspecialchars( $val, ENT_QUOTES ) ) );

                $$key = stripslashes( strip_tags( htmlspecialchars( $val, ENT_QUOTES ) ) );

            }

        }

        

        function Clean($string){

            if(get_magic_quotes_gpc())

                $string = stripslashes($string);

            elseif(!get_magic_quotes_gpc())

                $string = addslashes(trim($string));;

            

            $string = escapeshellcmd($string);

            $string = mysql_real_escape_string($string);

            $string = stripslashes(strip_tags(htmlspecialchars($string, ENT_QUOTES)));

 

            return $string;

        }

        

        function Encrypt( $x ) {

            $x = md5( sha1( md5( $x ) ) );

            

            return $x;

        }

        

        function LoginForm( $page = '' ) {

            $fields = array(

                'username' => array(

                    'type' => 'text',

                    'pre' => 'Username',

                    'value' => ''

                ),

                

                'password' => array(

                    'type' => 'password',

                    'pre' => 'Password',

                    'value' => ''

                ),

            );

            

            return CreateForm (   $page, 'post', $fields, 'login', 'test', 'Login Now', 'loginbutton'   );

        }

        

        function Login( $username, $password ){

            $this->Connect( );

            $username = $this->Clean( $username );

            $password = $this->Clean( $password );

            $password = $this->Encrypt( $password );

            

            if( $this->Num_Rows( $this->LoginUser( $username, $password ) ) == 1 ){

                session_register("USR_USERNAME", $username);

                setcookie("id", $username,time()+86400);

                setcookie("pass", $password,time()+86400);

                print '<meta http-equiv="Refresh" content="3; URL=domain.com" />Logging In
 
replace
Code:
                            $_name = "";


                            $_host = "([-0-9A-Z]+.)+";

                            $_tlds = "([0-9A-Z]){2,4}$/i";

                            if( preg_match( $_name . @ . $_host . $_tlds, $email ) ){
replace
Code:
if (preg_match('/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*+[a-z]{2}/is', $email)) {

it no wer near a complete email verify but it should do.
 
Back