summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2008-08-17 21:41:39 -0700
committerArun Persaud <arun@nubati.net>2008-08-17 21:41:39 -0700
commit1c3c341f53ce5de7e9d4bcc63e43a925faec3f48 (patch)
tree428ba81fa982a4680871013f2452535ad85bc320 /include
parentd0720e088954dd4028037bbb9aeeca29ab4c47ac (diff)
downloade-DoKo-1c3c341f53ce5de7e9d4bcc63e43a925faec3f48.tar.gz
e-DoKo-1c3c341f53ce5de7e9d4bcc63e43a925faec3f48.tar.bz2
e-DoKo-1c3c341f53ce5de7e9d4bcc63e43a925faec3f48.zip
CLEANUP: some more comments, also removed some debug messages
Signed-off-by: Arun Persaud <arun@nubati.net>
Diffstat (limited to 'include')
-rw-r--r--include/cancelgame.php7
-rw-r--r--include/login.php11
-rw-r--r--include/logout.php6
-rw-r--r--include/register.php21
4 files changed, 25 insertions, 20 deletions
diff --git a/include/cancelgame.php b/include/cancelgame.php
index 43d3274..357d226 100644
--- a/include/cancelgame.php
+++ b/include/cancelgame.php
@@ -1,12 +1,14 @@
<?php
-/* make sure that we are not called from outside the scripts,
+/* 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;
+/* display the menu */
output_status();
+/* you should only get here from a game page, so $me should be set */
if(!myisset("me"))
{
echo "Hmm, you really shouldn't mess with the urls.<br />\n";
@@ -38,6 +40,7 @@ if(time()-strtotime($r[0]) > 60*60*24*30) /* = 1 month */
"Game ".DB_format_gameid($gameid).
" has been canceled since nothing happend for a while and $myname requested it.\n";
+ /* email to all players */
$userids = DB_get_all_userid_by_gameid($gameid);
foreach($userids as $user)
{
@@ -51,6 +54,6 @@ if(time()-strtotime($r[0]) > 60*60*24*30) /* = 1 month */
echo "<p style=\"background-color:red\";>Game ".DB_format_gameid($gameid).
" has been canceled.<br /><br /></p>";
}
- else
+ else /* game can't be canceled yet */
echo "<p>You need to wait longer before you can cancel a game...</p>\n";
?> \ No newline at end of file
diff --git a/include/login.php b/include/login.php
index 346c71e..ea8d8ef 100644
--- a/include/login.php
+++ b/include/login.php
@@ -1,13 +1,14 @@
<?php
-/* make sure that we are not called from outside the scripts,
+/* 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;
+/* check if login information is present */
if(!myisset("email","password"))
{
- "can't log you in";
+ echo "can't log you in... missing login information.";
}
else
{
@@ -17,15 +18,15 @@ else
/* 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 */
+ /* user information is ok, set session variabel */
$myname = DB_get_name('email',$email);
$_SESSION["name"] = $myname;
}
diff --git a/include/logout.php b/include/logout.php
index f2ebbaf..3acabc3 100644
--- a/include/logout.php
+++ b/include/logout.php
@@ -1,13 +1,13 @@
<?php
-/* make sure that we are not called from outside the scripts,
+/* 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;
-/* distroy the session */
+/* to log a player out, all we need to do is to distroy the session */
session_unset();
session_destroy();
$_SESSION = array();
-
+
?> \ No newline at end of file
diff --git a/include/register.php b/include/register.php
index 03be803..d32a8b8 100644
--- a/include/register.php
+++ b/include/register.php
@@ -1,5 +1,5 @@
<?php
-/* make sure that we are not called from outside the scripts,
+/* make sure that we are not called from outside the scripts,
* use a variable defined in config.php to check this
*/
if(!isset($HOST))
@@ -9,42 +9,45 @@ if(!isset($HOST))
if(myisset("Rfullname","Remail","Rpassword","Rtimezone") )
{
global $HOST,$INDEX;
+
+ /* is this name already in use/ */
$ok=1;
if(DB_get_userid('name',$_REQUEST["Rfullname"]))
{
echo "please chose another name<br />";
$ok=0;
}
+ /* check if email address is already used */
if(DB_get_userid('email',$_REQUEST["Remail"]))
{
echo "this email address is already used ?!<br />";
$ok=0;
}
+
+ /* everything ok, go ahead and create user */
if($ok)
{
$r=DB_query("INSERT INTO User VALUES(NULL,".DB_quote_smart($_REQUEST["Rfullname"]).
",".DB_quote_smart($_REQUEST["Remail"]).
",".DB_quote_smart(md5($_REQUEST["Rpassword"])).
- ",".DB_quote_smart($_REQUEST["Rtimezone"]).",NULL,NULL)");
-
+ ",".DB_quote_smart($_REQUEST["Rtimezone"]).",NULL,NULL)");
+
if($r)
{
/* Set session, so that new user doesn't need to log in */
$myname = DB_get_name('email',$_REQUEST['Remail']);
$_SESSION["name"] = $myname;
-
- echo "myname $myname --";
-
+
echo " Welcome to e-DoKo, you are now registered, please visit the".
" <a href=\"".$HOST.$INDEX."\">homepage</a> to continue.";
}
else
echo " something went wrong, couldn't add you to the database, please contact $ADMIN_NAME at $ADMIN_EMAIL.";
}
- }
-/* page for registration */
+ }
else
{
+ /* No information for new user given, ouput a page for registration */
echo "IMPORTANT: passwords are going over the net as clear text, so pick an easy password. No need to pick anything complicated here ;)<br /><br />";
?>
<form action="index.php?action=register" method="post">
@@ -74,6 +77,4 @@ if(myisset("Rfullname","Remail","Rpassword","Rtimezone") )
</form>
<?php
}
-
-
?> \ No newline at end of file