Conavt us
This commit is contained in:
@@ -115,7 +115,7 @@ class Database extends Config
|
||||
'hostname' => '10.10.33.60',
|
||||
'username' => 'float',
|
||||
'password' => 'float.user',
|
||||
'database' => 'float_blog',
|
||||
'database' => 'float_site',
|
||||
'DBDriver' => 'MySQLi',
|
||||
'DBPrefix' => '',
|
||||
'pConnect' => false,
|
||||
|
||||
@@ -594,7 +594,7 @@ variations from the norm, and in addition other reproductive organ issue
|
||||
// $res = $this->dummyData($raw_array);
|
||||
break;
|
||||
case 'contact':
|
||||
$res1 = $this->dummyData($raw_array);
|
||||
$res1 = $this->contact($raw_array);
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -611,4 +611,77 @@ variations from the norm, and in addition other reproductive organ issue
|
||||
];
|
||||
}
|
||||
|
||||
private function contact($raw_array)
|
||||
{
|
||||
/*$inx = array(
|
||||
'name' => $this->post('name'),
|
||||
'email' => $this->post('email'),
|
||||
'country' => $this->post('country'),
|
||||
'phone' => $this->post('phone'),
|
||||
'message' => $this->post('message')
|
||||
);
|
||||
$something = $this->request->getVar('name');
|
||||
*/
|
||||
// header('Access-Control-Allow-Origin: * ');
|
||||
// //header("Access-Control-Allow-Origin: http://localhost:9057 ");
|
||||
// header('Access-Control-Expose-Headers: Access-Control-Allow-Origin');
|
||||
// header('Access-Control-Allow-Credentials: true ');
|
||||
// //header("Access-Control-Allow-Headers: Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
|
||||
// header('Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS');
|
||||
// header('Content-type: application/json');
|
||||
$startInsert = false;
|
||||
$status = 0;
|
||||
$message_id = '';
|
||||
// $raw_json = file_get_contents('php://input');
|
||||
// $raw_array = json_decode($raw_json, true);
|
||||
// $something = $raw_array['name'];
|
||||
|
||||
$db = \Config\Database::connect('float_site');
|
||||
if (
|
||||
$raw_array['country'] != '' &&
|
||||
$raw_array['email'] != '' &&
|
||||
$raw_array['name'] != '' &&
|
||||
$raw_array['message'] != '' &&
|
||||
$raw_array['phone'] != ''
|
||||
) {
|
||||
$startInsert = true;
|
||||
}
|
||||
else{
|
||||
$status = -2;
|
||||
$message_id = 'Parameters not recieved';
|
||||
}
|
||||
$data = [
|
||||
'country' => $raw_array['country'],
|
||||
'email' => $raw_array['email'],
|
||||
'name' => $raw_array['name'],
|
||||
'message' => $raw_array['message'],
|
||||
'phone' => $raw_array['phone'],
|
||||
];
|
||||
|
||||
if ($startInsert) {
|
||||
try {
|
||||
$db->table('myfit_contact')->insert($data);
|
||||
// $insert_id = $db->affectedRows();
|
||||
$insert_id = $db->insertId();
|
||||
$query = $db->query(
|
||||
'SELECT uuid, id FROM myfit_contact WHERE id = ' .
|
||||
$insert_id
|
||||
);
|
||||
$row = $query->getRow();
|
||||
$message_id = $row->uuid;
|
||||
$status = $row->id;
|
||||
} catch (Exception $e) {
|
||||
$status = -1;
|
||||
$message_id = '';
|
||||
}
|
||||
}
|
||||
|
||||
$inx = [
|
||||
'message_id' => $message_id,
|
||||
'status' => $status,
|
||||
];
|
||||
return $inx;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user