public function saveAttribute($dataForm, $attributeId = "") { global $mySession; $db = new Db(); $dataForm = SetupMagicQuotesTrim($dataForm); if ($attributeId == "") { $chkQry = $db->runQuery("select * from " . ATTRIBUTE . " where attribute_name like '%" . mysql_escape_string(trim($dataForm['attribute_name'])) . "' "); if ($chkQry != "" and count($chkQry) > 0) { //if Same Question exists than return false / 0 // No Data Inserted return 0; } else { $data = array(); $data['attribute_name'] = $dataForm['attribute_name']; $data['attribute_status'] = $dataForm['attribute_status']; $db->save(ATTRIBUTE, $data); $latestId = $db->lastInsertId(); return 1; } } else { $chkQry = $db->runQuery("select * from " . ATTRIBUTE . " where attribute_name like '%" . mysql_escape_string(trim($dataForm['attribute_name'])) . "' and attribute_id != '" . $attributeId . "' "); if ($chkQry != "" and count($chkQry) > 0) { //if Same Question exists than return false / 0 // No Data Inserted return 0; } else { $data = array(); $data['attribute_name'] = $dataForm['attribute_name']; $data['attribute_status'] = $dataForm['attribute_status']; $condition = "attribute_id = " . $attributeId; $db->modify(ATTRIBUTE, $data, $condition); return 1; } } }
public function saveSubscription($dataForm, $subscriptionId = "") { global $mySession; $db = new Db(); $dataForm = SetupMagicQuotesTrim($dataForm); if (empty($subscriptionId)) { $data = array(); //code for inserting order $db->save("subscriber", $dataForm); $latestId = $db->lastInsertId(); return 1; } else { $condition = "subscriber_id = " . $subscriptionId; $db->modify("subscriber", $dataForm, $condition); return 2; } }
public function SaveUser($dataForm) { global $mySession; $db = new Db(); $dataForm = SetupMagicQuotesTrim($dataForm); $chkQry = $db->runQuery("select * from " . USERS . " where email_address='" . $dataForm['email_address'] . "'"); if ($chkQry != "" and count($chkQry) > 0) { return 0; } else { if ($dataForm['photo'] == "") { if ($dataForm['sex'] == '2') { $noImage = "defaultuserfemaleprofile.png"; } else { $noImage = "defaultusermaleprofile.png"; } } else { $imageNewName = time() . "_" . $dataForm['photo']; @rename(SITE_ROOT . 'images/' . $dataForm['photo'], SITE_ROOT . 'images/' . $imageNewName); $noImage = $imageNewName; } $dataInsert['uType'] = $dataForm['uType']; $dataInsert['first_name'] = $dataForm['first_name']; $dataInsert['last_name'] = $dataForm['last_name']; $dataInsert['title'] = $dataForm['title']; $dataInsert['email_address'] = $dataForm['email_address']; $dataInsert['password'] = md5($dataForm['password']); $dataInsert['country_id'] = $dataForm['country_id']; $dataInsert['state_id'] = $dataForm['state_id']; $dataInsert['city_id'] = $dataForm['city_id']; $dataInsert['zipcode'] = $dataForm['zipcode']; $dataInsert['home_number'] = $dataForm['home_number']; $dataInsert['work_number'] = $dataForm['work_number']; $dataInsert['mobile_number'] = $dataForm['mobile_number']; $dataInsert['web'] = $dataForm['webaddress']; $dataInsert['address'] = $dataForm['address']; $dataInsert['date_joined'] = date("Y-m-d H:i:s"); $dataInsert['image'] = $noImage; $dataInsert['user_status'] = '1'; $db->save(USERS, $dataInsert); return $db->lastInsertId(); } }
public function SaveUser($dataForm, $SignUpfor) { global $mySession; $db = new Db(); $dataForm = SetupMagicQuotesTrim($dataForm); if ($dataForm['photo'] == "") { if ($dataForm['sex'] == '2') { $noImage = "defaultuserfemaleprofile.png"; } else { $noImage = "defaultusermaleprofile.png"; } } else { $imageNewName = time() . "_" . $dataForm['photo']; @rename(SITE_ROOT . 'images/' . $dataForm['photo'], SITE_ROOT . 'images/' . $imageNewName); $noImage = $imageNewName; } // $chkQry=$db->runQuery("select * from ".USERS." where email_address='".mysql_escape_string($dataForm['email_address'])."'"); /* if($chkQry!="" and count($chkQry)>0) { return 0; } else { */ $dataInsert['uType'] = $SignUpfor; //$dataInsert['username']=$dataForm['username']; $dataInsert['first_name'] = $dataForm['first_name']; $dataInsert['last_name'] = $dataForm['last_name']; $dataInsert['title'] = $dataForm['title']; $dataInsert['email_address'] = $dataForm['email_address']; $dataInsert['password'] = md5($dataForm['password']); $dataInsert['country_id'] = $dataForm['country_id']; $dataInsert['state_id'] = $dataForm['state_id']; $dataInsert['city_id'] = $dataForm['city_id']; $dataInsert['zipcode'] = $dataForm['zipcode']; $dataInsert['home_number'] = $dataForm['home_number']; $dataInsert['work_number'] = $dataForm['work_number']; $dataInsert['mobile_number'] = $dataForm['mobile_number']; //$dataInsert['sex']=$dataForm['sex']; $dataInsert['address'] = $dataForm['address']; $dataInsert['web'] = $dataForm['webaddress']; $dataInsert['date_joined'] = date("Y-m-d H:i:s"); $dataInsert['image'] = $noImage; $dataInsert['user_status'] = '0'; /*$lat_long = getLatLongFromAddress($dataInsert['country_id'],$dataInsert['state_id'],$dataInsert['city_id'],$dataInsert['address']); $lat_long = explode("::",$lat_long); $dataInsert['cletitude'] = $lat_long[0]; $dataInsert['clongitude'] = $lat_long[1];*/ $db->save(USERS, $dataInsert); $UserId = $db->lastInsertId(); $dataUpdate['password_reset'] = md5($UserId); $condition = " user_id = " . $UserId; $db->modify(USERS, $dataUpdate, $condition); $fullName = $dataForm['email_address']; $Url = '<a href="' . APPLICATION_URL . '">' . APPLICATION_URL . '</a>'; //$ActivationLink='<a href="'.APPLICATION_URL.'signup/activate/cId/'.md5($UserId).':'.$SignUpfor.'">'.APPLICATION_URL.'signup/activate/cId/'.md5($UserId).':'.$SignUpfor.'</a>'; $ActivationLink = APPLICATION_URL . 'signup/activate/cId/' . md5($UserId); $templateData = $db->runQuery("select * from " . EMAIL_TEMPLATES . " where template_id='4'"); $messageText = $templateData[0]['email_body']; $subject = $templateData[0]['email_subject']; $messageText = str_replace("[NAME]", $fullName, $messageText); $messageText = str_replace("[SITENAME]", SITE_NAME, $messageText); $messageText = str_replace("[SITEURL]", $Url, $messageText); $messageText = str_replace("[ACTIVATIONLINK]", $ActivationLink, $messageText); if (IS_LIVE) { $retnvalue = SendEmail($dataForm['email_address'], $subject, $messageText); } return $UserId; }
public function saveSpecification($dataForm, $specId = "") { global $mySession; $db = new Db(); $dataForm = SetupMagicQuotesTrim($dataForm); if ($specId == "") { $chkQry = $db->runQuery("select * from " . SPECIFICATION . " where question like '%" . mysql_escape_string(trim($dataForm['question'])) . "' and cat_id = '" . $dataForm['category'] . "' "); if ($chkQry != "" and count($chkQry) > 0) { //if Same Question exists than return false / 0 // No Data Inserted return 0; } else { $data_update['cat_id'] = $dataForm['category']; $data_update['question'] = $dataForm['question']; $data_update['spec_type'] = $dataForm['input_type']; $data_update['mandatory'] = $dataForm['mandatory']; $data_update['status'] = $dataForm['spec_status']; //code for inserting order $orderArr = $db->runQuery("select * from " . SPECIFICATION . " where cat_id = '" . $dataForm['category'] . "' "); $data_update['spec_order'] = count($orderArr) + 1; $db->save(SPECIFICATION, $data_update); $latestId = $db->lastInsertId(); for ($x = 1; $x <= 53; $x++) { $options_add = "options_add" . $x; if (trim($dataForm[$options_add]) != "") { $data_update1['spec_id'] = $latestId; $data_update1['option'] = sanisitize_input($dataForm[$options_add]); $db->save(SPEC_CHILD, $data_update1); } } return 1; } } else { // echo "select * from ".SPECIFICATION." where question like '%".mysql_escape_string(trim($dataForm['question']))."' and cat_id = '".$dataForm['category']."' "; // exit; $chkQry = $db->runQuery("select * from " . SPECIFICATION . " where question like '%" . mysql_escape_string(trim($dataForm['question'])) . "' and spec_id != '" . $specId . "' and cat_id = '" . $dataForm['category'] . "' "); if ($chkQry != "" and count($chkQry) > 0) { //if Same Question exists than return false / 0 // No Data Inserted return 0; } else { $data_update['cat_id'] = $dataForm['category']; $data_update['question'] = $dataForm['question']; $data_update['spec_type'] = $dataForm['input_type']; $data_update['status'] = $dataForm['spec_status']; $data_update['mandatory'] = $dataForm['mandatory']; $condition = "spec_id = " . $specId; $db->modify(SPECIFICATION, $data_update, $condition); $specsId = ""; $db->delete(SPEC_CHILD, $condition); for ($x = 1; $x <= 53; $x++) { $options_add = "options_add" . $x; if (trim($dataForm[$options_add]) != "") { $data_update1['spec_id'] = $specId; $data_update1['option'] = $dataForm[$options_add]; $db->save(SPEC_CHILD, $data_update1); } } return 1; } } }