X-Git-Url: http://git.euphorik.ch/?p=cl7.git;a=blobdiff_plain;f=php%2Fparticipant.php;fp=php%2Fparticipant.php;h=ef92a06334b3d8c4db03eba0611dd48d4a052e87;hp=9f718b004f83dde8d0644667f5d24abf9fa08ffc;hb=23bc2016d5fbd8f7daa9b7ba5c7fa862709ff7a7;hpb=75d6e5d29bfe332d68c617d26e3a8b1828a57893 diff --git a/php/participant.php b/php/participant.php index 9f718b0..ef92a06 100644 --- a/php/participant.php +++ b/php/participant.php @@ -22,15 +22,18 @@ class Participant # Aucunes valeurs transmise => ce n'est pas un participant valide. if ($v1 == NULL && $v2 == NULL) return; - + if (is_string($v1) && is_string($v2)) # Aucun des arguments n'est vide alors c'est le pseudo et le password qui ont été transmis + { $res = pg_query_params("SELECT id FROM participants WHERE pseudo = $1 AND password = $2", array($v1, $v2)); + } else # Sinon c'est l'id $res = pg_query_params("SELECT id FROM participants WHERE id = $1", array($v1)); - if (pg_result_status($res) == PGSQL_COMMAND_OK && pg_num_rows($res) === 1) + if (pg_result_status($res) == PGSQL_TUPLES_OK && pg_num_rows($res) === 1) { $this->id = pg_fetch_object($res)->id; + $this->chargerInfos(); } } @@ -49,7 +52,7 @@ class Participant $res = pg_query_params("SELECT * FROM participants WHERE id = $1", array($this->id)); - if (pg_result_status($res) == PGSQL_COMMAND_OK && pg_num_rows($res) === 1) + if (pg_result_status($res) == PGSQL_TUPLES_OK && pg_num_rows($res) === 1) $this->info = pg_fetch_object($res); else $this->id = 0; @@ -74,7 +77,7 @@ class Participant */ static function nombre_participant_max_atteint() { - return $this->nombre_place_restante() <= 0; + return Participant::nombre_place_restante() <= 0; } /**