From d8838ab5dbcab38ab548ad7b74047bf507217063 Mon Sep 17 00:00:00 2001 From: paulr Date: Mon, 7 Nov 2011 03:05:57 +1100 Subject: [PATCH] made my star image a bit nicer added the captcha plugin, which actually depends on securimage/phpcaptcha from http://www.phpcaptcha.org/ - works quite well, and this way i dont have to carry the phpcaptcha code with my source tree. added the capture bits to the reigstration page, but registration page itself isnt functional --- gwvplib/gwvpauth.php | 46 ++++++++++++++++++++++++++++++++---- gwvplib/gwvpemail.php | 8 ++++++ gwvplib/gwvplib.php | 1 + gwvplib/gwvpuseradmin.php | 10 ++++++++ gwvplib/plugins/captcha_plugin.php | 40 +++++++++++++++++++++++++++++++ www/images/star.jpg | Bin 654 -> 464 bytes 6 files changed, 100 insertions(+), 5 deletions(-) create mode 100644 gwvplib/gwvpemail.php create mode 100644 gwvplib/plugins/captcha_plugin.php diff --git a/gwvplib/gwvpauth.php b/gwvplib/gwvpauth.php index f7e036d..ad42b2b 100644 --- a/gwvplib/gwvpauth.php +++ b/gwvplib/gwvpauth.php @@ -9,10 +9,15 @@ function gwvp_AuthCallMe() session_start(); if(isset($_REQUEST["q"])) { - $query = $_REQUEST["q"]; - if($query == "login") return "gwvp_AuthHandleLogin"; - if($query == "logout") return "gwvp_AuthHandleLogout"; - if($query == "register") return "gwvp_RegistrationCall"; + $query = explode("/", $_REQUEST["q"]); + if($query[0] == "login") return "gwvp_AuthHandleLogin"; + if($query[0] == "logout") return "gwvp_AuthHandleLogout"; + if($query[0] == "register") { + if(isset($query[1])) { + return "qwvp_attemptRegistration"; + } + return "gwvp_RegistrationCall"; + } } $login = gwvp_isLoggedIn(); @@ -134,13 +139,24 @@ function gwvp_AuthHandleLogin() function gwvp_RegistrationPageBody() { + global $BASE_URL; + + // TODO: registration page needs to be prettier - mostly the image for the captcha + ?> -
+ + @@ -152,6 +168,8 @@ function gwvp_RegistrationPageBody() + + @@ -160,6 +178,24 @@ function gwvp_RegistrationPageBody() check($_POST['captcha_code']) == false) { + // the code was incorrect + // you should handle the error so that the form processor doesn't continue + + // or you can use the following code if there is no validation or you do not know how + echo "The security code entered was incorrect.

"; + echo "Please go back and try again."; + } else { + echo "code was right"; + } + + } +} + function gwvp_checkBasicAuthLogin() { $user = false; diff --git a/gwvplib/gwvpemail.php b/gwvplib/gwvpemail.php new file mode 100644 index 0000000..6e6a17b --- /dev/null +++ b/gwvplib/gwvpemail.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/gwvplib/gwvplib.php b/gwvplib/gwvplib.php index 24b2d77..d70dc3f 100644 --- a/gwvplib/gwvplib.php +++ b/gwvplib/gwvplib.php @@ -11,6 +11,7 @@ require_once("gwvpdatabase.php"); require_once("gwvpconfig.php"); require_once("gwvpgitcontrol.php"); require_once("gwvpinputcheck.php"); +require_once("gwvpemail.php"); // this is loaded second last require_once("gwvppluginloader.php"); diff --git a/gwvplib/gwvpuseradmin.php b/gwvplib/gwvpuseradmin.php index 1d3e83d..7db0c8d 100644 --- a/gwvplib/gwvpuseradmin.php +++ b/gwvplib/gwvpuseradmin.php @@ -55,6 +55,7 @@ function gwvp_AddUserPage() $pass2 = $_REQUEST["pass2"]; $username = $_REQUEST["username"]; $desc = $_REQUEST["desc"]; + $sendvalid = isset($_REQUEST["sendvalidation"]); // now for some validation $sendback = false; @@ -83,6 +84,12 @@ function gwvp_AddUserPage() $message .= "Passwords dont match. "; } + if($pass1 == "" && $pass2 == "" && !$sendvalid) { + $starpass = true; + $sendback = true; + $message .= "Password was blank. "; + } + // otherwise, its all good, proceed with user creation if($sendback) { $_SESSION["sendback_owner"] = "users"; @@ -433,6 +440,7 @@ function gwvp_UserAdminPageBody() echo ""; echo ""; echo ""; + echo ""; echo ""; echo "
Name Your Full Name + + CAPTCHA Image
+ + [ Different Image ] + +
Email The Name Used to Refer to you on the site
Password Confirm$starpass
Username$starusernameDescription
Set account locked and send validation email for initial passsword (not implemented)
"; echo "
"; @@ -572,6 +580,8 @@ function gwvp_UserAdminPageBody() } trim($ugroups); + if($ugroups == "") $ugroups = "-"; + switch($LOGIN_TYPE) { case "anon": echo "$username$ugroups$desc"; diff --git a/gwvplib/plugins/captcha_plugin.php b/gwvplib/plugins/captcha_plugin.php new file mode 100644 index 0000000..e952271 --- /dev/null +++ b/gwvplib/plugins/captcha_plugin.php @@ -0,0 +1,40 @@ + \ No newline at end of file diff --git a/www/images/star.jpg b/www/images/star.jpg index 8bb9bcd5286a6c5e515c10eadce404ee534120e6..8c32dd392187828dbd3e413dd689dd84a5cc6654 100644 GIT binary patch delta 288 zcmeBUy}&$SXT1P}05hW!1Ct;lvmoRDBMhPpjEoGZfCDJ3Ai%)H#K_EwkYQwIVqs%o z6%-OtGzhnW#*JF_5zJ;RF6 zZ}x4|-yStP>_xRJA@AbiRmLD(^DEM#%E_GREoGPL;jd9CX)OcGm3N(=Lmn z_zY#UdzQXw@^A2$FFC)F>!#b?EZ*eh$(yrQE$yF@?RZRm;iQ(@2_ByuA3vMHrx-1M vd(}ao9G$YP&@F2}P0idP=~BAMVEQ5tI|rFR7Z>YhY}LzKb-Zud@&7jgq*hwH delta 479 zcmcb>+{Zd$XT1o62s5J+1Ct;lvmoRDBMcG@j10_-49I|$jhzE1qbb0^#Kg$Lz{<=D zm1SgNW?^Mu6BJ?>Rx)(tPz)4RH8ybqDivo00c0~+*qE4s5-NfWj7&fS;Bxgqz90j$ zqM;*;P$R3bh*IFe|F;-;fG%JXWENzwXL!BmnD>|cT1PwT^M7}nIoC(uUcKq#pSr*E z=eysSczv^4;FtS5izC zo2!$aMIGIt|4iO=#W?`PFX+w{B()BBVsbYf;Xhc74K)SvAg|yHP`p= zJU6{I?tSdXEt=lrrt+#qrE#&Uw>V?;Jc(bmIsq1HKC|yK?t7-arOKA`;MuU1_7Hfr?Ix zc!Y#mol;;zW6s{GZH6`-D?YKx&J5WYs(z;-vO`|B|9R+t27a?V