Deprecated: Function get_magic_quotes_gpc() is deprecated in /var/www/vhosts/draminlibrary.com/httpdocs/aminfoundation/library/router.php on line 28
class Daccount_common_Model extends Model {
public $total_rec;
public $insertid;
public $pages;
public $previous;
public $next;
public $n_link = array();
public $tdata = array();
public $err = array();
function __construct() {
parent::__construct();
}
public function addData($table=false,$var1=false) {
$this->connect(DB_NAME);
$xyx=array_keys($var1);
array_pop($xyx);
$n = count($xyx);
$sql = "INSERT INTO $table (";
for($i=0;$i<$n;$i++){
$sql.=$xyx[$i].", ";
}
$vex = trim($sql);
$sql=chop($vex, ",");
$sql .= ") VALUES (";
$xyx1=array_values($var1);
array_pop($xyx1);
$n = count($xyx1);
for($i=0;$i<$n;$i++){
$sql.="'".$xyx1[$i]."', ";
}
$vex = trim($sql);
$sql =rtrim($vex, ",");
$sql.=")";
mysql_query($sql);
mysql_close($this->con);
}
public function RealEscapeAddData($table=false,$var1=false) {
$this->connect(DB_NAME);
$xyx=array_keys($var1);
array_pop($xyx);
$n = count($xyx);
$sql = "INSERT INTO $table (";
for($i=0;$i<$n;$i++){
$sql.=$xyx[$i].", ";
}
$vex = trim($sql);
$sql=chop($vex, ",");
$sql .= ") VALUES (";
$xyx1=array_values($var1);
array_pop($xyx1);
$n = count($xyx1);
for($i=0;$i<$n;$i++){
$sql.="'".mysqli_real_escape_string($this->con,trim($xyx1[$i]))."', ";
}
$vex = trim($sql);
$sql =rtrim($vex, ",");
$sql.=")";
mysql_query($sql);
$this->insertid=mysql_insert_id($this->con);
mysql_close($this->con);
}
public function updateData($table=false,$var1=false,$col=false,$crit=false) {
$this->connect(DB_NAME);
$sql = "UPDATE $table SET ";
foreach($var1 as $x => $x_value){
$sql.=$x."='".$x_value."',";
}
$vex = trim($sql);
$sql=chop($vex, ",");
$sql .= " WHERE ".$col."=".$crit;
mysql_query($sql);
mysql_close($this->con);
}
public function deleteData($table=false,$col=false,$crit=false) {
$this->connect(DB_NAME);
$sql = "DELETE from $table WHERE $col='$crit'";
mysql_query($sql);
mysql_close($this->con);
}
public function getData($SQL=false,$rows_per_page=false,$page=false,$URLx=false,$criteria1=false,$criteria2=false,$criteria3=false){
$this->connect(DB_NAME);
$limit = (($page-1)*$rows_per_page);
$sql = $SQL;
$result = mysql_query($sql);
$total_records = mysql_num_rows($result);
$this->total_rec= $total_records;
$this->pages = ceil($total_records / $rows_per_page);
$sql = $SQL;
$sql .= " LIMIT ";
$sql .= $limit;
$sql .= ", ";
$sql .= $rows_per_page;
$result = mysql_query($sql);
$fox = mysql_num_rows($result);
$rid = mysql_fetch_assoc($result);
@$hiss = array_keys($rid);
@$miss = array_values($rid);
$n = count($hiss);
for($i=0;$i<$n;$i++){
$$hiss[$i] = array();
$sqlx = $sql;
$resultx = mysql_query($sqlx);
while($rix = mysql_fetch_assoc($resultx)){
array_push($$hiss[$i],$rix[$hiss[$i]]);
}
$this->tdata[$hiss[$i]] = $$hiss[$i];
}
if(!empty($criteria1)&&!empty($criteria3)&&!empty($criteria3)){
if ($page> 0){
$url = $URLx . ($page - 1) . "/" . $criteria1 . "/" . $criteria2 . "/" . $criteria3;
$this->previous = "Previous\n";
}
// page numbering links now
for ($i = 0; $i < $this->pages; $i++) {
$url = $URLx . ($i+1) . "/" . $criteria1 . "/" . $criteria2 . "/" . $criteria3;
$this->n_link[] = " " . ($i+1) . " ";
}
if ($page < $this->pages) {
$url = $URLx . ($page + 1) . "/" . $criteria1 . "/" . $criteria2 ;;
$this->next = "Next\n";
}
}else if(!empty($criteria1)&&!empty($criteria2)){
if ($page> 0){
$url = $URLx . ($page - 1) . "/" . $criteria1 . "/" . $criteria2;
$this->previous = "Previous\n";
}
// page numbering links now
for ($i = 0; $i < $this->pages; $i++) {
$url = $URLx . ($i+1) . "/" . $criteria1 . "/" . $criteria2;
$this->n_link[] = " " . ($i+1) . " ";
}
if ($page < $this->pages) {
$url = $URLx . ($page + 1) . "/" . $criteria1 . "/" . $criteria2 . "/" . $criteria3;
$this->next = "Next\n";
}
}if(!empty($criteria1)){
if ($page> 0){
$url = $URLx . ($page - 1) . "/" . $criteria1;
$this->previous = "Previous\n";
}
// page numbering links now
for ($i = 0; $i < $this->pages; $i++) {
$url = $URLx . ($i+1) . "/" . $criteria1;
$this->n_link[] = " " . ($i+1) . " ";
}
if ($page < $this->pages) {
$url = $URLx . ($page + 1) . "/" . $criteria1;
$this->next = "Next\n";
}
}else{
if ($page> 0){
$url = $URLx . ($page - 1);
$this->previous = "Previous\n";
}
// page numbering links now
for ($i = 0; $i < $this->pages; $i++) {
$url = $URLx . ($i+1);
$this->n_link[] = " " . ($i+1) . " ";
}
if ($page < $this->pages) {
$url = $URLx . ($page + 1);
$this->next = "Next\n";
}
}
mysql_close($this->con);
}
public function getColumn($db=false,$tbl=false,$reduce=false){
$this->connect(DB_NAME);
$sql="SELECT `COLUMN_NAME`
FROM `INFORMATION_SCHEMA`.`COLUMNS`
WHERE `TABLE_SCHEMA`='$db'
AND `TABLE_NAME`='$tbl'";
$result = mysql_query($sql);
$fox = mysql_num_rows($result);
$rid = mysql_fetch_assoc($result);
@$hiss = array_keys($rid);
@$miss = array_values($rid);
$n = count($hiss);
for($i=0;$i<$n;$i++){
$$hiss[$i] = array();
$sqlx = $sql;
$resultx = mysql_query($sqlx);
while($rix = mysql_fetch_assoc($resultx)){
array_push($$hiss[$i],$rix[$hiss[$i]]);
}
$this->tdata[$hiss[$i]] = $$hiss[$i];
}
if(!empty($reduce)){
$reduc=explode(",",$reduce);
foreach($reduc as $x => $x_value){
unset($this->tdata['COLUMN_NAME'][$x_value]);
}
}
$this->tdata['COLUMN_NAME']=array_values($this->tdata['COLUMN_NAME']);
mysql_close($this->con);
}
public function ValidateAndAddData($table=false,$var1=false,$important=false) {
$this->connect(DB_NAME);
if(!empty($important)){
$import=explode(",",$important);
foreach($import as $x => $x_value){
if($var1[$x_value]=="") { $this->err[] = "Fill every esteric field!"; }
}
}
$n=count($this->err);
if($n>0){
$this->err;
}else{
$xyx=array_keys($var1);
$n = count($xyx);
$sql = "INSERT INTO $table (";
for($i=0;$i<$n;$i++){
$sql.=$xyx[$i].", ";
}
$vex = trim($sql);
$sql=chop($vex, ",");
$sql .= ") VALUES (";
$xyx1=array_values($var1);
$n = count($xyx1);
for($i=0;$i<$n;$i++){
$sql.="'".$xyx1[$i]."', ";
}
$vex = trim($sql);
$sql =rtrim($vex, ",");
$sql.=")";
mysql_query($sql);
$this->err=array();
$this->err[]="Data inserted successfully!";
}
$this->insertid=mysql_insert_id($this->con);
mysql_close($this->con);
}
public function ImageUpload($var,$var1) {
$allowedExts = array("gif", "jpeg", "jpg", "png","doc", "pdf", "docx");
$temp = explode(".", $_FILES[$var]["name"]);
$extension = end($temp);
if ((($_FILES[$var]["type"] == "image/gif")
|| ($_FILES[$var]["type"] == "image/jpeg")
|| ($_FILES[$var]["type"] == "image/jpg")
|| ($_FILES[$var]["type"] == "image/pjpeg")
|| ($_FILES[$var]["type"] == "image/x-png")
|| ($_FILES[$var]["type"] == "image/png")
|| ($_FILES[$var]["type"] == "application/msword")
|| ($_FILES[$var]["type"] == "application/pdf")
|| ($_FILES[$var]["type"] == "application/vnd.openxmlformats-officedocument.wordprocessingml.document"))
&& ($_FILES[$var]["size"] < 2000000000000)
&& in_array($extension, $allowedExts))
{
if ($_FILES[$var]["error"] > 0)
{
echo "Error: " . $_FILES[$var]["error"] . "
";
}
else
{
$target_path = $_SERVER['DOCUMENT_ROOT']."/aminfoundation/public/daccount/uploads/";
$target_path = $target_path . $var1;
move_uploaded_file($_FILES[$var]['tmp_name'], $target_path);
}
}
}
public function DocumentUpload($var,$var1,$destinationfolder) {
$allowedExts = array("gif", "jpeg", "jpg", "png","doc", "pdf", "docx");
$temp = explode(".", $_FILES[$var]["name"]);
$extension = end($temp);
if ((($_FILES[$var]["type"] == "image/gif")
|| ($_FILES[$var]["type"] == "image/jpeg")
|| ($_FILES[$var]["type"] == "image/jpg")
|| ($_FILES[$var]["type"] == "image/pjpeg")
|| ($_FILES[$var]["type"] == "image/x-png")
|| ($_FILES[$var]["type"] == "image/png")
|| ($_FILES[$var]["type"] == "application/msword")
|| ($_FILES[$var]["type"] == "application/pdf")
|| ($_FILES[$var]["type"] == "application/vnd.openxmlformats-officedocument.wordprocessingml.document"))
&& ($_FILES[$var]["size"] < 2000000000000)
&& in_array($extension, $allowedExts))
{
if ($_FILES[$var]["error"] > 0)
{
echo "Error: " . $_FILES[$var]["error"] . "
";
}
else
{
$target_path = $_SERVER['DOCUMENT_ROOT']."/aminfoundation/public/daccount/uploads/".$destinationfolder."/";
$target_path = $target_path . $var1;
move_uploaded_file($_FILES[$var]['tmp_name'], $target_path);
}
}
}
}
Fatal error: Uncaught Error: Class 'Daccount_common_Model' not found in /var/www/vhosts/draminlibrary.com/httpdocs/aminfoundation/library/controller.php:40
Stack trace:
#0 /var/www/vhosts/draminlibrary.com/httpdocs/aminfoundation/controllers/login_controller.php(9): Controller->Load_SITEINFO()
#1 /var/www/vhosts/draminlibrary.com/httpdocs/aminfoundation/library/router.php(106): Login_Controller->__construct()
#2 /var/www/vhosts/draminlibrary.com/httpdocs/aminfoundation/library/router.php(122): CallHook()
#3 /var/www/vhosts/draminlibrary.com/httpdocs/aminfoundation/public/index.php(9): require_once('/var/www/vhosts...')
#4 {main}
thrown in /var/www/vhosts/draminlibrary.com/httpdocs/aminfoundation/library/controller.php on line 40