Skip to content

Commit

Permalink
Update phpedb.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Base authored Feb 26, 2020
1 parent 9883134 commit 42f740e
Showing 1 changed file with 16 additions and 50 deletions.
66 changes: 16 additions & 50 deletions source/phpedb.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,19 @@
* @Name : phpedb.php
* @Version : 1.0
* @Programmer : Max
* @Date : 2016-2019, 2019-07-10
* @Date : 2016-2019, 2019-07-10, 2020-02-26
* @Released under : https://github.com/BaseMax/PHPEDB/blob/master/LICENSE
* @Repository : https://github.com/BaseMax/PHPEDB
*
**/
date_default_timezone_set('America/Los_Angeles');
function error_page($error)
{
$style="";
// $style="
// <style>
// @font-face
// {
// font-family:'site1';
// src:url('fonts/site1.woff') format('woff'),
// url('fonts/site1.ttf') format('truetype');
// font-weight:normal;
// }
// @font-face
// {
// font-family:'site2';
// src:url('fonts/site2.woff') format('woff'),
// url('fonts/site2.ttf') format('truetype');
// font-weight:bold;
// }
// body
// {
// direction: rtl;
// font-family:'site1';
// }
// </style>
// ";
exit("<meta charset=\"utf-8\">".$style."<br><br><center><h1>Error : ".$error."</h1></center>");
}
class database
{
public $database=null;
public $db="";
private function error_page($error)
{
exit("<meta charset=\"utf-8\"><br><br><center><h1>Error : ".$error."</h1></center>");
}
public function connect($host="localhost",$user="root",$pass="")
{
try
Expand All @@ -53,7 +28,7 @@ public function connect($host="localhost",$user="root",$pass="")
catch(PDOException $e)
{
$this->database=null;
error_page($e->getMessage());
$this->error_page($e->getMessage());
}
}
public function check()
Expand All @@ -78,7 +53,7 @@ public function selectRaw($query)
}
catch(PDOException $e)
{
error_page($e->getMessage());
$this->error_page($e->getMessage());
}
}
public function selectsRaw($query)
Expand All @@ -91,7 +66,7 @@ public function selectsRaw($query)
}
catch(PDOException $e)
{
error_page($e->getMessage());
$this->error_page($e->getMessage());
}
}
public function query($query,$error=true)
Expand All @@ -104,7 +79,7 @@ public function query($query,$error=true)
{
if($error == true)
{
error_page($e->getMessage());
$this->error_page($e->getMessage());
}
}
}
Expand All @@ -118,7 +93,7 @@ public function create_database($name,$error=true)
{
if($error == true)
{
error_page($e->getMessage());
$this->error_page($e->getMessage());
}
}
}
Expand Down Expand Up @@ -177,7 +152,7 @@ public function selects($table,$clause=[],$after="",$__sql="")
}
catch(PDOException $e)
{
error_page($e->getMessage());
$this->error_page($e->getMessage());
}
}
public function select($table,$clause=[],$after="")
Expand Down Expand Up @@ -229,7 +204,7 @@ public function select($table,$clause=[],$after="")
}
catch(PDOException $e)
{
error_page($e->getMessage());
$this->error_page($e->getMessage());
}
}
public function count($table,$clause=[])
Expand Down Expand Up @@ -280,7 +255,7 @@ public function count($table,$clause=[])
}
catch(PDOException $e)
{
error_page($e->getMessage());
$this->error_page($e->getMessage());
}
}
public function delete($table,$clause=[])
Expand Down Expand Up @@ -330,7 +305,7 @@ public function delete($table,$clause=[])
}
catch(PDOException $e)
{
error_page($e->getMessage());
$this->error_page($e->getMessage());
}
}
public function insert($table,$values)
Expand Down Expand Up @@ -369,7 +344,7 @@ public function insert($table,$values)
}
catch(PDOException $e)
{
error_page($e->getMessage());
$this->error_page($e->getMessage());
}
}
public function update($table,$clause,$values)
Expand Down Expand Up @@ -439,16 +414,7 @@ public function update($table,$clause,$values)
}
catch(PDOException $e)
{
error_page($e->getMessage());
$this->error_page($e->getMessage());
}
}
}
// function convert($string)
// {
// $persian = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
// $arabic = ['٩', '٨', '٧', '٦', '٥', '٤', '٣', '٢', '١','٠'];
// $num = range(0, 9);
// $convertedPersianNums = str_replace($persian, $num,$string);
// $englishNumbersOnly = str_replace($arabic, $num, $convertedPersianNums);
// return $englishNumbersOnly;
// }

0 comments on commit 42f740e

Please sign in to comment.