当前位置: 首页>>代码示例>>PHP>>正文


PHP USER::register方法代码示例

本文整理汇总了PHP中USER::register方法的典型用法代码示例。如果您正苦于以下问题:PHP USER::register方法的具体用法?PHP USER::register怎么用?PHP USER::register使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在USER的用法示例。


在下文中一共展示了USER::register方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: catch

if ($user->is_loggedin() != "") {
    $user->redirect('advert-overview.php');
}
if (isset($_POST['register-button'])) {
    $user_first_name = strip_tags(htmlentities($_POST['user-first-name'], ENT_COMPAT, 'UTF-8'));
    $user_last_name = strip_tags(htmlentities($_POST['user-last-name'], ENT_COMPAT, 'UTF-8'));
    $user_email = strip_tags($_POST['user-email']);
    $user_password = strip_tags($_POST['user-password']);
    try {
        $stmt = $user->runQuery("SELECT user_firstname, user_email FROM tbl_user WHERE user_firstname=:user_first_name OR user_email=:user_email");
        $stmt->execute(array(':user_first_name' => $user_first_name, ':user_email' => $user_email));
        $row = $stmt->fetch(PDO::FETCH_ASSOC);
        if ($row['user_email'] == $user_email) {
            $error[] = "Er is al een account aangemaakt met dit e-mail adres.";
        } else {
            if ($user->register($user_first_name, $user_last_name, $user_email, $user_password)) {
                $user->doLogin($user_email, $user_password);
                $user->redirect('advert-overview.php');
            }
        }
    } catch (PDOException $e) {
        echo $e->getMessage();
    }
}
?>
<!doctype html>
<html class="no-js" lang="nl">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Account aanmaken</title>
		<link rel="stylesheet" href="../css/minimum-viable-product.min.css">
开发者ID:kangube,项目名称:kangu-product,代码行数:31,代码来源:register.php

示例2: USER

$reg_user = new USER();
if ($reg_user->is_logged_in() != "") {
    $reg_user->redirect('home.php');
}
if (isset($_POST['btn-signup'])) {
    $uname = trim($_POST['txtuname']);
    $email = trim($_POST['txtemail']);
    $upass = trim($_POST['txtpass']);
    $code = md5(uniqid(rand()));
    $stmt = $reg_user->runQuery("SELECT * FROM tbl_users WHERE userEmail=:email_id");
    $stmt->execute(array(":email_id" => $email));
    $row = $stmt->fetch(PDO::FETCH_ASSOC);
    if ($stmt->rowCount() > 0) {
        $msg = "\n\t\t      <div class='alert alert-error'>\n\t\t\t\t<button class='close' data-dismiss='alert'>&times;</button>\n\t\t\t\t\t<strong>Sorry !</strong>  email allready exists , Please Try another one\n\t\t\t  </div>\n\t\t\t  ";
    } else {
        if ($reg_user->register($uname, $email, $upass, $code)) {
            $id = $reg_user->lasdID();
            $key = base64_encode($id);
            $id = $key;
            $message = "\t\t\t\t\t\n\t\t\t\t\t\tHello {$uname},\n\t\t\t\t\t\t<br /><br />\n\t\t\t\t\t\tWelcome to Coding Cage!<br/>\n\t\t\t\t\t\tTo complete your registration  please , just click following link<br/>\n\t\t\t\t\t\t<br /><br />\n\t\t\t\t\t\t<a href='http://www.SITEURL.com/verify.php?id={$id}&code={$code}'>Click HERE to Activate :)</a>\n\t\t\t\t\t\t<br /><br />\n\t\t\t\t\t\tThanks,";
            $subject = "Confirm Registration";
            $reg_user->send_mail($email, $message, $subject);
            $msg = "\n\t\t\t\t\t<div class='alert alert-success'>\n\t\t\t\t\t\t<button class='close' data-dismiss='alert'>&times;</button>\n\t\t\t\t\t\t<strong>Success!</strong>  We've sent an email to {$email}.\n                    Please click on the confirmation link in the email to create your account. \n\t\t\t  \t\t</div>\n\t\t\t\t\t";
        } else {
            echo "sorry , Query could no execute...";
        }
    }
}
?>
<!DOCTYPE html>
<html>
开发者ID:kranthid,项目名称:d3aLw38s17e,代码行数:31,代码来源:signup.php

示例3: elseif

     TPL::message("Please enter a valid email address.");
 }
 // check password and passwrod1 == password2
 if (strlen($user_password) < 3) {
     TPL::message("Your password must be at least 3 characters.");
 } elseif ($user_password !== $user_password_repeat) {
     TPL::message("Your passwords do not match.");
 }
 // check groups
 if (empty($user_groups)) {
     TPL::message("Please select the groups for this user.");
 }
 // if we don't have errors
 if (empty(TPL::get_messages('error'))) {
     // try to add user
     $response = USER::register($user_username, $user_email, $user_password, $user_fullname, $user_groups);
     // check for errors
     if (is_array($response)) {
         foreach ($response as $err) {
             switch ($err) {
                 case "not_unique_username":
                     TPL::message("This username already exists. Please try another one.");
                     break;
                 case "not_unique_email":
                     TPL::message("This email already exists. Please try another one.");
                     break;
                 case "sql_error":
                     TPL::message("We encounted an error. Please try again.");
                     break;
             }
         }
开发者ID:double-web,项目名称:drawline,代码行数:31,代码来源:controller_users.php

示例4: catch

                        $error[] = "Enter your birthday!";
                    } else {
                        if (strlen($upass) < 6) {
                            $error[] = "Enter password at least 6 letters!";
                        } else {
                            try {
                                $stmt = $user->runQuery("SELECT user_name, user_email FROM user WHERE user_name=:uname OR user_email=:umail");
                                $stmt->execute(array(':uname' => $uname, ':umail' => $umail));
                                $row = $stmt->fetch(PDO::FETCH_ASSOC);
                                if ($row['user_name'] == $uname) {
                                    $error[] = "This username exist!";
                                } else {
                                    if ($row['user_email'] == $umail) {
                                        $error[] = "This email exist!";
                                    } else {
                                        if ($user->register($uname, $umail, $upass, $ubirth)) {
                                            $user->redirect('sign-up.php?joined');
                                        }
                                    }
                                }
                            } catch (PDOException $e) {
                                echo $e->getMessage();
                            }
                        }
                    }
                }
            }
        }
    }
}
?>
开发者ID:kawa314,项目名称:EmblemDemo,代码行数:31,代码来源:sign-up.php

示例5: catch

                    $error[] = "provide password !";
                } else {
                    if (strlen($upass) < 6) {
                        $error[] = "Password must be atleast 6 characters";
                    } else {
                        try {
                            $stmt = $user->runQuery("SELECT username, email FROM admin WHERE username=:uname OR email=:umail");
                            $stmt->execute(array(':uname' => $uname, ':umail' => $umail));
                            $row = $stmt->fetch(PDO::FETCH_ASSOC);
                            if ($row['username'] == $uname) {
                                $error[] = "sorry username already taken !";
                            } else {
                                if ($row['email'] == $umail) {
                                    $error[] = "sorry email id already taken !";
                                } else {
                                    if ($user->register($uname, $umail, $upass, $firstname, $lastname)) {
                                        $user->redirect('signup.php?joined');
                                    }
                                }
                            }
                        } catch (PDOException $e) {
                            echo $e->getMessage();
                        }
                    }
                }
            }
        }
    }
}
?>
<!DOCTYPE html>
开发者ID:Esdras1995,项目名称:Guardtour,代码行数:31,代码来源:signup.php

示例6: catch

                     if ($password !== $confirmed_password) {
                         $error[] = 'Please check your passwords';
                     } else {
                         if ($confirmed_password == "") {
                             $error[] = 'Please check your passwords';
                         } else {
                             try {
                                 //checks if the email address is already registered
                                 $query = $conn->prepare("SELECT email FROM user WHERE  email=:email");
                                 $query->execute(array(':email' => $email));
                                 $row = $query->fetch(PDO::FETCH_ASSOC);
                                 if ($row['email'] == $email) {
                                     $error[] = "sorry email id already taken !";
                                 } else {
                                     //runs  the register method
                                     if ($user->register($email, $password)) {
                                         if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
                                             $user->redirect('dashboard.php?joined');
                                         }
                                     }
                                 }
                             } catch (PDOException $e) {
                                 echo $e->getMessage();
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:IrinaTheNerd,项目名称:bloggie,代码行数:31,代码来源:register.php

示例7: catch

                 return false;
             } else {
                 if ($sec != $val3) {
                     echo "ERROR CODE VERIFICATION...";
                     return false;
                 } else {
                     try {
                         $stmt = $login->runQuery("SELECT user_name FROM users WHERE user_name=:uname");
                         $stmt->execute(array(':uname' => $uname));
                         $row = $stmt->fetch(PDO::FETCH_ASSOC);
                         if ($row['user_name'] == $uname) {
                             $error[] = "sorry username or mail already taken !";
                             echo "sorry username or mail already taken !";
                             return false;
                         } else {
                             if ($login->register($uname, $upass, $code)) {
                                 //$login->redirect('../login/index.php?joined');
                                 echo "DONE";
                                 return true;
                             }
                         }
                     } catch (PDOException $e) {
                         echo $e->getMessage();
                         echo "DB CONNECTION ERROR...";
                         return false;
                     }
                 }
             }
         }
     }
 }
开发者ID:walterleonardo,项目名称:Php,代码行数:31,代码来源:class.user.php


注:本文中的USER::register方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。