[RESOLU] Probleme , erreur syntaxe

Petit nouveau ! | 4 Messages

24 janv. 2017, 22:39

Voila , je ne vois pas se qu'il manque dans se code qui pourrais m'aider

Code : Tout sélectionner

[/php] <?php $sessionID = $_GET["sessionID"]; $actionget = $_GET["action"]; $user = $_GET["user"]; $password = $_GET["password"]; $registerkey = $_GET["registerkey"]; if (empty($sessionID)) die ("ERROR:INVALID_SESSION_ID"); $action = new action; if ($actionget == "connect") $response = $action->connect($user, $password); elseif ($response == "register") $response = $action->register($user, $password, $registerkey); else $response = "ERROR:NO_ACTION"; echo rc4($sessionID, $response); class action { public $bdd; public function action() { try { $this->bdd = new PDO('mysql:host=localhost;dbname=Je ', 'cache ', 'sa');} catch (exception $ex) { die('ERROR:ERROR_BDD_CONNECTION');} } public function connect($USER, $PASS) { if (!$this->userexist($USER)) return ("ERROR:USER_NOT_FOUND"); $data = $this->executeQuery("SELECT * FROM Users WHERE USER = ?;", array($USER)); if ($data['PASSWORD'] != md5($PASS)) return("ERROR:INCORRECT_PASSWORD"); elseif ($data['ACTIF'] == 0) return ("ERROR:USER_NOT_ACTIVE"); else return ("OK:") . $data['ADMIN']; } public function register($USER, $PASS, $KEY) { $data = $this->executeQuery("SELECT * FROM Registerkey WHERE ReKey = ?;", array($KEY)); if (empty($data['ReKey'])) return ("ERROR:INVALID_KEY"); if (!empty($data['USER'])) return ("ERROR:KEY_ALREADY_USED"); if ($this->userexist($USER)) return ("ERROR:USER_ALREADY_EXIST"); $this->executeQuery("INSERT INTO Users VALUES ('', ?, ?, 1, 0, ?);", array($USER, md5($PASS), getTime())); $this->executeQuery("UPDATE Registerkey SET USER = ? WHERE ReKey = ?;", array($USER, $KEY)); return ("OK:REGISTERED"); } private function userexist($USER) { $data = $this->executeQuery("SELECT * FROM Users WHERE USER = ?;", array($USER)); if (empty($data['USER'])) return (false); else return (true); } private function executeQuery($query, $args, $fetch = true) { $response = $this->bdd->prepare($query); $response->execute($args); if ($fetch) { $data = $response->fetch(); $response->closeCursor(); return ($data); } else return ($response); } function getTime() { date_default_timezone_set('France/Paris'); return date("Y-m-d H:m:s"); } function rc4($key, $str) { $s = array(); for ($i = 0; $i < 256; $i++) { $s[$i] = $i; } $j = 0; for ($i = 0; $i < 256; $i++) { $j = ($j + $s[$i] + ord($key[$i % strlen($key)])) % 256; $x = $s[$i]; $s[$i] = $s[$j]; $s[$j] = $x; } $i = 0; $j = 0; $res = ''; for ($y = 0; $y < strlen($str); $y++) { $i = ($i + 1) % 256; $j = ($j + $s[$i]) % 256; $x = $s[$i]; $s[$i] = $s[$j]; $s[$j] = $x; $res .= $str[$y] ^ chr($s[($s[$i] + $s[$j]) % 256]); } return $res; } ?>[/php]
Voila merci à vous :)

ViPHP
ViPHP | 1996 Messages

24 janv. 2017, 23:45

Quel est ton problème concrètement ?
It is nice to be important but it is more important to be nice
http://www.aureuswebfactory.fr

Petit nouveau ! | 4 Messages

25 janv. 2017, 20:31

Parse error: syntax error, unexpected '?>', expecting function (T_FUNCTION) in /home/u781305629/public_html/Action.php on line 116

Voila le probleme

Mammouth du PHP | 2703 Messages

25 janv. 2017, 20:48

class action
{
n'est jamais fermée.

Petit nouveau ! | 4 Messages

25 janv. 2017, 20:55

Oui mais du coup je fais comment ? je ne suis pas trop fort en php je début jusste

Petit nouveau ! | 4 Messages

25 janv. 2017, 21:21

C'est bon merci j'ai regler le probleme :)

ViPHP
ViPHP | 1996 Messages

26 janv. 2017, 21:08

Bon ne plus te tromper respecte l'indentation. Ainsi tu y verras plus clair.
It is nice to be important but it is more important to be nice
http://www.aureuswebfactory.fr