diff --git a/app/getuserdata.php b/app/getuserdata.php new file mode 100644 index 0000000..dc2dedc --- /dev/null +++ b/app/getuserdata.php @@ -0,0 +1,24 @@ +id = $id; + $this->mysqlConnection = $mysqlConnection; + } + + public function getData() + { + $command = "SELECT * FROM `userdata` WHERE `userid` LIKE '$this->id';"; + $res = mysqli_query($this->mysqlConnection, $command); + return mysqli_fetch_array($res)[1]; + } + + +} \ No newline at end of file diff --git a/app/getuserid.php b/app/getuserid.php new file mode 100644 index 0000000..a9d1025 --- /dev/null +++ b/app/getuserid.php @@ -0,0 +1,26 @@ +username = $username; + $this->mysqlConnection = $mysqlConnection; + } + + public function getID() + { + $command = "SELECT * FROM `useraccounts` WHERE `username` LIKE '$this->username';"; + $res = mysqli_query($this->mysqlConnection, $command); + $useraccountsDB = mysqli_fetch_array($res); + return $useraccountsDB[0]; + + } + + +} \ No newline at end of file diff --git a/app/register.php b/app/register.php index 2488ef5..60e5470 100644 --- a/app/register.php +++ b/app/register.php @@ -22,4 +22,19 @@ public function newUser() return $this->mysqlconnection->query("INSERT INTO `useraccounts` (`ID`, `username`, `password`, `email`) VALUES (NULL, '$this->name', '$createHashPassword', '$this->email')"); } + public function newUser2() + { + $createHashPassword = password_hash($this->password, PASSWORD_DEFAULT); + return $this->mysqlconnection->query("INSERT INTO `useraccounts` (`ID`, `username`, `password`, `email`) VALUES (NULL, '$this->name', '$createHashPassword', '$this->email');"); + + $this->getID($this->name, $this->mysqlconnection); + + + // wir brauchen die ID um ein neues Space zu erstellen + //-> Space erstellen + + } + +// Beim registieren muss eine neue Space eingerichtet werden! + } \ No newline at end of file diff --git a/app/test.php b/app/test.php new file mode 100644 index 0000000..a29b324 --- /dev/null +++ b/app/test.php @@ -0,0 +1,33 @@ +query("SELECT `Username` FROM `Accounts` ORDER BY RAND() LIMIT 5;"); +$clickTest = "No button has been clicked"; +if (isset($_POST["showAllSort"])) { + $entries = $db->query("SELECT `Username` FROM `Accounts` ORDER BY RAND();"); + $clickTest = "Show all button has been clicked"; + +} elseif (isset($_POST["alphabetSort"])) { + $entries = $db->query("SELECT `Username` FROM `Accounts` ORDER BY ASC;"); + $clickTest = "Sort by Alphabet has been clicked"; +} + +echo $clickTest; + +while ($row = $entries->fetch_assoc()){ +?> + +
+ +
+ +