-
Notifications
You must be signed in to change notification settings - Fork 3
/
bookings_autofill.php
64 lines (52 loc) · 2.83 KB
/
bookings_autofill.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
// This script and data application were generated by AppGini 5.71
// Download AppGini for free from https://bigprof.com/appgini/download/
$currDir = dirname(__FILE__);
include("$currDir/defaultLang.php");
include("$currDir/language.php");
include("$currDir/lib.php");
handle_maintenance();
header('Content-type: text/javascript; charset=' . datalist_db_encoding);
$table_perms = getTablePermissions('bookings');
if(!$table_perms[0]){ die('// Access denied!'); }
$mfk = $_GET['mfk'];
$id = makeSafe($_GET['id']);
$rnd1 = intval($_GET['rnd1']); if(!$rnd1) $rnd1 = '';
if(!$mfk){
die('// No js code available!');
}
switch($mfk){
case 'id_number':
if(!$id){
?>
$j('#fullname<?php echo $rnd1; ?>').html(' ');
$j('#phone<?php echo $rnd1; ?>').html(' ');
<?php
break;
}
$res = sql("SELECT `customers`.`id` as 'id', `customers`.`fullname` as 'fullname', `customers`.`phone` as 'phone', `customers`.`id_number` as 'id_number' FROM `customers` WHERE `customers`.`id`='{$id}' limit 1", $eo);
$row = db_fetch_assoc($res);
?>
$j('#fullname<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['fullname']))); ?> ');
$j('#phone<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['phone']))); ?> ');
<?php
break;
case 'bus':
if(!$id){
?>
$j('#amount<?php echo $rnd1; ?>').html(' ');
$j('#date<?php echo $rnd1; ?>').html(' ');
$j('#time<?php echo $rnd1; ?>').html(' ');
<?php
break;
}
$res = sql("SELECT `availability`.`id` as 'id', IF( CHAR_LENGTH(`buses1`.`number`), CONCAT_WS('', `buses1`.`number`), '') as 'bus', IF( CHAR_LENGTH(`routes1`.`name`) || CHAR_LENGTH(`routes1`.`time`), CONCAT_WS('', `routes1`.`name`, ' :', `routes1`.`time`), '') as 'route', IF( CHAR_LENGTH(`routes1`.`amount`), CONCAT_WS('', `routes1`.`amount`), '') as 'amount', if(`availability`.`date`,date_format(`availability`.`date`,'%m/%d/%Y'),'') as 'date', TIME_FORMAT(`availability`.`time`, '%r') as 'time', `availability`.`status` as 'status' FROM `availability` LEFT JOIN `buses` as buses1 ON `buses1`.`id`=`availability`.`bus` LEFT JOIN `routes` as routes1 ON `routes1`.`id`=`availability`.`route` WHERE `availability`.`id`='{$id}' limit 1", $eo);
$row = db_fetch_assoc($res);
?>
$j('#amount<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['amount']))); ?> ');
$j('#date<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['date']))); ?> ');
$j('#time<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['time']))); ?> ');
<?php
break;
}
?>