nimic"; @$sql = "SELECT id,fname,lname,role FROM users WHERE user='".$userid."'"; $result = $conn->query($sql); $num_row = mysqli_num_rows($result); if($num_row == 1 ) { while( $row=mysqli_fetch_array($result) ){ extract($row); $uid = $id; $name = $fname." ".$lname; $role = $role; } } else { echo ''; } $back = ' back |'; //------ $sql22 = "SELECT id,apykey FROM googlemaps"; $result22 = $conn->query($sql22); $num_row22 = mysqli_num_rows($result22); if($num_row22 == 1 ) { while( $row22 = mysqli_fetch_array($result22) ){ extract($row22); $apykey = $apykey; } } if(empty($apykey)) { $apykey = "Enter api key here"; } function alert($msg,$m){ echo '
'.$msg.' ×
'; } ?> Airbnb | Admin

query($sql); $num_row = mysqli_num_rows($result); if($num_row == 1 ) { while( $row=mysqli_fetch_array($result) ){ extract($row); include('assets/html/viewcont.html'); } } else { echo "nimic"; } } else if($view == 'host') { $sql = "SELECT * FROM hosturi WHERE id='$id'"; $result = $conn->query($sql); $num_row = mysqli_num_rows($result); if($num_row == 1 ) { while( $row=mysqli_fetch_array($result) ){ extract($row); include('assets/html/viewhost.html'); } } else { echo "No hosts found"; } } } else if(isset($_GET['set'])) { extract($_GET); if($set == 'cont') { $sql = "SELECT * FROM conturi WHERE id='$id'"; $result = $conn->query($sql); $num_row = mysqli_num_rows($result); if($num_row == 1 ) { while( $row=mysqli_fetch_array($result) ){ extract($row); $_SESSION['pid'] = $id; $msg = "Contul ".$iban." este setat!
"; alert($msg,1); } } else { alert("Ceva nu e bine si sa s-a setat nimic!",0); } } else if($set == 'host') { $sql = "SELECT * FROM hosturi WHERE id='$id'"; $result = $conn->query($sql); $num_row = mysqli_num_rows($result); if($num_row == 1 ) { while( $row=mysqli_fetch_array($result) ){ extract($row); $_SESSION['hid'] = $id; $msg = "Hostul ".$nume." este setat!
"; alert($msg,1); } } else { alert("Ceva nu e bine si sa s-a setat nimic!",0); } } } else if(isset($_GET['edit'])) { extract($_GET); if($edit == 'cont') { if(isset($_POST['submit'])){ //submit $sql = "UPDATE conturi SET banca='".$_POST['banca']."', iban='".$_POST['iban']."', nume='".$_POST['nume']."', swift='".$_POST['swift']."', ifo='".$_POST['ifo']."' WHERE id=".$_POST['id']; if ($conn->query($sql) === TRUE) { $msg = "Contul a fost schimbat"; alert($msg,1); } else { $msg = "Eroare: " . $conn->error; alert($msg,0); } //submit } //--------- $sql = "SELECT * FROM conturi WHERE id='".$_GET['id']."'"; $result = $conn->query($sql); $num_row = mysqli_num_rows($result); if($num_row == 1 ) { while( $row=mysqli_fetch_array($result) ){ extract($row); include('assets/html/editcont.html'); } } else { echo "nimic"; } ///------------ } else if($edit == 'host') { if(isset($_POST['submit'])){ //submit $sql = "UPDATE hosturi SET nume='".$_POST['nume']."', poza='".$_POST['poza']."', email='".$_POST['email']."' WHERE id=".$_POST['id']; if ($conn->query($sql) === TRUE) { $msg = "Hostul a fost schimbat"; alert($msg,1); } else { $msg = "Eroare: " . $conn->error; alert($msg,0); } //submit } //--------- $sql = "SELECT * FROM hosturi WHERE id='".$_GET['id']."'"; $result = $conn->query($sql); $num_row = mysqli_num_rows($result); if($num_row == 1 ) { while( $row=mysqli_fetch_array($result) ){ extract($row); include('assets/html/edithost.html'); } } else { echo "nimic"; } ///------------ } } else if(isset($_GET['del'])) { extract($_GET); if($del == 'cont') { //88888888888 $sql = "DELETE FROM conturi WHERE id=".$_GET['id']; if ($conn->query($sql) === TRUE) { $msg = "Contul a fost sters"; alert($msg,1); } else { $msg = "Eroare: " . $conn->error; alert($msg,0); } //44444444444444 } else if($del == 'host') { //88888888888 $sql = "DELETE FROM hosturi WHERE id='".$_GET['id']."'"; if ($conn->query($sql) === TRUE) { $msg = "Hostul a fost sters"; alert($msg,1); } else { $msg = "Eroare: " . $conn->error; alert($msg,0); } //44444444444444 } else if($del == 'guest') { //88888888888 $sql = "DELETE FROM bookings WHERE bookcode='".$_GET['code']."'"; if ($conn->query($sql) === TRUE) { unlink("rooms/inv/".$_GET['code'].".html"); $msg = "Guest deleted"; alert($msg,1); } else { $msg = "Eroare: " . $conn->error; alert($msg,0); } //44444444444444 } else if($del == 'user') { //88888888888 $sql = "DELETE FROM users WHERE id=".$_GET['id']; if ($conn->query($sql) === TRUE) { $msg = "Userul a fost sters"; alert($msg,1); } else { $msg = "Eroare: " . $conn->error; alert($msg,0); } //44444444444444 } else if($del == 'room') { //88888888888 $sql = "DELETE FROM rooms WHERE id=".$_GET['id']; if ($conn->query($sql) === TRUE) { $msg = "Property successfully deleted from database"; alert($msg,1); $rmid = $_GET['roomid']; $deldir = "rooms/images/".$rmid; //$delfile = "rooms/".$rmid.".php"; //$delcfg = "rooms/cfg/".$rmid."-config.php"; function delRoom($str) { if (is_file($str)) { return @unlink($str); } elseif (is_dir($str)) { $scan = glob(rtrim($str,'/').'/*'); foreach($scan as $index=>$path) { delRoom($path); } return @rmdir($str); } } if(DelRoom($deldir)) { alert("Images successfully deleted",1); } else { alert("Images not deleted",0); } //if(DelRoom($delfile)) { alert("File successfully deleted",1); } else { alert("File was not deleted",0); } //if(DelRoom($delcfg)) { alert("Cfg file successfully deleted",1); } else { alert("Cfg file was not deleted",0); } } else { $msg = "Eroare: " . $conn->error; alert($msg,0); } //44444444444444 } } else if(isset($_GET['add'])) { extract($_GET); if($add == 'cont') { if(isset($_POST['submit'])){ //inset $sql = "INSERT INTO conturi (banca,iban,nume,swift,ifo,uid) VALUES ('".$_POST['banca']."','".$_POST['iban']."','".$_POST['nume']."','".$_POST['swift']."', '".$_POST['ifo']."','".$_POST['uid']."')"; if ($conn->query($sql) === TRUE) { $msg = "Contul a fost adaugat"; alert($msg,1); } else { $msg = "Eroare: " . $conn->error; alert($msg,0); } //inset } include('assets/html/addcont.html'); } else if($add == 'host') { if(isset($_POST['submit'])){ //inset $sql = "INSERT INTO hosturi (nume,poza,email,uid) VALUES ('".$_POST['nume']."','".$_POST['poza']."', '".$_POST['email']."','".$_POST['uid']."')"; if ($conn->query($sql) === TRUE) { $msg = "Hostul a fost adaugat"; alert($msg,1); } else { $msg = "Eroare: " . $conn->error; alert($msg,0); } //inset } include('assets/html/addhost.html'); } } else if(isset($_GET['adduser'])) { if(isset($_POST['submit'])){ // add user $sql = "INSERT INTO users (user,pass,fname,lname,role) VALUES ('".$_POST['user']."','".md5($_POST['pass'])."', '".$_POST['fname']."','".$_POST['lname']."','".$_POST['role']."')"; if ($conn->query($sql) === TRUE) { $err = $_POST['user']." a fost adaugat"; alert($err,1); } else { $err = $conn->error; alert($err,0); } //add user } include("assets/html/adduser.html"); } if(isset($_GET['viewusers'])) { include('assets/html/useri.html'); } ?>