Server IP : 103.6.199.200 / Your IP : 3.146.37.222 Web Server : Microsoft-IIS/10.0 System : Windows NT EMPUSA 10.0 build 20348 (Windows Server 2016) i586 User : EMPUSA$ ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Domains/cenxusco/hlb.cenxus.com/wwwroot/ |
Upload File : |
<?php function pdo_perform( $action ) { reset($action['data']); if ( $action['action'] == 'insert' ) { $query = 'INSERT INTO ' . trim($action['table'], "`") . ' ('; foreach ( $action['data'] as $columns => $value ) { $query .= '`'. trim($columns, "`") . '`, '; } $query = substr($query, 0, -2) . ') VALUES ('; reset($action['data']); foreach ( $action['data'] as $columns => $value ) { switch ( (string) $value ) { case 'now()': $query .= 'NOW(), '; unset($action['data'][$columns]); break; case 'UTC_TIMESTAMP()': $query .= 'UTC_TIMESTAMP(), '; unset($action['data'][$columns]); break; case 'null': $query .= 'NULL, '; unset($action['data'][$columns]); break; case '': $query .= '\'\', '; unset($action['data'][$columns]); break; default: if ( substr($value,0,11) == 'INET_ATON("' ) { unset($action['data'][$columns]); $query .= $value.", "; } else { $query .= ':'.trim($columns, "`").", "; } break; } } $query = substr($query, 0, -2) . ')'; } else if ( $action['action'] == 'update' ) { $query = 'UPDATE ' . trim($action['table'], "`") . ' SET '; foreach ( $action['data'] as $columns => $value ) { switch ( (string) $value ) { case 'now()': $query .= '`'.trim($columns, "`").'` = NOW(), '; unset($action['data'][$columns]); break; case 'UTC_TIMESTAMP()': $query .= '`'.trim($columns, "`").'` = UTC_TIMESTAMP(), '; unset($action['data'][$columns]); break; case 'null': $query .= '`'.trim($columns, "`").'` = NULL, '; unset($action['data'][$columns]); break; case '': $query .= '`'.trim($columns, "`").'` = \'\', '; unset($action['data'][$columns]); break; default: if ( substr($columns,0,11) == 'INET_ATON("' ) { unset($action['data'][$columns]); $query .= '`'.trim($columns, "`").'` = '.$value.', '; } else { $query .= '`'.trim($columns, "`").'` = :'.trim($columns, "`").', '; } break; } } $query = substr($query, 0, -2) . ' WHERE ' . $action['parameters']; } reset($action['data']); $execut = array(); foreach ( $action['data'] as $columns => $value ) { $execut[':'.trim($columns, "`")] = stripslashes($value); } $querystring['query'] = $query; $querystring['execute'] = $execut; if ( isset($action['lastid']) ) { $querystring['lastid'] = $action['lastid']; } return pdo_query( $querystring ); } function pdo_query( $query ) { global $db_conn; $q = $db_conn->prepare($query['query']); $return['result'] = $q->execute($query['execute']); if ( isset($query['lastid']) && $query['lastid']=='Y' ) { $q = $db_conn->prepare('SELECT LAST_INSERT_ID() AS `lastid`'); $q->execute(); $row = $q->fetch(PDO::FETCH_ASSOC); $return['lastid'] = $row['lastid']; } return $return; } function email( $arr ) { /* ! - $format = text/html, text/plain */ /* ! - ignore sending email if under dev. */ // if ( getenv('SERVER_ADDR') != '127.0.0.1' ) { require_once('assets/js/lib/swift_required.php'); $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, "ssl") ->setUsername('cenxusclient@gmail.com') ->setPassword('gmrllevksthvxssy'); $swift = Swift_Mailer::newInstance($transport); // $transport = Swift_MailTransport::newInstance(); // $swift = Swift_Mailer::newInstance($transport); // ! - Create the message $message = Swift_Message::newInstance(stripslashes($arr['subject'])) ->setFrom($arr['from']) ->setBody(stripslashes($arr['html_message']),$arr['format']); // ! - Create attachment if(isset($arr['attachfile'])){ if (is_array($arr['attachfile'])) { foreach ($arr['attachfile'] as $key => $value) { $message->attach(Swift_Attachment::fromPath($value)); } } else { $message->attach(Swift_Attachment::fromPath($arr['attachfile'])); } } // ! - Send the message $failedRecipients = array(); $numSent = 0; foreach ( $arr['to'] as $address => $name ) { if ( is_int($address) ) { $message->setTo($name); } else { $message->setTo(array($address => $name)); } $numSent += $swift->send($message, $failedRecipients); } if( isset($arr['cc']) && is_array( $arr['cc'] ) ) { foreach ( $arr['cc'] as $address => $name ) { if ( is_int($address) ) { $message->setCc($name); } else { $message->setCc(array($address => $name)); } $numSent += $swift->send($message, $failedRecipients); } } return true; // } else { // if ( $fp = fopen('orderemailtest.txt', 'a') ) { // $writefile = 'From: '.key($arr['from']).' ('.current($arr['from']).")\nTo: ".print_r($arr['to'], true).")\n".$arr['subject']."\n".$arr['html_message']; // fwrite($fp, $writefile); // fclose($fp); // return true; //Demo mode // } else { // return false; // } // } } ?>