summaryrefslogtreecommitdiffstats
path: root/db.php
diff options
context:
space:
mode:
Diffstat (limited to 'db.php')
-rw-r--r--db.php62
1 files changed, 31 insertions, 31 deletions
diff --git a/db.php b/db.php
index bd37532..fd5178d 100644
--- a/db.php
+++ b/db.php
@@ -7,8 +7,8 @@
function DB_open()
{
global $DB;
- if ( $DB = mysql_connect('localhost','dokodb', 'doko') )
- mysql_select_db('doko') or die('Could not select database');
+ if ( $DB = mysql_connect('mysql.nubati.net','doko', '$DoKo#.') )
+ mysql_select_db('dokodb') or die('Could not select database');
else
die (mysql_error());
@@ -38,7 +38,7 @@ function DB_quote_smart($value)
function DB_test()
{
- $result = mysql_query("SELECT * FROM user");
+ $result = mysql_query("SELECT * FROM User");
while($r = mysql_fetch_array($result,MYSQL_NUM))
{
foreach($r as $thing)
@@ -51,7 +51,7 @@ function DB_test()
function DB_get_email_by_name($name)
{
echo "*looking for $name*";
- $result = mysql_query("SELECT email FROM user WHERE fullname=".DB_quote_smart($name)."");
+ $result = mysql_query("SELECT email FROM User WHERE fullname=".DB_quote_smart($name)."");
$r = mysql_fetch_array($result,MYSQL_NUM);
if($r)
@@ -62,7 +62,7 @@ function DB_get_email_by_name($name)
function DB_get_userid_by_name($name)
{
- $result = mysql_query("SELECT id FROM user WHERE fullname=".DB_quote_smart($name));
+ $result = mysql_query("SELECT id FROM User WHERE fullname=".DB_quote_smart($name));
$r = mysql_fetch_array($result,MYSQL_NUM);
if($r)
@@ -72,7 +72,7 @@ function DB_get_userid_by_name($name)
}
function DB_get_userid_by_passwd($passwd)
{
- $result = mysql_query("SELECT id FROM user WHERE password=".DB_quote_smart($passwd));
+ $result = mysql_query("SELECT id FROM User WHERE password=".DB_quote_smart($passwd));
$r = mysql_fetch_array($result,MYSQL_NUM);
if($r)
@@ -82,7 +82,7 @@ function DB_get_userid_by_passwd($passwd)
}
function DB_get_userid_by_email($email)
{
- $result = mysql_query("SELECT id FROM user WHERE email=".DB_quote_smart($email));
+ $result = mysql_query("SELECT id FROM User WHERE email=".DB_quote_smart($email));
$r = mysql_fetch_array($result,MYSQL_NUM);
if($r)
@@ -93,7 +93,7 @@ function DB_get_userid_by_email($email)
function DB_get_handid_by_hash($hash)
{
- $result = mysql_query("SELECT id FROM hand WHERE hash=".DB_quote_smart($hash));
+ $result = mysql_query("SELECT id FROM Hand WHERE hash=".DB_quote_smart($hash));
$r = mysql_fetch_array($result,MYSQL_NUM);
if($r)
@@ -104,7 +104,7 @@ function DB_get_handid_by_hash($hash)
function DB_get_userid_by_hash($hash)
{
- $result = mysql_query("SELECT user_id FROM hand WHERE hash=".DB_quote_smart($hash));
+ $result = mysql_query("SELECT user_id FROM Hand WHERE hash=".DB_quote_smart($hash));
$r = mysql_fetch_array($result,MYSQL_NUM);
if($r)
@@ -115,7 +115,7 @@ function DB_get_userid_by_hash($hash)
function DB_get_pos_by_hash($hash)
{
- $result = mysql_query("SELECT position FROM hand WHERE hash=".DB_quote_smart($hash));
+ $result = mysql_query("SELECT position FROM Hand WHERE hash=".DB_quote_smart($hash));
$r = mysql_fetch_array($result,MYSQL_NUM);
if($r)
@@ -126,7 +126,7 @@ function DB_get_pos_by_hash($hash)
function DB_get_name_by_hash($hash)
{
- $result = mysql_query("SELECT fullname FROM hand LEFT JOIN user ON hand.user_id=user.id WHERE hash=".DB_quote_smart($hash));
+ $result = mysql_query("SELECT fullname FROM Hand LEFT JOIN User ON hand.user_id=user.id WHERE hash=".DB_quote_smart($hash));
$r = mysql_fetch_array($result,MYSQL_NUM);
if($r)
@@ -137,7 +137,7 @@ function DB_get_name_by_hash($hash)
function DB_get_status_by_hash($hash)
{
- $result = mysql_query("SELECT status FROM hand WHERE hash=".DB_quote_smart($hash));
+ $result = mysql_query("SELECT status FROM Hand WHERE hash=".DB_quote_smart($hash));
$r = mysql_fetch_array($result,MYSQL_NUM);
if($r)
@@ -148,13 +148,13 @@ function DB_get_status_by_hash($hash)
function DB_set_hand_status_by_hash($hash,$status)
{
- mysql_query("UPDATE hand SET status='".$status."' WHERE hash=".DB_quote_smart($hash));
+ mysql_query("UPDATE Hand SET status='".$status."' WHERE hash=".DB_quote_smart($hash));
return;
}
function DB_get_gameid_by_hash($hash)
{
- $result = mysql_query("SELECT game_id FROM hand WHERE hash=".DB_quote_smart($hash));
+ $result = mysql_query("SELECT game_id FROM Hand WHERE hash=".DB_quote_smart($hash));
$r = mysql_fetch_array($result,MYSQL_NUM);
if($r)
@@ -171,25 +171,25 @@ function DB_cancel_game($hash)
return;
/* get the IDs of all players */
- $result = mysql_query("SELECT id FROM hand WHERE game_id=".DB_quote_smart($gameid));
+ $result = mysql_query("SELECT id FROM Hand WHERE game_id=".DB_quote_smart($gameid));
while($r = mysql_fetch_array($result,MYSQL_NUM))
{
$id = $r[0];
- $tmp = mysql_query("SELECT id FROM hand_card WHERE hand_id=".DB_quote_smart($id));
+ $tmp = mysql_query("SELECT id FROM Hand_Card WHERE hand_id=".DB_quote_smart($id));
$tmp = mysql_fetch_array($tmp,MYSQL_NUM);
- mysql_query("DELETE FROM play WHERE hand_card_id=".DB_quote_smart($tmp[0]));
+ mysql_query("DELETE FROM Play WHERE hand_card_id=".DB_quote_smart($tmp[0]));
- mysql_query("DELETE FROM hand_card WHERE hand_id=".DB_quote_smart($id));
- mysql_query("DELETE FROM score WHERE hand_id=".DB_quote_smart($id));
- mysql_query("DELETE FROM hand WHERE id=".DB_quote_smart($id));
+ mysql_query("DELETE FROM Hand_Card WHERE hand_id=".DB_quote_smart($id));
+ mysql_query("DELETE FROM Score WHERE hand_id=".DB_quote_smart($id));
+ mysql_query("DELETE FROM Hand WHERE id=".DB_quote_smart($id));
}
/* delete game */
- mysql_query("DELETE FROM user_game_prefs WHERE game_id=".DB_quote_smart($gameid));
- mysql_query("DELETE FROM trick WHERE game_id=".DB_quote_smart($gameid));
- mysql_query("DELETE FROM game WHERE id=".DB_quote_smart($gameid));
+ mysql_query("DELETE FROM User_Game_Prefs WHERE game_id=".DB_quote_smart($gameid));
+ mysql_query("DELETE FROM Trick WHERE game_id=".DB_quote_smart($gameid));
+ mysql_query("DELETE FROM Game WHERE id=".DB_quote_smart($gameid));
return;
}
@@ -200,7 +200,7 @@ function DB_get_hand($me)
$handid = DB_get_handid_by_hash($me);
- $result = mysql_query("SELECT card_id FROM hand_card WHERE hand_id=".DB_quote_smart($handid)." and played='false' ");
+ $result = mysql_query("SELECT card_id FROM Hand_Card WHERE hand_id=".DB_quote_smart($handid)." and played='false' ");
while($r = mysql_fetch_array($result,MYSQL_NUM))
$cards[]=$r[0];
@@ -209,20 +209,20 @@ function DB_get_hand($me)
function DB_set_solo_by_hash($me,$solo)
{
- mysql_query("UPDATE hand SET solo=".DB_quote_smart($solo)." WHERE hash=".DB_quote_smart($hash));
+ mysql_query("UPDATE Hand SET solo=".DB_quote_smart($solo)." WHERE hash=".DB_quote_smart($hash));
return;
}
function DB_set_sickness_by_hash($me,$sickness)
{
- mysql_query("UPDATE hand SET sickness=".DB_quote_smart($sickness)." WHERE hash=".DB_quote_smart($hash));
+ mysql_query("UPDATE Hand SET sickness=".DB_quote_smart($sickness)." WHERE hash=".DB_quote_smart($hash));
return;
}
function DB_get_current_trickid($gameid)
{
- $result = mysql_query("SELECT trick.id,MAX(play.sequence) FROM play ".
- "LEFT JOIN trick ON play.trick_id=trick.id ".
+ $result = mysql_query("SELECT trick.id,MAX(play.sequence) FROM Play ".
+ "LEFT JOIN Trick ON play.trick_id=trick.id ".
"WHERE trick.game_id=".DB_quote_smart($gameid)." ".
"GROUP BY trick.id");
while( $r = mysql_fetch_array($result,MYSQL_NUM) )
@@ -233,7 +233,7 @@ function DB_get_current_trickid($gameid)
if(!$sequence || $sequence==4)
{
- mysql_query("INSERT INTO trick VALUES (NULL,NULL,NULL, ".DB_quote_smart($gameid).")");
+ mysql_query("INSERT INTO Trick VALUES (NULL,NULL,NULL, ".DB_quote_smart($gameid).")");
$trickid = mysql_insert_id();
$sequence = 1;
}
@@ -247,7 +247,7 @@ function DB_get_current_trickid($gameid)
function DB_get_max_trickid($gameid)
{
- $result = mysql_query("SELECT MAX(id) FROM trick WHERE game_id=".DB_quote_smart($gameid));
+ $result = mysql_query("SELECT MAX(id) FROM Trick WHERE game_id=".DB_quote_smart($gameid));
$r = mysql_fetch_array($result,MYSQL_NUM) ;
@@ -256,7 +256,7 @@ function DB_get_max_trickid($gameid)
function DB_play_card($trickid,$handcardid,$sequence)
{
- mysql_query("INSERT into play VALUES(NULL,NULL,NULL,".DB_quote_smart($trickid).
+ mysql_query("INSERT INTO Play VALUES(NULL,NULL,NULL,".DB_quote_smart($trickid).
",".DB_quote_smart($handcardid).",".DB_quote_smart($sequence).")");
return;
}