if( preg_match( $_name . "@" . $_host . $_tlds, $email ) ){
That's the line, What's wrong?
Printable View
if( preg_match( $_name . "@" . $_host . $_tlds, $email ) ){
That's the line, What's wrong?
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.
As John_D said, you need to escape special characters. (Not sure @ is one though) Also, check if $email isn't empty.
@ is not a special character. Dot is. So use preg_quote() for all input variables.
And your e-mail check is rather strange :) .
[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
replacereplaceCode:$_name = "";
$_host = "([-0-9A-Z]+.)+";
$_tlds = "([0-9A-Z]){2,4}$/i";
if( preg_match( $_name . @ . $_host . $_tlds, $email ) ){
it no wer near a complete email verify but it should do.Code:if (preg_match('/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*+[a-z]{2}/is', $email)) {
So i replace the top thing with the bottom thing?
it works. Thank you so much :D
How would i mak an admin cp for this?
Admin cp? You mean some kind of e-mails validation control?