mirror of
https://github.com/dyzulk/raisen-app.git
synced 2026-01-26 13:22:00 +07:00
Update functions.php
This commit is contained in:
committed by
GitHub
parent
b1e71fde48
commit
726eb3ff61
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// koneksi ke database
|
// koneksi ke database
|
||||||
$conn = mysqli_connect("localhost", "root", "", "phpdasar", "3308");
|
$conn = mysqli_connect("localhost", "root", "", "raisenapp");
|
||||||
|
|
||||||
function ranID(){
|
function ranID(){
|
||||||
$prefix = "pel-";
|
$prefix = "pel-";
|
||||||
@@ -28,39 +28,6 @@ function getuser($id) {
|
|||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getdata2($table, $id) {
|
|
||||||
global $conn;
|
|
||||||
|
|
||||||
// Menggunakan prepared statement untuk mencegah SQL injection
|
|
||||||
$stmt = mysqli_prepare($conn, "SELECT * FROM $table WHERE id = ?");
|
|
||||||
mysqli_stmt_bind_param($stmt, "i", $id);
|
|
||||||
mysqli_stmt_execute($stmt);
|
|
||||||
|
|
||||||
$result = mysqli_stmt_get_result($stmt);
|
|
||||||
$data = mysqli_fetch_assoc($result);
|
|
||||||
|
|
||||||
// mysqli_close($conn);
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getuser2($id) {
|
|
||||||
global $conn;
|
|
||||||
$table = "user";
|
|
||||||
|
|
||||||
// Menggunakan prepared statement untuk mencegah SQL injection
|
|
||||||
$stmt = mysqli_prepare($conn, "SELECT $id FROM user WHERE id = ?");
|
|
||||||
mysqli_stmt_bind_param($stmt, "i", $id);
|
|
||||||
mysqli_stmt_execute($stmt);
|
|
||||||
|
|
||||||
$result = mysqli_stmt_get_result($stmt);
|
|
||||||
$data = mysqli_fetch_assoc($result);
|
|
||||||
|
|
||||||
// mysqli_close($conn);
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
function role_id($id) {
|
function role_id($id) {
|
||||||
global $conn;
|
global $conn;
|
||||||
$table = "user";
|
$table = "user";
|
||||||
|
|||||||
Reference in New Issue
Block a user