Advertisement
Guest User

Untitled

a guest
Jun 21st, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. <?php
  2.  
  3. class Database
  4. {
  5. private $servername;
  6. private $username;
  7. private $password;
  8. private $dbname;
  9. private $conn;
  10.  
  11. private function connectDB()
  12. {
  13. for ($i = 0; $i < 3;++$i) {
  14. sleep(rand(1, 10) * $i);
  15. $conn = new mysqli($servername, $username, $password, $dbname);
  16. if ($conn->connect_errno) {
  17. errLog('MySQL 連線失敗第 '.($i + 1)." 次:: (錯誤代碼: $conn->connect_errno) $conn->connect_error");
  18. }
  19. }
  20.  
  21. return $conn;
  22. }
  23.  
  24. public function setMysqli($servername, $username, $password, $dbname)
  25. {
  26. $this->servername = $servername;
  27. $this->username = $username;
  28. $this->password = $password;
  29. $this->dbName = $dbname;
  30. }
  31.  
  32. public function getConnection()
  33. {
  34. return $this->connectDB();
  35. }
  36. }
  37. class PhotoQuery
  38. {
  39. private $photoSource;
  40. private $minx;
  41. private $miny;
  42. private $maxx;
  43. private $maxy;
  44.  
  45. private function getPhotos()
  46. {
  47. }
  48.  
  49. public function setPhotoSource($source)
  50. {
  51. }
  52. public function setCoordinate($minx, $miny, $maxx, $maxy)
  53. {
  54. $this->minx = $minx;
  55. }
  56. }
  57.  
  58. class Log
  59. {
  60. private $location;
  61. public $messages;
  62.  
  63. private function saveLog()
  64. {
  65. }
  66.  
  67. public function setLog($message)
  68. {
  69. }
  70. }
  71.  
  72. Database->setMysqli('localhost', 'root','0000','larvata_travel');
  73. PhotoQuery->setPhotoSource('panoramio');
  74. PhotoQuery->setCoordinate('120','20','122','25');
  75. PhotoQuery->save();
  76. Database->close();
  77. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement