summaryrefslogtreecommitdiffstats
path: root/include/user.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2008-05-06 20:08:53 -0700
committerArun Persaud <arun@nubati.net>2008-05-06 21:39:01 -0700
commit086ed1db2ec28817b3370481455c84ceaf6448c2 (patch)
tree06111f54d262f69a5e3ff82f59d80b2e7bc5e73f /include/user.php
parenta0f87f33ef571a47b143ae06530b64c8496f2f6e (diff)
downloade-DoKo-086ed1db2ec28817b3370481455c84ceaf6448c2.tar.gz
e-DoKo-086ed1db2ec28817b3370481455c84ceaf6448c2.tar.bz2
e-DoKo-086ed1db2ec28817b3370481455c84ceaf6448c2.zip
CLEANUP: removed all calls to mysql functions and replaced them with calls to DB_xxx
should be very easy now to change to a different database. also made the code look nicer ;) Signed-off-by: Arun Persaud <arun@nubati.net>
Diffstat (limited to 'include/user.php')
-rw-r--r--include/user.php42
1 files changed, 21 insertions, 21 deletions
diff --git a/include/user.php b/include/user.php
index 8feac01..fa4653d 100644
--- a/include/user.php
+++ b/include/user.php
@@ -111,26 +111,26 @@ if(myisset("forgot"))
{
case "germancards":
case "englishcards":
- $result = mysql_query("SELECT * from User_Prefs".
- " WHERE user_id='$myid' AND pref_key='cardset'" );
- if( mysql_fetch_array($result,MYSQL_NUM))
- $result = mysql_query("UPDATE User_Prefs SET value=".DB_quote_smart($setpref).
- " WHERE user_id='$myid' AND pref_key='cardset'" );
+ $result = DB_query("SELECT * from User_Prefs".
+ " WHERE user_id='$myid' AND pref_key='cardset'" );
+ if( DB_fetch_array($result))
+ $result = DB_query("UPDATE User_Prefs SET value=".DB_quote_smart($setpref).
+ " WHERE user_id='$myid' AND pref_key='cardset'" );
else
- $result = mysql_query("INSERT INTO User_Prefs VALUES(NULL,'$myid','cardset',".
- DB_quote_smart($setpref).")");
+ $result = DB_query("INSERT INTO User_Prefs VALUES(NULL,'$myid','cardset',".
+ DB_quote_smart($setpref).")");
echo "Ok, changed you preferences for the cards.\n";
break;
case "emailaddict":
case "emailnonaddict":
- $result = mysql_query("SELECT * from User_Prefs".
- " WHERE user_id='$myid' AND pref_key='email'" );
- if( mysql_fetch_array($result,MYSQL_NUM))
- $result = mysql_query("UPDATE User_Prefs SET value=".DB_quote_smart($setpref).
- " WHERE user_id='$myid' AND pref_key='email'" );
+ $result = DB_query("SELECT * from User_Prefs".
+ " WHERE user_id='$myid' AND pref_key='email'" );
+ if( DB_fetch_array($result))
+ $result = DB_query("UPDATE User_Prefs SET value=".DB_quote_smart($setpref).
+ " WHERE user_id='$myid' AND pref_key='email'" );
else
- $result = mysql_query("INSERT INTO User_Prefs VALUES(NULL,'$myid','email',".
- DB_quote_smart($setpref).")");
+ $result = DB_query("INSERT INTO User_Prefs VALUES(NULL,'$myid','email',".
+ DB_quote_smart($setpref).")");
echo "Ok, changed you preferences for sending out emails.\n";
break;
}
@@ -166,8 +166,8 @@ if(myisset("forgot"))
break;
case '1':
echo "Changed the password.<br />";
- mysql_query("UPDATE User SET password='".md5($_REQUEST["password1"]).
- "' WHERE id=".DB_quote_smart($myid));
+ DB_query("UPDATE User SET password='".md5($_REQUEST["password1"]).
+ "' WHERE id=".DB_quote_smart($myid));
break;
}
/* set password */
@@ -192,13 +192,13 @@ if(myisset("forgot"))
echo "</p>\n";
$output = array();
- $result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.mod_date,Game.player,Game.status from Hand".
- " LEFT JOIN Game ON Game.id=Hand.game_id".
- " WHERE user_id='$myid'".
- " ORDER BY Game.session,Game.create_date" );
+ $result = DB_query("SELECT Hand.hash,Hand.game_id,Game.mod_date,Game.player,Game.status from Hand".
+ " LEFT JOIN Game ON Game.id=Hand.game_id".
+ " WHERE user_id='$myid'".
+ " ORDER BY Game.session,Game.create_date" );
$gamenrold = -1;
echo "<table>\n <tr><td>\n";
- while( $r = mysql_fetch_array($result,MYSQL_NUM))
+ while( $r = DB_fetch_array($result))
{
$game = DB_format_gameid($r[1]);
$gamenr = (int) $game;