summaryrefslogtreecommitdiffstats
path: root/include/login.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2008-04-26 13:01:41 -0700
committerArun Persaud <arun@nubati.net>2008-04-26 13:01:41 -0700
commit924f395a39eeccbcd54d540613e440cbedd6ba3d (patch)
treef78d88b5285bb2d0bcd87e7281411df18749943b /include/login.php
parent09515348107d9aab7823a12d31b082a2ebb75555 (diff)
downloade-DoKo-924f395a39eeccbcd54d540613e440cbedd6ba3d.tar.gz
e-DoKo-924f395a39eeccbcd54d540613e440cbedd6ba3d.tar.bz2
e-DoKo-924f395a39eeccbcd54d540613e440cbedd6ba3d.zip
CLEANUP: cleaned up index.php a bit more by introducing an 'action' variable
no more if, but one nice switch statement in index.php Signed-off-by: Arun Persaud <arun@nubati.net>
Diffstat (limited to 'include/login.php')
-rw-r--r--include/login.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/login.php b/include/login.php
new file mode 100644
index 0000000..346c71e
--- /dev/null
+++ b/include/login.php
@@ -0,0 +1,33 @@
+<?php
+/* make sure that we are not called from outside the scripts,
+ * use a variable defined in config.php to check this
+ */
+if(!isset($HOST))
+ exit;
+
+if(!myisset("email","password"))
+ {
+ "can't log you in";
+ }
+else
+ {
+ $email = $_REQUEST["email"];
+ $password = $_REQUEST["password"];
+
+ /* verify password and email */
+ if(strlen($password)!=32)
+ $password = md5($password);
+
+ $ok = 1;
+ $myid = DB_get_userid('email-password',$email,$password);
+ if(!$myid)
+ $ok = 0;
+
+ if($ok)
+ {
+ /* user information is ok */
+ $myname = DB_get_name('email',$email);
+ $_SESSION["name"] = $myname;
+ }
+ }
+?> \ No newline at end of file