· 8 years ago · May 03, 2018, 07:32 PM
1<?php
2 class harry_potter {
3
4 const Database = 'php';
5 const username = 'root';
6 const password = '';
7 const Server = 'localhost';
8
9 public $array;
10 public $tablename = "";
11 public $msg_ins = "";
12 public $msg_up = "";
13 public $db = "";
14 public $localhost = "";
15 public $pas = "";
16 public $user = "";
17 public $id_up = ""; //اسم المستخدم
18 public $ok = false;
19
20 public function __construct($table, Array $value)
21 {
22 $this->localhost = harry_potter::Server;
23 $this->user = harry_potter::username;
24 $this->pas = harry_potter::password;
25 $this->db = harry_potter::Database;
26 $this->tablename = $table;
27 $this->tablename = $table;
28 $this->array = $value;
29 }
30
31 function get_num_of_words($string)
32 {
33 $string = preg_replace('/\s+/', ' ', trim($string));
34 $words = explode(" ", $string);
35 return count($words);
36 }
37
38 public function up_col_2_Basic($var1, $id)
39 {
40 try {
41 $cdn = $this->con_db();
42 $tablename = $this->tablename;
43 $select = $cdn->query('SELECT * FROM ' . $tablename);
44 $total_column = $select->columnCount();
45 for ($counter = 0; $counter <= $total_column; $counter ++)
46 {
47 $meta = $select->getColumnMeta($counter);
48 $column[] = $meta['name'];
49 }
50 $coulam = $column[0];
51
52 $coulam1 = $column[1];
53
54//----------------------------------------------------------
55 $sql = "UPDATE `$tablename` SET `$coulam1` = :$coulam1 WHERE `id` = :id;";
56 $con = $this->con_db();
57 if ($statement = $con->prepare($sql))
58 {
59 $statement->bindValue(":$coulam1", $var1, PDO::PARAM_STR);
60 $statement->bindValue(":id", $id, PDO::PARAM_INT);
61 if ($statement->execute())
62 {
63 $this->msg_up;
64 }
65 }
66 } catch (PDOException $exc) {
67 $exc->getMessage();
68 }
69 }
70
71 public function up_col_3($var1, $var2, $id)
72 {
73 try {
74 $cdn = $this->con_db();
75 $tablename = $this->tablename;
76 $select = $cdn->query('SELECT * FROM ' . $tablename);
77 $total_column = $select->columnCount();
78 for ($counter = 0; $counter <= $total_column; $counter ++)
79 {
80 $meta = $select->getColumnMeta($counter);
81 $column[] = $meta['name'];
82 }
83 $coulam = $column[0];
84
85 $coulam1 = $column[1];
86
87 $coulam2 = $column[2];
88
89//----------------------------------------------------------
90 $sql = "UPDATE `$tablename` SET `$coulam1` = :$coulam1, `$coulam2` = :$coulam2 WHERE `id` = :id;";
91 $con = $this->con_db();
92 if ($statement = $con->prepare($sql))
93 {
94 $statement->bindValue(":$coulam1", $var1, PDO::PARAM_STR);
95 $statement->bindValue(":$coulam2", $var2, PDO::PARAM_STR);
96 $statement->bindValue(":id", $id, PDO::PARAM_INT);
97 if ($statement->execute())
98 {
99 echo $this->msg_up;
100 }
101 }
102 } catch (PDOException $exc) {
103 echo $exc->getMessage();
104 }
105 }
106
107 public function up_col_4($var1, $var2, $var3, $id)
108 {
109 try {
110 $cdn = $this->con_db();
111 $tablename = $this->tablename;
112 $select = $cdn->query('SELECT * FROM ' . $tablename);
113 $total_column = $select->columnCount();
114 for ($counter = 0; $counter <= $total_column; $counter ++)
115 {
116 $meta = $select->getColumnMeta($counter);
117 $column[] = $meta['name'];
118 }
119 $coulam = $column[0];
120
121 $coulam1 = $column[1];
122
123 $coulam2 = $column[2];
124
125 $coulam3 = $column[3];
126
127//----------------------------------------------------------
128 $sql = "UPDATE `$tablename` SET `$coulam1` = :$coulam1, `$coulam2` = :$coulam2, `$coulam3` = :$coulam3 WHERE `id` = :id;";
129 $con = $this->con_db();
130 if ($statement = $con->prepare($sql))
131 {
132 $statement->bindValue(":$coulam1", $var1, PDO::PARAM_STR);
133 $statement->bindValue(":$coulam2", $var2, PDO::PARAM_STR);
134 $statement->bindValue(":$coulam3", $var3, PDO::PARAM_STR);
135 $statement->bindValue(":id", $id, PDO::PARAM_INT);
136 if ($statement->execute())
137 {
138 echo $this->msg_up;
139 }
140 }
141 } catch (PDOException $exc) {
142 echo $exc->getMessage();
143 }
144 }
145
146 public function up_col_5($var1, $var2, $var3, $var4, $id)
147 {
148 try {
149 $cdn = $this->con_db();
150 $tablename = $this->tablename;
151 $select = $cdn->query('SELECT * FROM ' . $tablename);
152 $total_column = $select->columnCount();
153 for ($counter = 0; $counter <= $total_column; $counter ++)
154 {
155 $meta = $select->getColumnMeta($counter);
156 $column[] = $meta['name'];
157 }
158 $coulam = $column[0];
159
160 $coulam1 = $column[1];
161
162 $coulam2 = $column[2];
163
164 $coulam3 = $column[3];
165
166 $coulam4 = $column[4];
167
168//----------------------------------------------------------
169 $sql = "UPDATE `$tablename` SET `$coulam1` = :$coulam1, `$coulam2` = :$coulam2, `$coulam3` = :$coulam3, `$coulam4` = :$coulam4 WHERE `id` = :id;";
170 $con = $this->con_db();
171 if ($statement = $con->prepare($sql))
172 {
173 $statement->bindValue(":$coulam1", $var1, PDO::PARAM_STR);
174 $statement->bindValue(":$coulam2", $var2, PDO::PARAM_STR);
175 $statement->bindValue(":$coulam3", $var3, PDO::PARAM_STR);
176 $statement->bindValue(":$coulam4", $var4, PDO::PARAM_STR);
177 $statement->bindValue(":id", $id, PDO::PARAM_INT);
178 if ($statement->execute())
179 {
180 echo $this->msg_up;
181 }
182 }
183 } catch (PDOException $exc) {
184 echo $exc->getMessage();
185 }
186 }
187
188 public function up_col_6($var1, $var2, $var3, $var4, $var5, $id)
189 {
190 try {
191 $cdn = $this->con_db();
192 $tablename = $this->tablename;
193 $select = $cdn->query('SELECT * FROM ' . $tablename);
194 $total_column = $select->columnCount();
195 for ($counter = 0; $counter <= $total_column; $counter ++)
196 {
197 $meta = $select->getColumnMeta($counter);
198 $column[] = $meta['name'];
199 }
200 $coulam = $column[0];
201
202 $coulam1 = $column[1];
203
204 $coulam2 = $column[2];
205
206 $coulam3 = $column[3];
207
208 $coulam4 = $column[4];
209
210 $coulam5 = $column[5];
211
212//----------------------------------------------------------
213 $sql = "UPDATE `$tablename` SET `$coulam1` = :$coulam1, `$coulam2` = :$coulam2, `$coulam3` = :$coulam3, `$coulam4` = :$coulam4, `$coulam5` = :$coulam5 WHERE `id` = :id;";
214 $con = $this->con_db();
215 if ($statement = $con->prepare($sql))
216 {
217 $statement->bindValue(":$coulam1", $var1, PDO::PARAM_STR);
218 $statement->bindValue(":$coulam2", $var2, PDO::PARAM_STR);
219 $statement->bindValue(":$coulam3", $var3, PDO::PARAM_STR);
220 $statement->bindValue(":$coulam4", $var4, PDO::PARAM_STR);
221 $statement->bindValue(":$coulam5", $var5, PDO::PARAM_STR);
222 $statement->bindValue(":id", $id, PDO::PARAM_INT);
223 if ($statement->execute())
224 {
225 echo $this->msg_up;
226 }
227 }
228 } catch (PDOException $exc) {
229 echo $exc->getMessage();
230 }
231 }
232
233 public function up_col_7($var1, $var2, $var3, $var4, $var5, $var6, $id)
234 {
235 try {
236 $cdn = $this->con_db();
237 $tablename = $this->tablename;
238 $select = $cdn->query('SELECT * FROM ' . $tablename);
239 $total_column = $select->columnCount();
240 for ($counter = 0; $counter <= $total_column; $counter ++)
241 {
242 $meta = $select->getColumnMeta($counter);
243 $column[] = $meta['name'];
244 }
245 $coulam = $column[0];
246
247 $coulam1 = $column[1];
248
249 $coulam2 = $column[2];
250
251 $coulam3 = $column[3];
252
253 $coulam4 = $column[4];
254
255 $coulam5 = $column[5];
256
257 $coulam6 = $column[6];
258
259
260//----------------------------------------------------------
261 $sql = "UPDATE `$tablename` SET `$coulam1` = :$coulam1, `$coulam2` = :$coulam2, `$coulam3` = :$coulam3, `$coulam4` = :$coulam4, `$coulam5` = :$coulam5 , `$coulam6` = :$coulam6 WHERE `id` = :id;";
262 $con = $this->con_db();
263 if ($statement = $con->prepare($sql))
264 {
265 $statement->bindValue(":$coulam1", $var1, PDO::PARAM_STR);
266 $statement->bindValue(":$coulam2", $var2, PDO::PARAM_STR);
267 $statement->bindValue(":$coulam3", $var3, PDO::PARAM_STR);
268 $statement->bindValue(":$coulam4", $var4, PDO::PARAM_STR);
269 $statement->bindValue(":$coulam5", $var5, PDO::PARAM_STR);
270 $statement->bindValue(":$coulam6", $var6, PDO::PARAM_STR);
271
272 $statement->bindValue(":id", $id, PDO::PARAM_INT);
273 if ($statement->execute())
274 {
275 echo $this->msg_up;
276 }
277 }
278 } catch (PDOException $exc) {
279 echo $exc->getMessage();
280 }
281 }
282
283 public function up_col_8($var1, $var2, $var3, $var4, $var5, $var6, $var7, $id)
284 {
285 try {
286 $cdn = $this->con_db();
287 $tablename = $this->tablename;
288 $select = $cdn->query('SELECT * FROM ' . $tablename);
289 $total_column = $select->columnCount();
290 for ($counter = 0; $counter <= $total_column; $counter ++)
291 {
292 $meta = $select->getColumnMeta($counter);
293 $column[] = $meta['name'];
294 }
295 $coulam = $column[0];
296 $coulam1 = $column[1];
297
298 $coulam2 = $column[2];
299
300 $coulam3 = $column[3];
301
302 $coulam4 = $column[4];
303
304
305 $coulam6 = $column[6];
306
307 $coulam7 = $column[7];
308
309//----------------------------------------------------------
310 $sql = "UPDATE `$tablename` SET `$coulam1` = :$coulam1, `$coulam2` = :$coulam2, `$coulam3` = :$coulam3, `$coulam4` = :$coulam4, `$coulam5` = :$coulam5 , `$coulam6` = :$coulam6, `$coulam7` = :$coulam7 WHERE `id` = :id;";
311 $con = $this->con_db();
312 if ($statement = $con->prepare($sql))
313 {
314 $statement->bindValue(":$coulam1", $var1, PDO::PARAM_STR);
315 $statement->bindValue(":$coulam2", $var2, PDO::PARAM_STR);
316 $statement->bindValue(":$coulam3", $var3, PDO::PARAM_STR);
317 $statement->bindValue(":$coulam4", $var4, PDO::PARAM_STR);
318 $statement->bindValue(":$coulam5", $var5, PDO::PARAM_STR);
319 $statement->bindValue(":$coulam6", $var6, PDO::PARAM_STR);
320 $statement->bindValue(":$coulam7", $var7, PDO::PARAM_STR);
321 $statement->bindValue(":id", $id, PDO::PARAM_INT);
322 if ($statement->execute())
323 {
324 echo $this->msg_up;
325 }
326 }
327 } catch (PDOException $exc) {
328 echo $exc->getMessage();
329 }
330 }
331
332 public function con_db()
333 {
334 try {
335 // jjjjj "mysql:host=$this->localhost;dbname=$this->db";
336 // "<br>" . $this->user, $this->pas + "<br>";
337 $cnn = new PDO("mysql:host=$this->localhost;dbname=$this->db;charset=utf8", $this->user, $this->pas);
338 $cnn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
339 $cnn->exec('SEt NAMES utf8');
340 "CONECT OK";
341 return $cnn;
342 } catch (PDOException $exc) {
343 echo 'NOT conected' . $exc->getMessage();
344 }
345 }
346
347 public function Malcom_xx_up($id)
348 {
349 $keys = array_keys($this->array);
350 $count = count($this->array);
351 if ($count == 2)
352 {
353 $valyes = array_values($this->array);
354 $val = $valyes[1];
355 try {
356 $cdn = $this->con_db();
357 $tablename = $this->tablename;
358 $select = $cdn->query('SELECT * FROM ' . $tablename);
359 $total_column = $select->columnCount();
360 for ($counter = 0; $counter <= $total_column; $counter ++)
361 {
362 $meta = $select->getColumnMeta($counter);
363 $column[] = $meta['name'];
364 }
365 $coulam = $column[0];
366
367 $coulam1 = $column[1];
368
369 //----------------------------------------------------------
370 $sql = "UPDATE `$tablename` SET `$coulam1` = :$coulam1 WHERE `id` = :id;";
371 $con = $this->con_db();
372 if ($statement = $con->prepare($sql))
373 {
374 $statement->bindValue(":$coulam1", $val, PDO::PARAM_STR);
375 $statement->bindValue(":id", $id, PDO::PARAM_INT);
376 if ($statement->execute())
377 {
378 echo $this->msg_up;
379 }
380 }
381 } catch (PDOException $exc) {
382 echo $exc->getMessage();
383 }
384 }
385 elseif ($count == 3)
386 {
387 $valyes = array_values($this->array);
388 $val = $valyes[0];
389 $val2 = $valyes[1];
390 $val3 = $valyes[2];
391
392 try {
393 $cdn = $this->con_db();
394 $tablename = $this->tablename;
395 $select = $cdn->query('SELECT * FROM ' . $tablename);
396 $total_column = $select->columnCount();
397 for ($counter = 0; $counter <= $total_column; $counter ++)
398 {
399 $meta = $select->getColumnMeta($counter);
400 $column[] = $meta['name'];
401 }
402 $coulam = $column[0];
403 $coulam1 = $column[1];
404
405 $coulam2 = $column[2];
406
407 //----------------------------------------------------------
408 $sql = "UPDATE `$tablename` SET `$coulam1` = :$coulam1, `$coulam2` = :$coulam2 WHERE `id` = :id;";
409 $con = $this->con_db();
410 if ($statement = $con->prepare($sql))
411 {
412 $statement->bindValue(":$coulam1", $val2, PDO::PARAM_STR);
413 $statement->bindValue(":$coulam2", $val3, PDO::PARAM_STR);
414 $statement->bindValue(":id", $id, PDO::PARAM_INT);
415 if ($statement->execute())
416 {
417 echo $this->msg_up;
418 }
419 }
420 } catch (PDOException $exc) {
421 echo $exc->getMessage();
422 }
423 }
424 elseif ($count == 4)
425 {
426 $valyes = array_values($this->array);
427 $val = $valyes[0];
428 $val2 = $valyes[1];
429 $val3 = $valyes[2];
430 $val4 = $valyes[3];
431 try {
432 $cdn = $this->con_db();
433 $tablename = $this->tablename;
434 $select = $cdn->query('SELECT * FROM ' . $tablename);
435 $total_column = $select->columnCount();
436 for ($counter = 0; $counter <= $total_column; $counter ++)
437 {
438 $meta = $select->getColumnMeta($counter);
439 $column[] = $meta['name'];
440 }
441 $coulam = $column[0];
442 $coulam1 = $column[1];
443
444 $coulam2 = $column[2];
445
446 $coulam3 = $column[3];
447
448 //----------------------------------------------------------
449 $sql = "UPDATE `$tablename` SET `$coulam1` = :$coulam1, `$coulam2` = :$coulam2, `$coulam3` = :$coulam3 WHERE `id` = :id;";
450 $con = $this->con_db();
451 if ($statement = $con->prepare($sql))
452 {
453 $statement->bindValue(":$coulam1", $val2, PDO::PARAM_STR);
454 $statement->bindValue(":$coulam2", $val3, PDO::PARAM_STR);
455 $statement->bindValue(":$coulam3", $val4, PDO::PARAM_STR);
456 $statement->bindValue(":id", $id, PDO::PARAM_INT);
457 if ($statement->execute())
458 {
459 echo $this->msg_up;
460 }
461 }
462 } catch (PDOException $exc) {
463 echo $exc->getMessage();
464 }
465 }
466 elseif ($count == 5)
467 {
468
469 try {
470 $cdn = $this->con_db();
471 $tablename = $this->tablename;
472 $select = $cdn->query('SELECT * FROM ' . $tablename);
473 $total_column = $select->columnCount();
474 for ($counter = 0; $counter <= $total_column; $counter ++)
475 {
476 $meta = $select->getColumnMeta($counter);
477 $column[] = $meta['name'];
478 }
479 $coulam = $column[0];
480
481 $coulam1 = $column[1];
482
483 $coulam2 = $column[2];
484
485 $coulam3 = $column[3];
486
487 $coulam4 = $column[4];
488
489 $valyes = array_values($this->array);
490 $val = $valyes[0];
491 $val2 = $valyes[1];
492 $val3 = $valyes[2];
493 $val4 = $valyes[3];
494 $val5 = $valyes[4];
495 //----------------------------------------------------------
496 $sql = "UPDATE `$tablename` SET `$coulam1` = :$coulam1, `$coulam2` = :$coulam2, `$coulam3` = :$coulam3, `$coulam4` = :$coulam4 WHERE `id` = :id;";
497 $con = $this->con_db();
498 if ($statement = $con->prepare($sql))
499 {
500 $statement->bindValue(":$coulam1", $val2, PDO::PARAM_STR);
501 $statement->bindValue(":$coulam2", $val3, PDO::PARAM_STR);
502 $statement->bindValue(":$coulam3", $val4, PDO::PARAM_STR);
503 $statement->bindValue(":$coulam4", $val5, PDO::PARAM_STR);
504 $statement->bindValue(":id", $id, PDO::PARAM_INT);
505 if ($statement->execute())
506 {
507 echo $this->msg_up;
508 }
509 }
510 } catch (PDOException $exc) {
511 echo $exc->getMessage();
512 }
513 }
514 elseif ($count == 6)
515 {
516
517 try {
518 $cdn = $this->con_db();
519 $tablename = $this->tablename;
520 $select = $cdn->query('SELECT * FROM ' . $tablename);
521 $total_column = $select->columnCount();
522 for ($counter = 0; $counter <= $total_column; $counter ++)
523 {
524 $meta = $select->getColumnMeta($counter);
525 $column[] = $meta['name'];
526 }
527 $coulam = $column[0];
528
529 $coulam1 = $column[1];
530
531 $coulam2 = $column[2];
532
533 $coulam3 = $column[3];
534
535 $coulam4 = $column[4];
536
537 $coulam5 = $column[5];
538
539 $valyes = array_values($this->array);
540 $val = $valyes[0];
541 $val2 = $valyes[1];
542 $val3 = $valyes[2];
543 $val4 = $valyes[3];
544 $val5 = $valyes[4];
545 $val6 = $valyes[5];
546 //----------------------------------------------------------
547 $sql = "UPDATE `$tablename` SET `$coulam1` = :$coulam1, `$coulam2` = :$coulam2, `$coulam3` = :$coulam3, `$coulam4` = :$coulam4, `$coulam5` = :$coulam5 WHERE `id` = :id;";
548 $con = $this->con_db();
549 if ($statement = $con->prepare($sql))
550 {
551 $statement->bindValue(":$coulam1", $val2, PDO::PARAM_STR);
552 $statement->bindValue(":$coulam2", $val3, PDO::PARAM_STR);
553 $statement->bindValue(":$coulam3", $val4, PDO::PARAM_STR);
554 $statement->bindValue(":$coulam4", $val5, PDO::PARAM_STR);
555 $statement->bindValue(":$coulam5", $val6, PDO::PARAM_STR);
556 $statement->bindValue(":id", $id, PDO::PARAM_INT);
557 if ($statement->execute())
558 {
559 echo $this->msg_up;
560 }
561 }
562 } catch (PDOException $exc) {
563 echo $exc->getMessage();
564 }
565 }
566 elseif ($count == 7)
567 {
568
569 try {
570 $cdn = $this->con_db();
571 $tablename = $this->tablename;
572 $select = $cdn->query('SELECT * FROM ' . $tablename);
573 $total_column = $select->columnCount();
574 for ($counter = 0; $counter <= $total_column; $counter ++)
575 {
576 $meta = $select->getColumnMeta($counter);
577 $column[] = $meta['name'];
578 }
579 $coulam = $column[0];
580
581 $coulam1 = $column[1];
582
583 $coulam2 = $column[2];
584
585 $coulam3 = $column[3];
586
587 $coulam4 = $column[4];
588
589 $coulam5 = $column[5];
590
591 $coulam6 = $column[6];
592
593
594 //----------------------------------------------------------
595 $valyes = array_values($this->array);
596 $val = $valyes[0];
597 $val2 = $valyes[1];
598 $val3 = $valyes[2];
599 $val4 = $valyes[3];
600 $val5 = $valyes[4];
601 $val6 = $valyes[5];
602 $val7 = $valyes[6];
603 $sql = "UPDATE `$tablename` SET `$coulam1` = :$coulam1, `$coulam2` = :$coulam2, `$coulam3` = :$coulam3, `$coulam4` = :$coulam4, `$coulam5` = :$coulam5 , `$coulam6` = :$coulam6 WHERE `id` = :id;";
604 $con = $this->con_db();
605 if ($statement = $con->prepare($sql))
606 {
607 $statement->bindValue(":$coulam1", $val2, PDO::PARAM_STR);
608 $statement->bindValue(":$coulam2", $val3, PDO::PARAM_STR);
609 $statement->bindValue(":$coulam3", $val4, PDO::PARAM_STR);
610 $statement->bindValue(":$coulam4", $val5, PDO::PARAM_STR);
611 $statement->bindValue(":$coulam5", $val6, PDO::PARAM_STR);
612 $statement->bindValue(":$coulam6", $val7, PDO::PARAM_STR);
613 $statement->bindValue(":id", $id, PDO::PARAM_INT);
614 if ($statement->execute())
615 {
616 echo $this->msg_up;
617 }
618 }
619 } catch (PDOException $exc) {
620 echo $exc->getMessage();
621 }
622 }
623 elseif ($count == 8)
624 {
625
626 try {
627 $cdn = $this->con_db();
628 $tablename = $this->tablename;
629 $select = $cdn->query('SELECT * FROM ' . $tablename);
630 $total_column = $select->columnCount();
631 for ($counter = 0; $counter <= $total_column; $counter ++)
632 {
633 $meta = $select->getColumnMeta($counter);
634 $column[] = $meta['name'];
635 }
636 $coulam = $column[0];
637
638 $coulam1 = $column[1];
639
640 $coulam2 = $column[2];
641
642 $coulam3 = $column[3];
643
644 $coulam4 = $column[4];
645
646 $coulam5 = $column[5];
647
648 $coulam6 = $column[6];
649
650 $coulam7 = $column[7];
651
652 $val = $valyes[0];
653 $val2 = $valyes[1];
654 $val3 = $valyes[2];
655 $val4 = $valyes[3];
656 $val5 = $valyes[4];
657 $val6 = $valyes[5];
658 $val7 = $valyes[6];
659 $val8 = $valyes[7];
660 //----------------------------------------------------------
661 $sql = "UPDATE `$tablename` SET `$coulam1` = :$coulam1, `$coulam2` = :$coulam2, `$coulam3` = :$coulam3, `$coulam4` = :$coulam4, `$coulam5` = :$coulam5 , `$coulam6` = :$coulam6, `$coulam7` = :$coulam7 WHERE `id` = :id;";
662 $con = $this->con_db();
663 if ($statement = $con->prepare($sql))
664 {
665 $statement->bindValue(":$coulam1", $val2, PDO::PARAM_STR);
666 $statement->bindValue(":$coulam2", $val3, PDO::PARAM_STR);
667 $statement->bindValue(":$coulam3", $val4, PDO::PARAM_STR);
668 $statement->bindValue(":$coulam4", $val5, PDO::PARAM_STR);
669 $statement->bindValue(":$coulam5", $val6, PDO::PARAM_STR);
670 $statement->bindValue(":$coulam6", $val7, PDO::PARAM_STR);
671 $statement->bindValue(":$coulam7", $val8, PDO::PARAM_STR);
672 $statement->bindValue(":id", $id, PDO::PARAM_INT);
673 if ($statement->execute())
674 {
675 echo $this->msg_up;
676 }
677 }
678 } catch (PDOException $exc) {
679 echo $exc->getMessage();
680 }
681 }
682 elseif ($count == 9)
683 {
684
685 try {
686 $cdn = $this->con_db();
687 $tablename = $this->tablename;
688 $select = $cdn->query('SELECT * FROM ' . $tablename);
689 $total_column = $select->columnCount();
690 for ($counter = 0; $counter <= $total_column; $counter ++)
691 {
692 $meta = $select->getColumnMeta($counter);
693 $column[] = $meta['name'];
694 }
695 $coulam = $column[0];
696
697 $coulam1 = $column[1];
698
699 $coulam2 = $column[2];
700
701 $coulam3 = $column[3];
702
703 $coulam4 = $column[4];
704
705 $coulam5 = $column[5];
706
707 $coulam6 = $column[6];
708
709 $coulam7 = $column[7];
710
711 $coulam8 = $column[8];
712
713 //----------------------------------------------------------
714 $valyes = array_values($this->array);
715 $val = $valyes[0];
716 $val2 = $valyes[1];
717 $val3 = $valyes[2];
718 $val4 = $valyes[3];
719 $val5 = $valyes[4];
720 $val6 = $valyes[5];
721 $val7 = $valyes[6];
722 $val8 = $valyes[7];
723 $val9 = $valyes[8];
724
725 $sql = "UPDATE `$tablename` SET `$coulam1` = :$coulam1, `$coulam2` = :$coulam2, `$coulam3` = :$coulam3, `$coulam4` = :$coulam4, `$coulam5` = :$coulam5 , `$coulam6` = :$coulam6, `$coulam7` = :$coulam7, `$coulam8` = :$coulam8 WHERE `id` = :id;";
726 $con = $this->con_db();
727 if ($statement = $con->prepare($sql))
728 {
729 $statement->bindValue(":$coulam1", $val2, PDO::PARAM_STR);
730 $statement->bindValue(":$coulam2", $val3, PDO::PARAM_STR);
731 $statement->bindValue(":$coulam3", $val4, PDO::PARAM_STR);
732 $statement->bindValue(":$coulam4", $val5, PDO::PARAM_STR);
733 $statement->bindValue(":$coulam5", $val6, PDO::PARAM_STR);
734 $statement->bindValue(":$coulam6", $val7, PDO::PARAM_STR);
735 $statement->bindValue(":$coulam7", $val8, PDO::PARAM_STR);
736 $statement->bindValue(":$coulam8", $val9, PDO::PARAM_STR);
737 $statement->bindValue(":id", $id, PDO::PARAM_INT);
738 if ($statement->execute())
739 {
740 echo $this->msg_up;
741 }
742 }
743 } catch (PDOException $exc) {
744 echo $exc->getMessage();
745 }
746 }
747
748 //----------------------------------------------------------
749 }
750
751 public function Malcom_xx_ins()
752 {
753 $keys = array_keys($this->array);
754
755
756 $count = count($this->array);
757 $count;
758
759
760 if ($count == 1)
761 {
762 $string = array_values($this->array);
763
764 $string[0];
765
766 $cdn = $this->con_db();
767 $tablename = $this->tablename;
768 $select = $cdn->query('SELECT * FROM ' . $tablename);
769 $total_column = $select->columnCount();
770 for ($counter = 0; $counter <= $total_column; $counter ++)
771 {
772 $meta = $select->getColumnMeta($counter);
773 $column[] = $meta['name'];
774 }
775 $coulam = $column[0];
776
777 $coulam1 = $column[1];
778
779 try {
780 $val = $string[0];
781 $string_SQL = "INSERT INTO `$tablename` ($coulam1 ) VALUES (?);";
782 $sth = $cdn->prepare($string_SQL);
783 $sth->bindParam(1, $val, PDO::PARAM_STR);
784 if ($sth->execute())
785 {
786 echo $this->msg_ins;
787 }
788 else
789 {
790 echo "Input failure to the database";
791 }
792 } catch (PDOException $ex) {
793 $ex->getMessage() . "err";
794 }
795 $cdn = NULL;
796 }
797 elseif ($count == 2)
798 {
799 $string = array_values($this->array);
800 $val = $string[0];
801 $val2 = $string[1];
802 //كده Ø§Ù„Ø¨ØØ« عن عمودين
803 $cdn = $this->con_db();
804 $tablename = $this->tablename;
805 $select = $cdn->query('SELECT * FROM ' . $tablename);
806 $total_column = $select->columnCount();
807 for ($counter = 0; $counter <= $total_column; $counter ++)
808 {
809 $meta = $select->getColumnMeta($counter);
810 $column[] = $meta['name'];
811 }
812 $coulam = $column[0];
813
814 $coulam1 = $column[1];
815
816 $coulam2 = $column[2];
817
818
819 //----------------------------------------------------------
820
821 try {
822 $string_SQL = "INSERT INTO `$tablename` ($coulam1 ,$coulam2) VALUES (?, ?);";
823
824 $sth = $cdn->prepare($string_SQL);
825 $sth->bindParam(1, $val, PDO::PARAM_STR);
826 $sth->bindParam(2, $val2, PDO::PARAM_STR);
827 if ($sth->execute())
828 {
829 echo $this->msg_ins;
830 }
831 else
832 {
833 echo "Input failure to the database";
834 }
835 } catch (PDOException $ex) {
836 $ex->getMessage() . "err";
837 }
838 $cdn = NULL;
839 }
840 elseif ($count == 3)
841 {
842 $valyes = array_values($this->array);
843 $val = $valyes[0];
844 $val2 = $valyes[1];
845 $val3 = $valyes[2];
846
847 $cdn = $this->con_db();
848 $tablename = $this->tablename;
849 $select = $cdn->query('SELECT * FROM ' . $tablename);
850 $total_column = $select->columnCount();
851 for ($counter = 0; $counter <= $total_column; $counter ++)
852 {
853 $meta = $select->getColumnMeta($counter);
854 $column[] = $meta['name'];
855 }
856 $coulam = $column[0];
857
858 $coulam1 = $column[1];
859
860 $coulam2 = $column[2];
861
862 $coulam3 = $column[3];
863
864
865 //----------------------------------------------------------
866
867 try {
868 $string_SQL = "INSERT INTO `$tablename` ($coulam1 ,$coulam2,$coulam3) VALUES (?, ?, ?);";
869 $sth = $cdn->prepare($string_SQL);
870 $sth->bindParam(1, $val, PDO::PARAM_STR);
871 $sth->bindParam(2, $val2, PDO::PARAM_STR);
872 $sth->bindParam(3, $val3, PDO::PARAM_STR);
873 if ($sth->execute())
874 {
875 echo $this->msg_ins;
876 }
877 } catch (PDOException $ex) {
878 $ex->getMessage() . "err";
879 }
880 //كده Ø§Ù„Ø¨ØØ« عن ثلاثة اعمدة
881 }
882 elseif
883 ($count == 4)
884 {
885 $count;
886 $valyes = array_values($this->array);
887 $val = $valyes[0];
888 $val2 = $valyes[1];
889 $val3 = $valyes[2];
890 $val4 = $valyes[3];
891 $cdn = $this->con_db();
892 $tablename = $this->tablename;
893 $select = $cdn->query('SELECT * FROM ' . $tablename);
894 $total_column = $select->columnCount();
895 for ($counter = 0; $counter <= $total_column; $counter ++)
896 {
897 $meta = $select->getColumnMeta($counter);
898 $column[] = $meta['name'];
899 }
900 $coulam = $column[0];
901
902 $coulam1 = $column[1];
903
904 $coulam2 = $column[2];
905
906 $coulam3 = $column[3];
907
908 $coulam4 = $column[4];
909
910
911 //----------------------------------------------------------
912
913 try {
914 $string_SQL = "INSERT INTO `$tablename` ($coulam1 ,$coulam2,$coulam3,$coulam4) VALUES (?, ?, ?, ?);";
915 $sth = $cdn->prepare($string_SQL);
916 $sth->bindParam(1, $val, PDO::PARAM_STR);
917 $sth->bindParam(2, $val2, PDO::PARAM_STR);
918 $sth->bindParam(3, $val3, PDO::PARAM_STR);
919 $sth->bindParam(4, $val4, PDO::PARAM_STR);
920 if ($sth->execute())
921 {
922 echo $this->msg_ins;
923 }
924 } catch (PDOException $ex) {
925 $ex->getMessage() . "err";
926 }
927 //كده Ø§Ù„Ø¨ØØ« عن اربع اعمدة
928 }
929 elseif ($count == 5)
930 {
931
932 //كده Ø§Ù„Ø¨ØØ« عن خمس اعمدة
933 $cdn = $this->con_db();
934 $tablename = $this->tablename;
935 $select = $cdn->query('SELECT * FROM ' . $tablename);
936 $total_column = $select->columnCount();
937 for ($counter = 0; $counter <= $total_column; $counter ++)
938 {
939 $meta = $select->getColumnMeta($counter);
940 $column[] = $meta['name'];
941 }
942 $coulam = $column[0];
943
944 $coulam1 = $column[1];
945
946 $coulam2 = $column[2];
947
948 $coulam3 = $column[3];
949 $coulam4 = $column[4];
950 $coulam5 = $column[5];
951
952
953 //----------------------------------------------------------
954 $valyes = array_values($this->array);
955 $val = $valyes[0];
956 $val2 = $valyes[1];
957 $val3 = $valyes[2];
958 $val4 = $valyes[3];
959 $val5 = $valyes[4];
960 try {
961 $string_SQL = "INSERT INTO `$tablename` ($coulam1 ,$coulam2,$coulam3,$coulam4,$coulam5) VALUES (?, ?, ?, ?, ?)";
962 $sth = $cdn->prepare($string_SQL);
963 $sth->bindParam(1, $val, PDO::PARAM_STR);
964 $sth->bindParam(2, $val2, PDO::PARAM_STR);
965 $sth->bindParam(3, $val3, PDO::PARAM_STR);
966 $sth->bindParam(4, $val4, PDO::PARAM_STR);
967 $sth->bindParam(5, $val5, PDO::PARAM_STR);
968 if ($sth->execute())
969 {
970 echo "insert data";
971 }
972 } catch (PDOException $ex) {
973 echo $ex->getMessage() . "err";
974 }
975 }
976 elseif ($count == 6)
977 {
978 $valyes = array_values($this->array);
979 $val = $valyes[0];
980 $val2 = $valyes[1];
981 $val3 = $valyes[2];
982 $val4 = $valyes[3];
983 $val5 = $valyes[4];
984 $val6 = $valyes[5];
985 $cdn = $this->con_db();
986 $tablename = $this->tablename;
987 $select = $cdn->query('SELECT * FROM ' . $tablename);
988 $total_column = $select->columnCount();
989 for ($counter = 0; $counter <= $total_column; $counter ++)
990 {
991 $meta = $select->getColumnMeta($counter);
992 $column[] = $meta['name'];
993 }
994 $coulam = $column[0];
995
996 $coulam1 = $column[1];
997
998 $coulam2 = $column[2];
999
1000 $coulam3 = $column[3];
1001
1002 $coulam4 = $column[4];
1003
1004 $coulam5 = $column[5];
1005
1006 $coulam6 = $column[6];
1007
1008
1009 //----------------------------------------------------------
1010 $valyes = array_values($this->array);
1011 $val = $valyes[0];
1012 $val2 = $valyes[1];
1013 $val3 = $valyes[2];
1014 $val4 = $valyes[3];
1015 $val5 = $valyes[4];
1016 $val6 = $valyes[5];
1017 try {
1018 $string_SQL = "INSERT INTO `$tablename` ($coulam1 ,$coulam2,$coulam3,$coulam4,$coulam5,$coulam6) VALUES (?, ?, ?, ?, ?, ?);";
1019 $sth = $cdn->prepare($string_SQL);
1020 $sth->bindParam(1, $val, PDO::PARAM_STR);
1021 $sth->bindParam(2, $val2, PDO::PARAM_STR);
1022 $sth->bindParam(3, $val3, PDO::PARAM_STR);
1023 $sth->bindParam(4, $val4, PDO::PARAM_STR);
1024 $sth->bindParam(5, $val5, PDO::PARAM_STR);
1025 $sth->bindParam(6, $val6, PDO::PARAM_STR);
1026 if ($sth->execute())
1027 {
1028 $this->msg_ins;
1029 }
1030 } catch (PDOException $ex) {
1031 $ex->getMessage() . "err";
1032 }
1033 }
1034 elseif ($count == 7)
1035 {
1036
1037 $cdn = $this->con_db();
1038 $tablename = $this->tablename;
1039 $select = $cdn->query('SELECT * FROM ' . $tablename);
1040 $total_column = $select->columnCount();
1041 for ($counter = 0; $counter <= $total_column; $counter ++)
1042 {
1043 $meta = $select->getColumnMeta($counter);
1044 $column[] = $meta['name'];
1045 }
1046 $coulam = $column[0];
1047
1048 $coulam1 = $column[1];
1049
1050 $coulam2 = $column[2];
1051
1052 $coulam3 = $column[3];
1053
1054 $coulam4 = $column[4];
1055
1056 $coulam5 = $column[5];
1057
1058 $coulam6 = $column[6];
1059
1060 $coulam7 = $column[7];
1061
1062
1063
1064 $valyes = array_values($this->array);
1065 $val = $valyes[0];
1066 $val2 = $valyes[1];
1067 $val3 = $valyes[2];
1068 $val4 = $valyes[3];
1069 $val5 = $valyes[4];
1070 $val6 = $valyes[5];
1071 $val7 = $valyes[6];
1072 //----------------------------------------------------------
1073
1074 try {
1075 $string_SQL = "INSERT INTO `$tablename` ($coulam1 ,$coulam2,$coulam3,$coulam4,$coulam5,$coulam6,$coulam7) VALUES (?, ?, ?, ?, ?, ?, ?);";
1076 $sth = $cdn->prepare($string_SQL);
1077 $sth->bindParam(1, $val, PDO::PARAM_STR);
1078 $sth->bindParam(2, $val2, PDO::PARAM_STR);
1079 $sth->bindParam(3, $val3, PDO::PARAM_STR);
1080 $sth->bindParam(4, $val4, PDO::PARAM_STR);
1081 $sth->bindParam(5, $val5, PDO::PARAM_STR);
1082 $sth->bindParam(6, $val6, PDO::PARAM_STR);
1083 $sth->bindParam(7, $val7, PDO::PARAM_STR);
1084 if ($sth->execute())
1085 {
1086 echo $this->msg_ins;
1087 }
1088 } catch (PDOException $ex) {
1089 $ex->getMessage() . "err";
1090 }
1091 }
1092 elseif ($count == 8)
1093 {
1094
1095 $cdn = $this->con_db();
1096 $tablename = $this->tablename;
1097 $select = $cdn->query('SELECT * FROM ' . $tablename);
1098 $total_column = $select->columnCount();
1099 for ($counter = 0; $counter <= $total_column; $counter ++)
1100 {
1101 $meta = $select->getColumnMeta($counter);
1102 $column[] = $meta['name'];
1103 }
1104 $coulam = $column[0];
1105
1106 $coulam1 = $column[1];
1107
1108 $coulam2 = $column[2];
1109
1110 $coulam3 = $column[3];
1111
1112 $coulam4 = $column[4];
1113
1114 $coulam5 = $column[5];
1115
1116 $coulam6 = $column[6];
1117
1118 $coulam7 = $column[7];
1119
1120 $coulam8 = $column[8];
1121
1122
1123 //----------------------------------------------------------
1124
1125 try {
1126 $valyes = array_values($this->array);
1127 $val = $valyes[0];
1128 $val2 = $valyes[1];
1129 $val3 = $valyes[2];
1130 $val4 = $valyes[3];
1131 $val5 = $valyes[4];
1132 $val6 = $valyes[5];
1133 $val7 = $valyes[6];
1134 $val8 = $valyes[7];
1135 $string_SQL = "INSERT INTO `$tablename` ($coulam1 ,$coulam2,$coulam3,$coulam4,$coulam5,$coulam6,$coulam7,$coulam8) VALUES (?, ?, ?, ?, ?, ?, ?, ?);";
1136 $sth = $cdn->prepare($string_SQL);
1137 $sth->bindParam(1, $val, PDO::PARAM_STR);
1138 $sth->bindParam(2, $val2, PDO::PARAM_STR);
1139 $sth->bindParam(3, $val3, PDO::PARAM_STR);
1140 $sth->bindParam(4, $val4, PDO::PARAM_STR);
1141 $sth->bindParam(5, $val5, PDO::PARAM_STR);
1142 $sth->bindParam(6, $val6, PDO::PARAM_STR);
1143 $sth->bindParam(7, $val7, PDO::PARAM_STR);
1144 $sth->bindParam(8, $val8, PDO::PARAM_STR);
1145 if ($sth->execute())
1146 {
1147 echo $this->msg_ins;
1148 }
1149 } catch (PDOException $ex) {
1150 $ex->getMessage() . "err";
1151 }
1152 }
1153 }
1154 public function rows_Duplicate($Query)
1155 {
1156 // $Query = "select * from positive where positive = 'col1' and Address = 'col2'";
1157 $sql_con = $this->con_db();
1158 // echo $Query;
1159 $queryResult = $sql_con->query($Query);
1160 $foundRows = $queryResult->rowCount();
1161 if ($foundRows >= 1)
1162 {
1163
1164 }
1165 else
1166 {
1167 $this->Malcom_xx_ins();
1168 }
1169 }
1170 function DuplicateMySQLRecord($table, $id_field, $id)
1171 {
1172 $sql_con = $this->con_db();
1173 $result = $sql_con->query("SELECT * FROM " . $table . "
1174 WHERE " . $id_field . " = '" . $id . "' LIMIT 1");
1175 $row = $result[0];
1176 }
1177 public function count_rows($Query)
1178 {
1179 $dbh = $this->con_db();
1180 $sql = $Query;
1181
1182 $stmt = $dbh->prepare($sql);
1183 try {
1184 $stmt->execute();
1185 } catch (PDOException $e) {
1186 echo $e->getMessage();
1187 }
1188
1189 return $stmt->rowCount();
1190 }
1191 public function count_rows_cond($Query, $array)
1192 {
1193 $dbh = $this->con_db();
1194 $sql = $Query;
1195
1196 $stmt = $dbh->prepare($sql);
1197 try {
1198 $stmt->execute($array);
1199 } catch (PDOException $e) {
1200 echo $e->getMessage();
1201 }
1202
1203 return $stmt->rowCount();
1204 }
1205 public function Field_Protection($data)
1206 {
1207 $data = trim($data);
1208 $data = stripslashes($data);
1209 $data = htmlspecialchars($data);
1210 return $data;
1211 }
1212 public function General_extraction($Query)
1213 {
1214 $con = new PDO("mysql:host=$this->localhost;dbname=$this->db", "$this->user", $this->pas);
1215 $con->query("SET NAMES utf8");
1216 $sth = $con->prepare($Query);
1217 $sth->execute();
1218 return $result = $sth->fetchAll();
1219 }
1220 public function General_extraction_Row($Query)
1221 {
1222 $con = new PDO("mysql:host=$this->localhost;dbname=$this->db", "$this->user", $this->pas);
1223 $con->query("SET NAMES utf8");
1224 $sth = $con->prepare($Query);
1225 $sth->execute();
1226 return $result = $sth->fetch();
1227 }
1228 public function General_extraction_ADV($Query, $array)
1229 {
1230 /*
1231 * وضع الأستعلام ÙÙŠ مصÙÙˆÙØ©
1232 */
1233 $arr = array($Query);
1234 /*
1235 * الخطو الثانية ايجاد عدد مرات الأستبدال
1236 */
1237 str_ireplace("?", "?", $arr, $i);
1238 $i;
1239 /*
1240 * الأتصال بقاعدة البيانات
1241 */
1242 $con = new PDO("mysql:host=$this->localhost;dbname=$this->db", $this->user, $this->pas);
1243 /*
1244 *
1245 */
1246 /*
1247 * وضع شرط لعدد مرات الأستبدال
1248 */
1249 if ($i = 1)
1250 {
1251 try {
1252 $valyes = array_values($array);
1253
1254 $val = $valyes[0];
1255 $val2 = $valyes[1];
1256 $sth = $con->prepare($Query);
1257 $sth->bindParam(1, $val, PDO::PARAM_STR);
1258 $sth->bindParam(2, $val2, PDO::PARAM_STR);
1259 $sth->execute();
1260 return $result = $sth->fetchAll();
1261 } catch (PDOException $exc) {
1262 echo $exc->getMessage();
1263 }
1264 }
1265 elseif ($i = 2)
1266 {
1267 try {
1268 $valyes = array_values($array);
1269 print_r($valyes);
1270 $val = $valyes[0];
1271 $val2 = $valyes[1];
1272 $sth = $con->prepare($Query);
1273 $sth->bindParam(1, $val, PDO::PARAM_STR);
1274 $sth->bindParam(2, $val2, PDO::PARAM_STR);
1275 $sth->execute();
1276 return $result = $sth->fetchAll();
1277 } catch (PDOException $exc) {
1278 echo $exc->getMessage();
1279 }
1280 }
1281 elseif ($i = 3)
1282 {
1283 try {
1284 $valyes = array_values($array);
1285 $val = $valyes[0];
1286 $val2 = $valyes[1];
1287 $val3 = $valyes[2];
1288 $sth = $con->prepare($Query);
1289 $sth->bindParam(1, $val, PDO::PARAM_STR);
1290 $sth->bindParam(2, $val2, PDO::PARAM_STR);
1291 $sth->bindParam(3, $val3, PDO::PARAM_STR);
1292 $sth->execute();
1293 return $result = $sth->fetchAll();
1294 } catch (PDOException $exc) {
1295 echo $exc->getMessage();
1296 }
1297 }
1298 elseif ($i = 4)
1299 {
1300 try {
1301 $valyes = array_values($array);
1302 $val = $valyes[0];
1303 $val2 = $valyes[1];
1304 $val3 = $valyes[2];
1305 $val4 = $valyes[3];
1306 $sth = $con->prepare($Query);
1307 $sth->bindParam(1, $val, PDO::PARAM_STR);
1308 $sth->bindParam(2, $val2, PDO::PARAM_STR);
1309 $sth->bindParam(3, $val3, PDO::PARAM_STR);
1310 $sth->bindParam(4, $val4, PDO::PARAM_STR);
1311 $sth->execute();
1312 return $result = $sth->fetchAll();
1313 } catch (PDOException $exc) {
1314 echo $exc->getMessage();
1315 }
1316 }
1317 elseif ($i = 5)
1318 {
1319 try {
1320 $valyes = array_values($array);
1321 $val = $valyes[0];
1322 $val2 = $valyes[1];
1323 $val3 = $valyes[2];
1324 $val4 = $valyes[3];
1325 $val5 = $valyes[4];
1326 $sth = $con->prepare($Query);
1327 $sth->bindParam(1, $val, PDO::PARAM_STR);
1328 $sth->bindParam(2, $val2, PDO::PARAM_STR);
1329 $sth->bindParam(3, $val3, PDO::PARAM_STR);
1330 $sth->bindParam(4, $val4, PDO::PARAM_STR);
1331 $sth->bindParam(5, $val5, PDO::PARAM_STR);
1332 $sth->execute();
1333 return $result = $sth->fetchAll();
1334 } catch (PDOException $exc) {
1335 echo $exc->getMessage();
1336 }
1337 }
1338 elseif ($i = 6)
1339 {
1340 try {
1341 $valyes = array_values($array);
1342 $val = $valyes[0];
1343 $val2 = $valyes[1];
1344 $val3 = $valyes[2];
1345 $val4 = $valyes[3];
1346 $val5 = $valyes[4];
1347 $val6 = $valyes[6];
1348 $sth = $con->prepare($Query);
1349 $sth->bindParam(1, $val, PDO::PARAM_STR);
1350 $sth->bindParam(2, $val2, PDO::PARAM_STR);
1351 $sth->bindParam(3, $val3, PDO::PARAM_STR);
1352 $sth->bindParam(4, $val4, PDO::PARAM_STR);
1353 $sth->bindParam(5, $val5, PDO::PARAM_STR);
1354 $sth->bindParam(5, $val6, PDO::PARAM_STR);
1355 $sth->execute();
1356 return $result = $sth->fetchAll();
1357 } catch (PDOException $exc) {
1358 echo $exc->getMessage();
1359 }
1360 }
1361 }
1362 public function strlen($val, $lenth)
1363 {
1364 $this->Field_Protection($val);
1365 if (strlen($this->$val) < $lenth)
1366 {
1367 return $ok = FALSE;
1368 }
1369 else
1370 {
1371 return $ok = TRUE;
1372 }
1373 }
1374 public function emp($val)
1375 {
1376 $this->Field_Protection($val);
1377 if (empty($this->Field_Protection($val)))
1378 {
1379 return 1;
1380 }
1381 else
1382 {
1383 return 2;
1384 }
1385 }
1386 public function validateEmail($email, $inp_nam)
1387 {
1388 $this->Field_Protection($email);
1389 if (!filter_input(INPUT_POST, $inp_nam, FILTER_VALIDATE_EMAIL))
1390 {
1391 return $ok = FALSE;
1392 }
1393 else
1394 {
1395 return $ok = TRUE;
1396 }
1397 }
1398 public function validate_url($url, $inp_nam)
1399 {
1400 $this->Field_Protection($url);
1401 if (!filter_input(INPUT_POST, $inp_nam, FILTER_VALIDATE_URL))
1402 {
1403 return $ok = 1;
1404 }
1405 else
1406 {
1407 return $ok = 2;
1408 }
1409 }
1410 public function PAS_INT($PAS, $msg, $inp_nam)
1411 {
1412 $this->Field_Protection($PAS);
1413 if (!filter_input(INPUT_POST, $inp_nam, FILTER_VALIDATE_INT))
1414 {
1415
1416 return $ok = FALSE;
1417 }
1418 else
1419 {
1420 return $ok = TRUE;
1421 }
1422 }
1423 public function isValidEmail($email)
1424 {
1425 $this->Field_Protection($email);
1426 $pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$";
1427
1428 if (eregi($pattern, $email))
1429 {
1430 return $ok = TRUE;
1431 }
1432 else
1433 {
1434
1435 return $ok = FALSE;
1436 }
1437 }
1438 public function PAS_Match($val1, $val2, $true, $false)
1439 {
1440 $this->Field_Protection($val1);
1441 $this->Field_Protection($val2);
1442
1443 if ($val1 == $val2)
1444 {
1445 return $ok = TRUE;
1446 }
1447 else
1448 {
1449 return $ok = FALSE;
1450 }
1451 }
1452 public function opt_email($email, $true, $false, $opt)
1453 {
1454 $this->Field_Protection($email);
1455 if ($opt = 1)
1456 {
1457 $val = strtolower($email);
1458 $text1 = "@yahoo.com";
1459 if (stristr($text, $val))
1460 {
1461 return $ok = TRUE;
1462 }
1463 else
1464 {
1465 return $ok = FALSE;
1466 }
1467 }
1468 elseif ($opt = 2)
1469 {
1470 if ($opt = 1)
1471 {
1472 $val = strtolower($email);
1473 $text1 = "@gmail.com";
1474 if (stristr($text, $val))
1475 {
1476 return $ok = TRUE;
1477 }
1478 else
1479 {
1480 return $ok = FALSE;
1481 }
1482 }
1483 }
1484 }
1485 public function serch_db_col_BAC($keyword, $col)
1486 {
1487 try {
1488 $cdn = $this->con_db();
1489 $tablename = $this->tablename;
1490 $sql = "SELECT * FROM `$this->tablename` WHERE `$col` LIKE ? ;";
1491 $sth = $cdn->prepare($sql);
1492 $sth->bindValue(1, '%' . $keyword . '%', PDO::PARAM_STR);
1493 $sth->execute();
1494 return $result = $sth->fetchAll();
1495 } catch (PDOException $exc) {
1496 echo $exc->getMessage();
1497 }
1498 }
1499 public function serch_db_col1($keyword)
1500 {
1501 try {
1502 $cdn = $this->con_db();
1503 $tablename = $this->tablename;
1504 $select = $cdn->query('SELECT * FROM ' . $tablename);
1505 $total_column = $select->columnCount();
1506 for ($counter = 0; $counter <= $total_column; $counter ++)
1507 {
1508 $meta = $select->getColumnMeta($counter);
1509 $column[] = $meta['name'];
1510 }
1511 $coulam = $column[0];
1512 $coulam1 = $column[1];
1513 $sql = "SELECT * FROM `$this->tablename` WHERE `$coulam1` LIKE ? ;";
1514 $sth = $cdn->prepare($sql);
1515 $sth->bindValue(1, '%' . $keyword . '%', PDO::PARAM_STR);
1516 $sth->execute();
1517 return $result = $sth->fetchAll();
1518 } catch (PDOException $exc) {
1519 echo $exc->getMessage();
1520 }
1521 }
1522 public function serch_db_col2($keyword)
1523 {
1524 try {
1525 $cdn = $this->con_db();
1526 $tablename = $this->tablename;
1527 $select = $cdn->query('SELECT * FROM ' . $tablename);
1528 $total_column = $select->columnCount();
1529 for ($counter = 0; $counter <= $total_column; $counter ++)
1530 {
1531 $meta = $select->getColumnMeta($counter);
1532 $column[] = $meta['name'];
1533 }
1534 $coulam = $column[0];
1535
1536 $coulam1 = $column[1];
1537 $coulam2 = $column[2];
1538
1539
1540 $sql = "SELECT * FROM `$this->tablename` WHERE `$coulam1` LIKE ? UNION "
1541 . "SELECT * FROM `$this->tablename` WHERE `$coulam2` LIKE ?;";
1542 $sth = $cdn->prepare($sql);
1543 $sth->bindValue(1, '%' . $keyword . '%', PDO::PARAM_STR);
1544 $sth->bindValue(2, '%' . $keyword . '%', PDO::PARAM_STR);
1545 $sth->execute();
1546 return $result = $sth->fetchAll();
1547 } catch (PDOException $exc) {
1548 echo $exc->getMessage();
1549 }
1550 }
1551 public function serch_db_col3($keyword)
1552 {
1553 try {
1554 $cdn = $this->con_db();
1555 $tablename = $this->tablename;
1556 $select = $cdn->query('SELECT * FROM ' . $tablename);
1557 $total_column = $select->columnCount();
1558 for ($counter = 0; $counter <= $total_column; $counter ++)
1559 {
1560 $meta = $select->getColumnMeta($counter);
1561 $column[] = $meta['name'];
1562 }
1563 $coulam = $column[0];
1564
1565 $coulam1 = $column[1];
1566 $coulam2 = $column[2];
1567 $coulam3 = $column[3];
1568
1569
1570 $sql = "SELECT * FROM `$this->tablename` WHERE `$coulam1` LIKE ? UNION "
1571 . "SELECT * FROM `$this->tablename` WHERE `$coulam2` LIKE ?;"
1572 . "SELECT * FROM `$this->tablename` WHERE `$coulam3` LIKE ?";
1573 $sth = $cdn->prepare($sql);
1574 $sth->bindValue(1, '%' . $keyword . '%', PDO::PARAM_STR);
1575 $sth->bindValue(2, '%' . $keyword . '%', PDO::PARAM_STR);
1576 $sth->bindValue(3, '%' . $keyword . '%', PDO::PARAM_STR);
1577 $sth->execute();
1578 return $result = $sth->fetchAll();
1579 } catch (PDOException $exc) {
1580 echo $exc->getMessage();
1581 }
1582 }
1583 public function serch_db_col4($keyword)
1584 {
1585 try {
1586 $cdn = $this->con_db();
1587 $tablename = $this->tablename;
1588 $select = $cdn->query('SELECT * FROM ' . $tablename);
1589 $total_column = $select->columnCount();
1590 for ($counter = 0; $counter <= $total_column; $counter ++)
1591 {
1592 $meta = $select->getColumnMeta($counter);
1593 $column[] = $meta['name'];
1594 }
1595 $coulam = $column[0];
1596
1597 $coulam1 = $column[1];
1598 $coulam2 = $column[2];
1599 $coulam3 = $column[3];
1600 $coulam4 = $column[4];
1601
1602
1603 $sql = "SELECT * FROM `$this->tablename` WHERE `$coulam1` LIKE ? UNION "
1604 . "SELECT * FROM `$this->tablename` WHERE `$coulam2` LIKE ?;"
1605 . "SELECT * FROM `$this->tablename` WHERE `$coulam3` LIKE ?"
1606 . "SELECT * FROM `$this->tablename` WHERE `$coulam4` LIKE ?";
1607 $sth = $cdn->prepare($sql);
1608 $sth->bindValue(1, '%' . $keyword . '%', PDO::PARAM_STR);
1609 $sth->bindValue(2, '%' . $keyword . '%', PDO::PARAM_STR);
1610 $sth->bindValue(3, '%' . $keyword . '%', PDO::PARAM_STR);
1611 $sth->execute();
1612 return $result = $sth->fetchAll();
1613 } catch (PDOException $exc) {
1614 echo $exc->getMessage();
1615 }
1616 }
1617 public function serch_db_col5($keyword)
1618 {
1619 try {
1620 $cdn = $this->con_db();
1621 $tablename = $this->tablename;
1622 $select = $cdn->query('SELECT * FROM ' . $tablename);
1623 $total_column = $select->columnCount();
1624 for ($counter = 0; $counter <= $total_column; $counter ++)
1625 {
1626 $meta = $select->getColumnMeta($counter);
1627 $column[] = $meta['name'];
1628 }
1629 $coulam = $column[0];
1630
1631 $coulam1 = $column[1];
1632 $coulam2 = $column[2];
1633 $coulam3 = $column[3];
1634 $coulam4 = $column[4];
1635 $coulam5 = $column[5];
1636
1637
1638 $sql = "SELECT * FROM `$this->tablename` WHERE `$coulam1` LIKE ? UNION "
1639 . "SELECT * FROM `$this->tablename` WHERE `$coulam2` LIKE ?;"
1640 . "SELECT * FROM `$this->tablename` WHERE `$coulam3` LIKE ?"
1641 . "SELECT * FROM `$this->tablename` WHERE `$coulam4` LIKE ?"
1642 . "SELECT * FROM `$this->tablename` WHERE `$coulam5` LIKE ?";
1643 $sth = $cdn->prepare($sql);
1644 $sth->bindValue(1, '%' . $keyword . '%', PDO::PARAM_STR);
1645 $sth->bindValue(2, '%' . $keyword . '%', PDO::PARAM_STR);
1646 $sth->bindValue(3, '%' . $keyword . '%', PDO::PARAM_STR);
1647 $sth->bindValue(4, '%' . $keyword . '%', PDO::PARAM_STR);
1648 $sth->bindValue(5, '%' . $keyword . '%', PDO::PARAM_STR);
1649 $sth->execute();
1650 return $result = $sth->fetchAll();
1651 } catch (PDOException $exc) {
1652 echo $exc->getMessage();
1653 }
1654 }
1655 public function serch_db_col6($keyword)
1656 {
1657 try {
1658 $cdn = $this->con_db();
1659 $tablename = $this->tablename;
1660 $select = $cdn->query('SELECT * FROM ' . $tablename);
1661 $total_column = $select->columnCount();
1662 for ($counter = 0; $counter <= $total_column; $counter ++)
1663 {
1664 $meta = $select->getColumnMeta($counter);
1665 $column[] = $meta['name'];
1666 }
1667 $coulam = $column[0];
1668
1669 $coulam1 = $column[1];
1670 $coulam2 = $column[2];
1671 $coulam3 = $column[3];
1672 $coulam4 = $column[4];
1673 $coulam5 = $column[5];
1674 $coulam6 = $column[6];
1675
1676
1677 $sql = "SELECT * FROM `$this->tablename` WHERE `$coulam1` LIKE ? UNION "
1678 . "SELECT * FROM `$this->tablename` WHERE `$coulam2` LIKE ?;"
1679 . "SELECT * FROM `$this->tablename` WHERE `$coulam3` LIKE ?"
1680 . "SELECT * FROM `$this->tablename` WHERE `$coulam4` LIKE ?"
1681 . "SELECT * FROM `$this->tablename` WHERE `$coulam5` LIKE ?"
1682 . "SELECT * FROM `$this->tablename` WHERE `$coulam6` LIKE ?";
1683 $sth = $cdn->prepare($sql);
1684 $sth->bindValue(1, '%' . $keyword . '%', PDO::PARAM_STR);
1685 $sth->bindValue(2, '%' . $keyword . '%', PDO::PARAM_STR);
1686 $sth->bindValue(3, '%' . $keyword . '%', PDO::PARAM_STR);
1687 $sth->bindValue(4, '%' . $keyword . '%', PDO::PARAM_STR);
1688 $sth->bindValue(5, '%' . $keyword . '%', PDO::PARAM_STR);
1689 $sth->bindValue(6, '%' . $keyword . '%', PDO::PARAM_STR);
1690 $sth->execute();
1691 return $result = $sth->fetchAll();
1692 } catch (PDOException $exc) {
1693 echo $exc->getMessage();
1694 }
1695 }
1696 public function serch_db_col7($keyword)
1697 {
1698 try {
1699 $cdn = $this->con_db();
1700 $tablename = $this->tablename;
1701 $select = $cdn->query('SELECT * FROM ' . $tablename);
1702 $total_column = $select->columnCount();
1703 for ($counter = 0; $counter <= $total_column; $counter ++)
1704 {
1705 $meta = $select->getColumnMeta($counter);
1706 $column[] = $meta['name'];
1707 }
1708 $coulam = $column[0];
1709
1710 $coulam1 = $column[1];
1711 $coulam2 = $column[2];
1712 $coulam3 = $column[3];
1713 $coulam4 = $column[4];
1714 $coulam5 = $column[5];
1715 $coulam6 = $column[6];
1716 $coulam7 = $column[7];
1717
1718
1719 $sql = "SELECT * FROM `$this->tablename` WHERE `$coulam1` LIKE ? UNION "
1720 . "SELECT * FROM `$this->tablename` WHERE `$coulam2` LIKE ?;"
1721 . "SELECT * FROM `$this->tablename` WHERE `$coulam3` LIKE ?"
1722 . "SELECT * FROM `$this->tablename` WHERE `$coulam4` LIKE ?"
1723 . "SELECT * FROM `$this->tablename` WHERE `$coulam5` LIKE ?"
1724 . "SELECT * FROM `$this->tablename` WHERE `$coulam6` LIKE ?"
1725 . "SELECT * FROM `$this->tablename` WHERE `$coulam7` LIKE ?";
1726 $sth = $cdn->prepare($sql);
1727 $sth->bindValue(1, '%' . $keyword . '%', PDO::PARAM_STR);
1728 $sth->bindValue(2, '%' . $keyword . '%', PDO::PARAM_STR);
1729 $sth->bindValue(3, '%' . $keyword . '%', PDO::PARAM_STR);
1730 $sth->bindValue(4, '%' . $keyword . '%', PDO::PARAM_STR);
1731 $sth->bindValue(5, '%' . $keyword . '%', PDO::PARAM_STR);
1732 $sth->bindValue(6, '%' . $keyword . '%', PDO::PARAM_STR);
1733 $sth->bindValue(7, '%' . $keyword . '%', PDO::PARAM_STR);
1734 $sth->execute();
1735 return $result = $sth->fetchAll();
1736 } catch (PDOException $exc) {
1737 echo $exc->getMessage();
1738 }
1739 }
1740 public function del_row($id)
1741 {
1742 try {
1743 $con = $this->con_db();
1744 if ($query = $con->prepare("DELETE FROM $this->tablename WHERE id=?"))
1745 ;
1746 $query->bindValue(1, $id, PDO::PARAM_INT);
1747 if ($query->execute())
1748 {
1749 $this->msg_del;
1750 }
1751 } catch (PDOException $ex) {
1752 echo $ex;
1753 }
1754 }
1755 public function General_extraction_array($Query, $array)
1756 {
1757 $con = new PDO("mysql:host=$this->localhost;charset=utf8;dbname=$this->db", $this->user, $this->pas);
1758 try {
1759
1760 $sth = $con->prepare($Query);
1761 $sth->execute($array);
1762 return $result = $sth->fetchAll();
1763 } catch (PDOException $exc) {
1764 echo $exc->getMessage();
1765 }
1766 }
1767 function highlightWords($string, $word)
1768 {
1769
1770 $string = str_replace($word, "<span class='highlight'>" . $word . "</span>", $string);
1771 /* * * return the highlighted string ** */
1772 return $string;
1773 }
1774 function truncateTable($tabel)
1775 {
1776 try {
1777 // echo "TRUNCATE TABLE $this->tablename";
1778 // echo "Truncating..";
1779 $cdn = $this->con_db();
1780 $query = $cdn->exec("TRUNCATE TABLE $tabel");
1781 // echo "Truncated table $tblname!";
1782 } catch (PDOException $ex) {
1783 //echo $ex;
1784 }
1785 }
1786 public function ins_col_2($var1)
1787 {
1788 $cdn = $this->con_db();
1789 $tablename = $this->tablename;
1790 $select = $cdn->query('SELECT * FROM ' . $tablename);
1791 $total_column = $select->columnCount();
1792 for ($counter = 0; $counter <= $total_column; $counter ++)
1793 {
1794 $meta = $select->getColumnMeta($counter);
1795 $column[] = $meta['name'];
1796 }
1797 $coulam = $column[0];
1798 echo "<br>";
1799 $coulam1 = $column[1];
1800 "<br>";
1801
1802
1803//----------------------------------------------------------
1804
1805 try {
1806 echo $string_SQL = "INSERT INTO `$tablename` ($coulam1 ) VALUES (?);";
1807 $sth = $cdn->prepare($string_SQL);
1808 $sth->bindParam(1, $var1, PDO::PARAM_STR);
1809 if ($sth->execute())
1810 {
1811 echo $this->msg_ins;
1812 }
1813 else
1814 {
1815 echo "Input failure to the database";
1816 }
1817 } catch (PDOException $ex) {
1818 $ex->getMessage() . "err";
1819 }
1820 $cdn = NULL;
1821 }
1822 public function ins_col_3($var1, $var2)
1823 {
1824
1825 $cdn = $this->con_db();
1826 $tablename = $this->tablename;
1827 $select = $cdn->query('SELECT * FROM ' . $tablename);
1828 $total_column = $select->columnCount();
1829 for ($counter = 0; $counter <= $total_column; $counter ++)
1830 {
1831 $meta = $select->getColumnMeta($counter);
1832 $column[] = $meta['name'];
1833 }
1834 $coulam = $column[0];
1835 echo "<br>";
1836 $coulam1 = $column[1];
1837 "<br>";
1838 $coulam2 = $column[2];
1839 echo "<br>";
1840
1841//----------------------------------------------------------
1842
1843 try {
1844 echo $string_SQL = "INSERT INTO `$tablename` ($coulam1 ,$coulam2) VALUES (?, ?);";
1845
1846 $sth = $cdn->prepare($string_SQL);
1847 $sth->bindParam(1, $var1, PDO::PARAM_STR);
1848 $sth->bindParam(2, $var2, PDO::PARAM_STR);
1849 if ($sth->execute())
1850 {
1851 echo $this->msg_ins;
1852 }
1853 else
1854 {
1855 echo "Input failure to the database";
1856 }
1857 } catch (PDOException $ex) {
1858 $ex->getMessage() . "err";
1859 }
1860 $cdn = NULL;
1861 }
1862 public function ins_col_4($var1, $var2, $var3)
1863 {
1864
1865 $cdn = $this->con_db();
1866 $tablename = $this->tablename;
1867 $select = $cdn->query('SELECT * FROM ' . $tablename);
1868 $total_column = $select->columnCount();
1869 for ($counter = 0; $counter <= $total_column; $counter ++)
1870 {
1871 $meta = $select->getColumnMeta($counter);
1872 $column[] = $meta['name'];
1873 }
1874 $coulam = $column[0];
1875 echo "<br>";
1876 $coulam1 = $column[1];
1877 "<br>";
1878 $coulam2 = $column[2];
1879 echo "<br>";
1880 $coulam3 = $column[3];
1881 echo "<br>";
1882
1883//----------------------------------------------------------
1884
1885 try {
1886 echo $string_SQL = "INSERT INTO `$tablename` ($coulam1 ,$coulam2,$coulam3) VALUES (?, ?, ?);";
1887 $sth = $cdn->prepare($string_SQL);
1888 $sth->bindParam(1, $var1, PDO::PARAM_STR);
1889 $sth->bindParam(2, $var2, PDO::PARAM_STR);
1890 $sth->bindParam(3, $var3, PDO::PARAM_STR);
1891 if ($sth->execute())
1892 {
1893 echo $this->msg_ins;
1894 }
1895 } catch (PDOException $ex) {
1896 $ex->getMessage() . "err";
1897 }
1898 }
1899 public function ins_col_5($var1, $var2, $var3, $var4)
1900 {
1901
1902 $cdn = $this->con_db();
1903 $tablename = $this->tablename;
1904 $select = $cdn->query('SELECT * FROM ' . $tablename);
1905 $total_column = $select->columnCount();
1906 for ($counter = 0; $counter <= $total_column; $counter ++)
1907 {
1908 $meta = $select->getColumnMeta($counter);
1909 $column[] = $meta['name'];
1910 }
1911 $coulam = $column[0];
1912 echo "<br>";
1913 $coulam1 = $column[1];
1914 "<br>";
1915 $coulam2 = $column[2];
1916 echo "<br>";
1917 $coulam3 = $column[3];
1918 echo "<br>";
1919 $coulam4 = $column[4];
1920 echo "<br>";
1921
1922//----------------------------------------------------------
1923
1924 try {
1925 echo $string_SQL = "INSERT INTO `$tablename` ($coulam1 ,$coulam2,$coulam3,$coulam4) VALUES (?, ?, ?, ?);";
1926 $sth = $cdn->prepare($string_SQL);
1927 $sth->bindParam(1, $var1, PDO::PARAM_STR);
1928 $sth->bindParam(2, $var2, PDO::PARAM_STR);
1929 $sth->bindParam(3, $var3, PDO::PARAM_STR);
1930 $sth->bindParam(4, $var4, PDO::PARAM_STR);
1931 if ($sth->execute())
1932 {
1933 echo $this->msg_ins;
1934 }
1935 } catch (PDOException $ex) {
1936 $ex->getMessage() . "err";
1937 }
1938 }
1939 public function ins_col_6($var1, $var2, $var3, $var4, $var5)
1940 {
1941
1942 $cdn = $this->con_db();
1943 $tablename = $this->tablename;
1944 $select = $cdn->query('SELECT * FROM ' . $tablename);
1945 $total_column = $select->columnCount();
1946 for ($counter = 0; $counter <= $total_column; $counter ++)
1947 {
1948 $meta = $select->getColumnMeta($counter);
1949 $column[] = $meta['name'];
1950 }
1951 $coulam = $column[0];
1952 echo "<br>";
1953 $coulam1 = $column[1];
1954 "<br>";
1955 $coulam2 = $column[2];
1956 echo "<br>";
1957 $coulam3 = $column[3];
1958 echo "<br>";
1959 $coulam4 = $column[4];
1960 echo "<br>";
1961 $coulam5 = $column[5];
1962 echo "<br>";
1963
1964//----------------------------------------------------------
1965
1966 try {
1967 echo $string_SQL = "INSERT INTO `$tablename` ($coulam1 ,$coulam2,$coulam3,$coulam4,$coulam5) VALUES (?, ?, ?, ?, ?);";
1968 $sth = $cdn->prepare($string_SQL);
1969 $sth->bindParam(1, $var1, PDO::PARAM_STR);
1970 $sth->bindParam(2, $var2, PDO::PARAM_STR);
1971 $sth->bindParam(3, $var3, PDO::PARAM_STR);
1972 $sth->bindParam(4, $var4, PDO::PARAM_STR);
1973 $sth->bindParam(5, $var5, PDO::PARAM_STR);
1974 if ($sth->execute())
1975 {
1976 echo $this->msg_ins;
1977 }
1978 } catch (PDOException $ex) {
1979 echo $ex->getMessage() . "err";
1980 }
1981 }
1982 public function ins_col_7($var1, $var2, $var3, $var4, $var5, $var6)
1983 {
1984
1985 $cdn = $this->con_db();
1986 $tablename = $this->tablename;
1987 $select = $cdn->query('SELECT * FROM ' . $tablename);
1988 $total_column = $select->columnCount();
1989 for ($counter = 0; $counter <= $total_column; $counter ++)
1990 {
1991 $meta = $select->getColumnMeta($counter);
1992 $column[] = $meta['name'];
1993 }
1994 $coulam = $column[0];
1995 echo "<br>";
1996 $coulam1 = $column[1];
1997 "<br>";
1998 $coulam2 = $column[2];
1999 echo "<br>";
2000 $coulam3 = $column[3];
2001 echo "<br>";
2002 $coulam4 = $column[4];
2003 echo "<br>";
2004 $coulam5 = $column[5];
2005 echo "<br>";
2006 $coulam6 = $column[6];
2007 echo "<br>";
2008
2009//----------------------------------------------------------
2010
2011 try {
2012 echo $string_SQL = "INSERT INTO `$tablename` ($coulam1 ,$coulam2,$coulam3,$coulam4,$coulam5,$coulam6) VALUES (?, ?, ?, ?, ?, ?);";
2013 $sth = $cdn->prepare($string_SQL);
2014 $sth->bindParam(1, $var1, PDO::PARAM_STR);
2015 $sth->bindParam(2, $var2, PDO::PARAM_STR);
2016 $sth->bindParam(3, $var3, PDO::PARAM_STR);
2017 $sth->bindParam(4, $var4, PDO::PARAM_STR);
2018 $sth->bindParam(5, $var5, PDO::PARAM_STR);
2019 $sth->bindParam(6, $var6, PDO::PARAM_STR);
2020 if ($sth->execute())
2021 {
2022 echo "Has been added to the statement";
2023 }
2024 } catch (PDOException $ex) {
2025 $ex->getMessage() . "err";
2026 }
2027 }
2028
2029 public function ins_col_8($var1, $var2, $var3, $var4, $var5, $var6, $var7)
2030 {
2031
2032 $cdn = $this->con_db();
2033 $tablename = $this->tablename;
2034 $select = $cdn->query('SELECT * FROM ' . $tablename);
2035 $total_column = $select->columnCount();
2036 for ($counter = 0; $counter <= $total_column; $counter ++)
2037 {
2038 $meta = $select->getColumnMeta($counter);
2039 $column[] = $meta['name'];
2040 }
2041 $coulam = $column[0];
2042 echo "<br>";
2043 $coulam1 = $column[1];
2044 "<br>";
2045 $coulam2 = $column[2];
2046 echo "<br>";
2047 $coulam3 = $column[3];
2048 echo "<br>";
2049 $coulam4 = $column[4];
2050 echo "<br>";
2051 $coulam5 = $column[5];
2052 echo "<br>";
2053 $coulam6 = $column[6];
2054 echo "<br>";
2055 $coulam7 = $column[7];
2056 echo "<br>";
2057
2058 echo "<br>";
2059
2060//----------------------------------------------------------
2061
2062 try {
2063 echo $string_SQL = "INSERT INTO `$tablename` ($coulam1 ,$coulam2,$coulam3,$coulam4,$coulam5,$coulam6,$coulam7) VALUES (?, ?, ?, ?, ?, ?, ?);";
2064 $sth = $cdn->prepare($string_SQL);
2065 $sth->bindParam(1, $var1, PDO::PARAM_STR);
2066 $sth->bindParam(2, $var2, PDO::PARAM_STR);
2067 $sth->bindParam(3, $var3, PDO::PARAM_STR);
2068 $sth->bindParam(4, $var4, PDO::PARAM_STR);
2069 $sth->bindParam(5, $var5, PDO::PARAM_STR);
2070 $sth->bindParam(6, $var6, PDO::PARAM_STR);
2071 $sth->bindParam(7, $var6, PDO::PARAM_STR);
2072 if ($sth->execute())
2073 {
2074 echo $this->msg_ins;
2075 }
2076 } catch (PDOException $ex) {
2077 $ex->getMessage() . "err";
2078 }
2079 }
2080
2081 public function db_rows($coulam, $input)
2082 {
2083 try {
2084 $cdn = $this->con_db();
2085 $tablename = $this->tablename;
2086 $stmt = $cdn->prepare("SELECT count(*) from $tablename WHERE $coulam = :steam_id");
2087 $stmt->bindValue(':steam_id', $input);
2088 $stmt->execute();
2089 $count = $stmt->fetchColumn();
2090 return $count;
2091 } catch (PDOException $ex) {
2092 $ex->getMessage() . "err";
2093 }
2094 }
2095
2096 }
2097 class pagination_bootstrap extends harry_potter {
2098
2099 public function pagnation($pag_name, $number_pag)
2100 {
2101 error_reporting("E_ALL & ~E_NOTIC");
2102 $con = $this->con_db();
2103 $get_page = $_GET['id'];
2104 $numpag = $number_pag; //كم عدد النتئاج المعروضة ÙÙŠ Ø§Ù„ØµÙØØ©
2105 $pagname = $pag_name;
2106 $rows = $this->count_rows("select * from $this->tablename");
2107 $len = (int) ceil($rows / $numpag);
2108 if (!$get_page)
2109 {
2110 $get_page = 0;
2111 }
2112 $string_sql = "select * from $this->tablename limit $get_page,$numpag";
2113 $quuery = $con->query($string_sql);
2114 $x = $quuery->fetchAll(PDO::FETCH_ASSOC);
2115
2116 return array($len, $x, $numpag);
2117 }
2118
2119 public function pagnation2($pag_name, $number_pag, $pagname)
2120 {
2121 error_reporting("E_ALL & ~E_NOTIC");
2122 $con = $this->con_db();
2123
2124 $numpag = $number_pag; //كم عدد النتئاج المعروضة ÙÙŠ Ø§Ù„ØµÙØØ©
2125
2126 $rows = $this->count_rows("select * from $this->tablename");
2127 $len = intval($rows / $numpag);
2128 if (!$get_page)
2129 {
2130 $get_page = 0;
2131 }
2132 $start = ($pagname - 1) * $numpag;
2133
2134
2135 $string_sql = "select * from $this->tablename limit $start,$numpag";
2136 $quuery = $con->query($string_sql);
2137 $x = $quuery->fetchAll(PDO::FETCH_ASSOC);
2138
2139 return array($len, $x, $numpag);
2140 }
2141
2142 }
2143?>