| Server IP : 46.202.172.170 / Your IP : 216.73.216.59 Web Server : LiteSpeed System : Linux fr-int-web1904.main-hosting.eu 5.14.0-503.34.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Mar 27 06:00:50 EDT 2025 x86_64 User : u627918583 ( 627918583) PHP Version : 8.2.28 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/u627918583/domains/techtime-om.com/public_html/controlPanel/ |
Upload File : |
<?php
session_start();
class Database{
protected $link, $result, $rownum;
// method / function
public function __construct() {
$this->link = mysqli_connect("localhost","u627918583_kjdhjk",'R3a#VKA?/',"u627918583_kjdhjk");
mysqli_set_charset($this->link,"utf8");
}
public function dbQuery($sql){
$this->result = mysqli_query($this->link, $sql);
if (!$this->result) {
die("Query failed: " . mysqli_error($this->link));
}
return $this->result;
// $this->rownum = mysqli_num_rows($this->result);
}
public function Last_id(){
return mysqli_insert_id($this->link);
}
public function dbNumRows(){
$this->rownum = mysqli_num_rows($this->result);
return $this->rownum;
}
public function dbFetchResult($result){
$rows = array();
for($i = 1; $i <= $this->dbNumRows(); $i++){
$rows[$i] = mysqli_fetch_array($this->result);
}
return $rows;
}
public function dbFetchRecord($result){
return mysqli_fetch_array($this->result);
}
function doLogin()
{
$errMessage = "";
$username = $_POST['txtUserName'];
$password = $_POST['txtPassword'];
if($username !="" && $password !="")
{
$query = "Select id from users
where username = '$username' and
password = '$password'";
$result = $this->dbQuery($query);
if($this->dbNumRows($result) > 0 )
{
$rows = $this->dbFetchResult($result);
foreach ($rows as $row) {
# code...
$_SESSION['id'] = $row[0];
}
// $session = array('id'=> $row[0], 'name'=>$row[1])
$_SESSION['name'] = $username; // $row[1]
header('location:dashboard.php');
}else
$errMessage = "الرجاء التأكد من اسم المستخدم وكلمة المرور";
}else
$errMessage ="الرجاء ادخال اسم المستخدم وكلمة المرور";
return $errMessage;
}
function CheckUser()
{
if(!isset($_SESSION['id']))
{
header('location:login.php');
}
}
}
?>