Skip to content

Commit 882294f

Browse files
committed
sql
sql
1 parent f8c5e13 commit 882294f

File tree

13 files changed

+42
-42
lines changed

13 files changed

+42
-42
lines changed

box/core/sandesh.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function start($data){
7070
}
7171
ksort($groupid);
7272
$gmd5 = md5(serialize($groupid));
73-
$stmt = $this->global['pdo']->prepare("INSERT INTO `{$data['db_prefix']}groups` (`id`,`groupid`) VALUES (:id,:groupid)");
73+
$stmt = $this->global['pdo']->prepare("INSERT INTO `{$data['db_prefix']}groups` (`id`,`groupid`) VALUES (:id,:groupid);");
7474
$stmt->execute(
7575
array(
7676
'id' => $group,
@@ -96,7 +96,7 @@ function start($data){
9696
// INSERT GROUP_USERS
9797

9898
foreach($users as $user){
99-
$stmt = $this->global['pdo']->prepare("INSERT INTO `{$data['db_prefix']}group_users` (`grupid`,`users`) VALUES (:grupid,:users)");
99+
$stmt = $this->global['pdo']->prepare("INSERT INTO `{$data['db_prefix']}group_users` (`grupid`,`users`) VALUES (:grupid,:users);");
100100
$stmt->execute(
101101
array(
102102
'grupid' => $group,
@@ -122,7 +122,7 @@ function start($data){
122122
);
123123
// INSERT GUEST END
124124
// INSERT MSGS
125-
$stmt = $this->global['pdo']->prepare("INSERT INTO `{$data['db_prefix']}msgs` (`msg`,`grp_id`,`sender_id`, `mid`) VALUES (:msg,:grp_id,:sender_id, 1)");
125+
$stmt = $this->global['pdo']->prepare("INSERT INTO `{$data['db_prefix']}msgs` (`msg`,`grp_id`,`sender_id`, `mid`) VALUES (:msg,:grp_id,:sender_id, 1);");
126126
$stmt->execute(
127127
array(
128128
'msg' => $_POST['kchat_msg'],
@@ -133,7 +133,7 @@ function start($data){
133133
// INSERT MSGS END
134134
// INSERT PLOTLY
135135
$x = date('Y-m-d H:00:00');
136-
$stmt = $this->global['pdo']->prepare("INSERT INTO `{$data['db_prefix']}plotly` (`y`,`x`) VALUES (1,:x) ON DUPLICATE KEY UPDATE y = y + 1");
136+
$stmt = $this->global['pdo']->prepare("INSERT INTO `{$data['db_prefix']}plotly` (`y`,`x`) VALUES (1,:x) ON DUPLICATE KEY UPDATE y = y + 1;");
137137
$stmt->execute(array('x' => $x));
138138
// INSERT PLOTLY END
139139
}
@@ -154,7 +154,7 @@ function msg($data){
154154

155155
$grp_id = $this->global['group_id'];
156156

157-
$stmt = $this->global['pdo']->prepare("SELECT IFNULL(MAX(`mid`) + 1, 0) as mid FROM `{$data['db_prefix']}msgs` WHERE `grp_id` = :grp_id");
157+
$stmt = $this->global['pdo']->prepare("SELECT IFNULL(MAX(`mid`) + 1, 0) as mid FROM `{$data['db_prefix']}msgs` WHERE `grp_id` = :grp_id;");
158158
$stmt->execute(
159159
array(
160160
'grp_id' => $grp_id
@@ -165,7 +165,7 @@ function msg($data){
165165
$mid = $row['mid'];
166166
}
167167

168-
$stmt = $this->global['pdo']->prepare("INSERT INTO `{$data['db_prefix']}msgs` (`msg`,`grp_id`,`sender_id`,`mid`) VALUES (:msg, :grp_id,:sender_id,:mid)");
168+
$stmt = $this->global['pdo']->prepare("INSERT INTO `{$data['db_prefix']}msgs` (`msg`,`grp_id`,`sender_id`,`mid`) VALUES (:msg, :grp_id,:sender_id,:mid);");
169169
$stmt->execute(
170170
array(
171171
'msg' => msgencode($msg),
@@ -185,7 +185,7 @@ function getmsg($post,$data){
185185
$sql = "UPDATE `{$data['db_prefix']}cache`
186186
SET `time` = UNIX_TIMESTAMP()
187187
WHERE uname = :uname AND
188-
process = 1";
188+
process = 1;";
189189
$sql_array = array(
190190
'uname' => $this->global['id']
191191
);
@@ -214,7 +214,7 @@ function getmsg($post,$data){
214214

215215
if($post['first_run'] == 'true'){
216216
//runing at first time
217-
$sql = "SELECT `id`,(select concat(fname,' ',lname) as username from {$data['db_prefix']}users where id = sender_id limit 1) as username,`msg`,`time`,`sender_id`,`mid` from {$data['db_prefix']}msgs WHERE mid >= 0 and `grp_id` = :grp_id2 and (select count(`id`) FROM `{$data['db_prefix']}group_users` WHERE `users` = :user AND `grupid` = :grp_id) != 0 ORDER BY id DESC limit 25";
217+
$sql = "SELECT `id`,(select concat(fname,' ',lname) as username from {$data['db_prefix']}users where id = sender_id limit 1) as username,`msg`,`time`,`sender_id`,`mid` from {$data['db_prefix']}msgs WHERE mid >= 0 and `grp_id` = :grp_id2 and (select count(`id`) FROM `{$data['db_prefix']}group_users` WHERE `users` = :user AND `grupid` = :grp_id) != 0 ORDER BY id DESC limit 25;";
218218

219219
$sql_array = array(
220220
'grp_id2' => $grp_id,
@@ -224,7 +224,7 @@ function getmsg($post,$data){
224224

225225
}else{
226226
//runing at all time
227-
$sql = "SELECT `id`,(select concat(fname,' ',lname) as username from {$data['db_prefix']}users where id = sender_id limit 1) as username,`msg`,`time`,`sender_id`,`mid` from {$data['db_prefix']}msgs WHERE mid > (select `seens` from `{$data['db_prefix']}group_users` where grupid = :grp_id0 and users = :user0 limit 1) and `grp_id` = :grp_id1 and (select count(`id`) FROM `{$data['db_prefix']}group_users` WHERE `users` = :user1 AND `grupid` = :grp_id2) != 0 ORDER BY id DESC";
227+
$sql = "SELECT `id`,(select concat(fname,' ',lname) as username from {$data['db_prefix']}users where id = sender_id limit 1) as username,`msg`,`time`,`sender_id`,`mid` from {$data['db_prefix']}msgs WHERE mid > (select `seens` from `{$data['db_prefix']}group_users` where grupid = :grp_id0 and users = :user0 limit 1) and `grp_id` = :grp_id1 and (select count(`id`) FROM `{$data['db_prefix']}group_users` WHERE `users` = :user1 AND `grupid` = :grp_id2) != 0 ORDER BY id DESC;";
228228
$sql_array = array(
229229
'grp_id0' => $grp_id,
230230
'user0' => $this->global['id'],
@@ -268,7 +268,7 @@ function getmsg($post,$data){
268268

269269
//updating message status
270270
if(isset($lastseen)){
271-
$stmt = $this->global['pdo']->prepare("UPDATE `{$data['db_prefix']}Group_users` SET `seens` = :seens where users = :users and grupid = :grupid");
271+
$stmt = $this->global['pdo']->prepare("UPDATE `{$data['db_prefix']}Group_users` SET `seens` = :seens where users = :users and grupid = :grupid;");
272272
$stmt->execute(
273273
array(
274274
'seens' => $lastseen,
@@ -283,7 +283,7 @@ function getmsg($post,$data){
283283
$offset = $_POST['offset'];
284284
if($offset != 'none'){
285285
//run to get old msgs
286-
$sql = "SELECT `id`,(select concat(fname,' ',lname) as username from {$data['db_prefix']}users where id = sender_id limit 1) as username,`msg`,`time`,`sender_id`,`mid` from {$data['db_prefix']}msgs WHERE mid >= 0 and mid < :mid and `grp_id` = :grp_id1 and (select count(`id`) FROM `{$data['db_prefix']}group_users` WHERE `users` = :users AND `grupid` = :grp_id2) != 0 ORDER BY id DESC limit 10";
286+
$sql = "SELECT `id`,(select concat(fname,' ',lname) as username from {$data['db_prefix']}users where id = sender_id limit 1) as username,`msg`,`time`,`sender_id`,`mid` from {$data['db_prefix']}msgs WHERE mid >= 0 and mid < :mid and `grp_id` = :grp_id1 and (select count(`id`) FROM `{$data['db_prefix']}group_users` WHERE `users` = :users AND `grupid` = :grp_id2) != 0 ORDER BY id DESC limit 10;";
287287

288288
$sql_array = array(
289289
'mid' => $offset,
@@ -349,14 +349,14 @@ function js($data){
349349
_p("global.heading = \"KChat\";\n");
350350
_p("global.dept = ");
351351
$dept = array();
352-
$stmt = $this->global['pdo']->prepare("SELECT `id`,`dept` FROM `{$data['db_prefix']}department`");
352+
$stmt = $this->global['pdo']->prepare("SELECT `id`,`dept` FROM `{$data['db_prefix']}department`;");
353353
$stmt->execute(array());
354354
$row = $stmt->fetchAll();
355355
_p(json_encode($row).";\n");
356356
}
357357

358358
function css($data){
359-
$stmt = $this->global['pdo']->prepare("SELECT `selecter`,`value`,`type`,`css` FROM `{$data['db_prefix']}setting`");
359+
$stmt = $this->global['pdo']->prepare("SELECT `selecter`,`value`,`type`,`css` FROM `{$data['db_prefix']}setting`;");
360360
$stmt->execute(array());
361361
$css = array();
362362
$row = $stmt->fetchAll();

kchat/actions/conline.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ function action(){
2222
$ip4db = $this->data['config']['path'].'/kchat/data/GeoLiteCity.dat';
2323
$ip6db = $this->data['config']['path'].'/kchat/data/GeoLiteCityv6.dat';
2424

25-
$stmt = $this->data['pdo']->prepare("SELECT `id`,(SELECT concat(`fname`,' ',`lname`) from {$this->dbprefix}users WHERE id = {$this->dbprefix}guest.id) as guest ,`ip`,`country_code`,`time_zone`,`latitude`,`longitude` from {$this->dbprefix}guest where `id` IN (SELECT `support_id` FROM `{$this->dbprefix}temp`);");
26-
$stmt->execute();
25+
$stmt = $this->data['pdo']->prepare("SELECT `id`,(SELECT concat(`fname`,' ',`lname`) from {$this->dbprefix}users WHERE id = {$this->dbprefix}guest.id) as guest ,`ip`,`country_code`,`time_zone`,`latitude`,`longitude` from {$this->dbprefix}guest where `id` IN (SELECT `support_id` FROM `{$this->dbprefix}cache` where (`time` > (unix_timestamp() - 5)));");
26+
$stmt->execute(array());
2727
while ($row = $stmt->fetch())
2828
{
2929
$conline[] = $row;
@@ -59,7 +59,7 @@ function action(){
5959

6060
if(isset($update)){
6161
foreach($update as $value){
62-
$stmt = $this->data['pdo']->prepare("UPDATE `{$this->dbprefix}guest` SET `country_code` = :country_code, `time_zone` = :time_zone, `latitude` = :latitude, `longitude` = :longitude where id = :id");
62+
$stmt = $this->data['pdo']->prepare("UPDATE `{$this->dbprefix}guest` SET `country_code` = :country_code, `time_zone` = :time_zone, `latitude` = :latitude, `longitude` = :longitude where id = :id;");
6363
$stmt->execute($value);
6464
}
6565
}

kchat/actions/createchat.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function action(){
3737
$row = $stmt->fetchAll();
3838

3939
if(!count($row)){
40-
$stmt = $this->data['pdo']->prepare("INSERT INTO `{$this->dbprefix}groups` (`id`,`groupid`) VALUES (:id,:groupid)");
40+
$stmt = $this->data['pdo']->prepare("INSERT INTO `{$this->dbprefix}groups` (`id`,`groupid`) VALUES (:id,:groupid);");
4141
$stmt->execute(
4242
array(
4343
'id' => $group,
@@ -46,7 +46,7 @@ function action(){
4646
);
4747

4848
foreach($users as $user){
49-
$stmt = $this->data['pdo']->prepare("INSERT INTO `{$this->dbprefix}group_users` (`grupid`,`users`) VALUES (:grupid,:users)");
49+
$stmt = $this->data['pdo']->prepare("INSERT INTO `{$this->dbprefix}group_users` (`grupid`,`users`) VALUES (:grupid,:users);");
5050
$stmt->execute(
5151
array(
5252
'grupid' => $group,
@@ -55,7 +55,7 @@ function action(){
5555
);
5656
}
5757

58-
$stmt = $this->data['pdo']->prepare("INSERT INTO `{$this->dbprefix}msgs` (`mid`,`msg`,`grp_id`,`sender_id`) VALUES (1,:msg,:grp_id,:sender_id)");
58+
$stmt = $this->data['pdo']->prepare("INSERT INTO `{$this->dbprefix}msgs` (`mid`,`msg`,`grp_id`,`sender_id`) VALUES (1,:msg,:grp_id,:sender_id);");
5959
$stmt->execute(
6060
array(
6161
'msg' => 'You are now connected on KChat',

kchat/actions/createuser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ function action(){
2121
)
2222
);
2323

24-
$stmt = $this->data['pdo']->prepare("SELECT uname FROM {$this->dbprefix}users where uname =:uname");
24+
$stmt = $this->data['pdo']->prepare("SELECT uname FROM {$this->dbprefix}users where uname =:uname;");
2525
$stmt->execute(array('uname' => $_POST['user_name']));
2626
$row = $stmt->fetch();
2727
if(isset($row['uname'])){
2828
echo json_encode(array('error' => 'User All Ready Exist'));
2929
return false;
3030
}
3131

32-
$stmt = $this->data['pdo']->prepare("insert into {$this->dbprefix}pusers (`fname`, `lname`, `uname`, `secret`, `depart`, `email`) values(:fname,:lname,:uname,:secret,:dept,:user_email)");
32+
$stmt = $this->data['pdo']->prepare("insert into {$this->dbprefix}pusers (`fname`, `lname`, `uname`, `secret`, `depart`, `email`) values(:fname,:lname,:uname,:secret,:dept,:user_email);");
3333
$stmt->execute($arr['verify']);
3434
$link = $this->data['config']['purl'].'/login/verify/'.base64_encode($arr['verify']['secret'].serialize($arr));
3535
//SENDING MAIL TO NEW USER EMAIL

kchat/actions/getdepart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class getdepart extends action{
1111
function action(){
1212
$dept = array();
1313

14-
$stmt = $this->data['pdo']->prepare("SELECT * FROM `{$this->dbprefix}department`");
14+
$stmt = $this->data['pdo']->prepare("SELECT * FROM `{$this->dbprefix}department`;");
1515
$stmt->execute(array());
1616
while ($row = $stmt->fetch())
1717
{

kchat/actions/guestlist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function action(){
1919
$limit = 10;
2020
}
2121

22-
$stmt = $this->data['pdo']->prepare("SELECT u.id,u.fname,u.lname,u.uname,g.ip,g.country_code,g.time_zone,g.latitude,g.longitude,u.ctime FROM {$this->dbprefix}users u join {$this->dbprefix}guest g WHERE u.role = 3 and u.id = g.id limit :limit offset :offset");
22+
$stmt = $this->data['pdo']->prepare("SELECT u.id,u.fname,u.lname,u.uname,g.ip,g.country_code,g.time_zone,g.latitude,g.longitude,u.ctime FROM {$this->dbprefix}users u join {$this->dbprefix}guest g WHERE u.role = 3 and u.id = g.id limit :limit offset :offset;");
2323
$stmt->execute(array('limit' => $limit,'offset' => $offset));
2424
while ($row = $stmt->fetch())
2525
{

kchat/actions/login.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function action(){
1111
if(isset($_POST['username'])){
1212
$user = $_POST['username'];
1313
$password = $_POST['password'];
14-
$stmt = $this->data['pdo']->prepare("SELECT * FROM `{$this->dbprefix}users` where uname = :uname");
14+
$stmt = $this->data['pdo']->prepare("SELECT * FROM `{$this->dbprefix}users` where uname = :uname;");
1515
$stmt->execute(array('uname' => $user));
1616
$success = 'fail';
1717
while ($row = $stmt->fetch())

kchat/actions/msgs.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function action($data){
7777
function getstatus($data){
7878
$return = array();
7979
$output = array();
80-
$stmt = $data['pdo']->prepare("SELECT * FROM `{$this->dbprefix}temp` where `group` = :group;");
80+
$stmt = $data['pdo']->prepare("select * from `{$this->dbprefix}cache` where (`time` > (unix_timestamp() - 5)) and `group` = :group;");
8181
$this->qfired++;
8282
$stmt->execute(array(
8383
'group' => getGroup($data)
@@ -190,7 +190,7 @@ function chats($data){
190190

191191
//updating message status
192192
if(isset($lastseen)){
193-
$stmt = $data['pdo']->prepare("UPDATE `{$this->dbprefix}group_users` SET `notify` = :notify where users = :users and grupid = :grupid");
193+
$stmt = $data['pdo']->prepare("UPDATE `{$this->dbprefix}group_users` SET `notify` = :notify where users = :users and grupid = :grupid;");
194194
$this->qfired++;
195195
$stmt->execute(
196196
array(
@@ -213,7 +213,7 @@ function msg_insert($data,$msg){
213213
}
214214

215215
// getting group id
216-
$stmt = $data['pdo']->prepare("SELECT IFNULL(MAX(`mid`) + 1, 0) as mid FROM `{$this->dbprefix}msgs` WHERE `grp_id` = :grp_id");
216+
$stmt = $data['pdo']->prepare("SELECT IFNULL(MAX(`mid`) + 1, 0) as mid FROM `{$this->dbprefix}msgs` WHERE `grp_id` = :grp_id;");
217217
$this->qfired++;
218218
$stmt->execute(
219219
array(
@@ -225,7 +225,7 @@ function msg_insert($data,$msg){
225225
$mid = $row['mid'];
226226
}
227227

228-
$stmt = $data['pdo']->prepare("INSERT INTO `{$this->dbprefix}msgs` (`msg`,`grp_id`,`sender_id`,`mid`) VALUES (:msg, :grp_id, :sender_id, :mid)");
228+
$stmt = $data['pdo']->prepare("INSERT INTO `{$this->dbprefix}msgs` (`msg`,`grp_id`,`sender_id`,`mid`) VALUES (:msg, :grp_id, :sender_id, :mid);");
229229
$this->qfired++;
230230

231231
$stmt->execute(
@@ -243,7 +243,7 @@ function msg_insert($data,$msg){
243243
$sql = "UPDATE `{$this->dbprefix}cache`
244244
SET `time` = UNIX_TIMESTAMP()
245245
WHERE uname = :uname AND
246-
process = 2";
246+
process = 2;";
247247
$sql_array = array(
248248
'uname' => $data['user']['uname']
249249
);
@@ -276,7 +276,7 @@ function message($data){
276276

277277
if($_POST['first_run'] == 'true'){
278278
//runing at first time
279-
$sql = "SELECT `id`,(select concat(fname,' ',lname) as username from {$this->dbprefix}users where id = sender_id limit 1) as username,`msg`,`time`,`sender_id`,`mid` from {$this->dbprefix}msgs WHERE mid >= 0 and `grp_id` = :grp_id2 and (select count(`id`) FROM `{$this->dbprefix}group_users` WHERE `users` = :user AND `grupid` = :grp_id) != 0 ORDER BY id DESC limit 25";
279+
$sql = "SELECT `id`,(select concat(fname,' ',lname) as username from {$this->dbprefix}users where id = sender_id limit 1) as username,`msg`,`time`,`sender_id`,`mid` from {$this->dbprefix}msgs WHERE mid >= 0 and `grp_id` = :grp_id2 and (select count(`id`) FROM `{$this->dbprefix}group_users` WHERE `users` = :user AND `grupid` = :grp_id) != 0 ORDER BY id DESC limit 25;";
280280

281281
$sql_array = array(
282282
'grp_id2' => $grp_id,
@@ -286,7 +286,7 @@ function message($data){
286286

287287
}else{
288288
//runing at all time
289-
$sql = "SELECT `id`,(select concat(fname,' ',lname) as username from {$this->dbprefix}users where id = sender_id limit 1) as username,`msg`,`time`,`sender_id`,`mid` from {$this->dbprefix}msgs WHERE mid > (select `seens` from `{$this->dbprefix}group_users` where grupid = :grp_id0 and users = :user0 limit 1) and `grp_id` = :grp_id1 and (select count(`id`) FROM `{$this->dbprefix}group_users` WHERE `users` = :user1 AND `grupid` = :grp_id2) != 0 ORDER BY id DESC";
289+
$sql = "SELECT `id`,(select concat(fname,' ',lname) as username from {$this->dbprefix}users where id = sender_id limit 1) as username,`msg`,`time`,`sender_id`,`mid` from {$this->dbprefix}msgs WHERE mid > (select `seens` from `{$this->dbprefix}group_users` where grupid = :grp_id0 and users = :user0 limit 1) and `grp_id` = :grp_id1 and (select count(`id`) FROM `{$this->dbprefix}group_users` WHERE `users` = :user1 AND `grupid` = :grp_id2) != 0 ORDER BY id DESC;";
290290
$sql_array = array(
291291
'grp_id0' => $grp_id,
292292
'user0' => $data['user']['id'],
@@ -333,7 +333,7 @@ function message($data){
333333
// lastseen is set first time for limit 25 and sets seens to last row witch is selected at first run hance second time msgs are fetch because seen in not equals to last msg id
334334
//updating message status
335335
if(isset($lastseen)){
336-
$sql = "UPDATE `{$this->dbprefix}group_users` SET `seens` = :seens where users = :users and grupid = :grupid";
336+
$sql = "UPDATE `{$this->dbprefix}group_users` SET `seens` = :seens where users = :users and grupid = :grupid;";
337337
$sql_array = array(
338338
'seens' => $lastseen,
339339
'users' => $data['user']['id'],
@@ -349,7 +349,7 @@ function message($data){
349349
$offset = $_POST['offset'];
350350
if($offset != 'none'){
351351
//run to get old msgs
352-
$sql = "SELECT `id`,(select concat(fname,' ',lname) as username from {$this->dbprefix}users where id = sender_id limit 1) as username,`msg`,`time`,`sender_id`,`mid` from {$this->dbprefix}msgs WHERE mid >= 0 and mid < :mid and `grp_id` = :grp_id1 and (select count(`id`) FROM `{$this->dbprefix}group_users` WHERE `users` = :users AND `grupid` = :grp_id2) != 0 ORDER BY id DESC limit 10";
352+
$sql = "SELECT `id`,(select concat(fname,' ',lname) as username from {$this->dbprefix}users where id = sender_id limit 1) as username,`msg`,`time`,`sender_id`,`mid` from {$this->dbprefix}msgs WHERE mid >= 0 and mid < :mid and `grp_id` = :grp_id1 and (select count(`id`) FROM `{$this->dbprefix}group_users` WHERE `users` = :users AND `grupid` = :grp_id2) != 0 ORDER BY id DESC limit 10;";
353353

354354
$sql_array = array(
355355
'mid' => $offset,
@@ -416,7 +416,7 @@ function lastaccess($data){
416416
SET `time` = UNIX_TIMESTAMP(),
417417
`group` = :group
418418
WHERE uname = :uname AND
419-
process = 1";
419+
process = 1;";
420420
$sql_array = array(
421421
'group' => getGroup($data),
422422
'uname' => $data['user']['uname']

kchat/actions/plotly.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function action(){
1616
$json = 'cache/Plotly.json';
1717
//create cache in every 5 second on access
1818
if((time() - @filemtime($json)) > 5){
19-
$stmt = $this->data['pdo']->prepare("SELECT `x`, `y` from {$this->dbprefix}plotly WHERE x >= DATE_SUB(NOW(), INTERVAL 7 DAY)");
20-
$stmt->execute();
19+
$stmt = $this->data['pdo']->prepare("SELECT `x`, `y` from {$this->dbprefix}plotly WHERE x >= DATE_SUB(NOW(), INTERVAL 7 DAY);");
20+
$stmt->execute(array());
2121
while ($row = $stmt->fetch())
2222
{
2323
$graph_json[$row['x']] = $row['y'];

kchat/actions/profile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ function action(){
2222
echo "Password Doesn't match";
2323
}
2424

25-
$stmt = $this->data['pdo']->prepare("SELECT * FROM {$this->dbprefix}users where uname =:uname");
25+
$stmt = $this->data['pdo']->prepare("SELECT * FROM {$this->dbprefix}users where uname =:uname;");
2626
$stmt->execute(array('uname' => $_POST['uname']));
2727
$row = $stmt->fetch();
2828
if(empty($arr['profile']['password'])){
2929
$arr['profile']['password'] = $row['password'];
3030
}
3131
if(isset($row['uname'])){
32-
$sql = "UPDATE {$this->dbprefix}users SET fname = :fname,lname = :lname,password = :password WHERE uname = :uname";
32+
$sql = "UPDATE {$this->dbprefix}users SET fname = :fname,lname = :lname,password = :password WHERE uname = :uname;";
3333
$stmt = $this->data['pdo']->prepare($sql);
3434
$stmt->execute($arr['profile']);
3535
session::setSession($this->data,$row);

0 commit comments

Comments
 (0)