added username search
This commit is contained in:
parent
981e3937e7
commit
84da0c9656
1 changed files with 30 additions and 0 deletions
30
search.php
Normal file
30
search.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* smzint/Messages (c) schmamazon.com 2025
|
||||
*/
|
||||
|
||||
include('/smzint/Auth/db.ini.php');
|
||||
|
||||
function username($uname){
|
||||
global $dbservername;
|
||||
global $dbusername;
|
||||
global $dbpassword;
|
||||
global $dbname;
|
||||
|
||||
$conn = new mysqli($dbservername, $dbusername, $dbpassword, $dbname);
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
$sql = "SELECT uid FROM smz_messages_users WHERE username='$uname'";
|
||||
$result = $conn->query($sql);
|
||||
$conn->close();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
return $row["uid"];
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue