-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Maxim Gofman
authored and
Maxim Gofman
committed
Jan 7, 2022
1 parent
521f525
commit e0b7cf4
Showing
5 changed files
with
111 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace app; | ||
|
||
class getuserdata | ||
{ | ||
protected $id; | ||
protected $mysqlConnection; | ||
|
||
public function __construct($id, $mysqlConnection) | ||
{ | ||
$this->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]; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace app; | ||
|
||
class getuserid | ||
{ | ||
protected $username; | ||
protected $mysqlConnection; | ||
|
||
public function __construct($username, $mysqlConnection) | ||
{ | ||
$this->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]; | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
$entries = $db->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()){ | ||
?> | ||
|
||
<h3> Other players </h3> | ||
<button name="showAllSort" type="button"> Show All</button> | ||
<button name="alphabetSort" type="button"> Sort by Alphabet</button> | ||
<button name="friendsSort" type="button"> Sort by most friends</button> | ||
<div> | ||
<p> | ||
|
||
<div style="padding-bottom: 0.5em"> | ||
<p style="display: inline; margin-right: 3em"> <?php echo $row['Username']; ?> </p> | ||
<button name="friends" type="button"> Add Friend </button> | ||
<br> | ||
</div> | ||
<?php | ||
} | ||
?> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters