-
Notifications
You must be signed in to change notification settings - Fork 6
/
api_signup.php
56 lines (47 loc) · 1.27 KB
/
api_signup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* @author kem parson
* @copyright 2016
*/
//ini_set('display_errors','On');
//error_reporting(E_ALL);
require_once ($_SERVER['DOCUMENT_ROOT'] .'/app/Mage.php');
Mage::app('default');
umask(0);
Mage::init();
//Mage::getSingleton('core/session', array('name' =>'frontend'));
$error="false";
$firstname = $_POST['first'];
$lasttname = $_POST['last'];
$email = $_POST['email'];
$pass = $_POST['pass'];
$lisence = $_POST['lis'];
$mobile = $_POST['mobile'];
$websiteId = Mage::app()->getWebsite()->getId();
$store = Mage::app()->getStore();
$customer = Mage::getModel("customer/customer");
$customer->setWebsiteId($websiteId)
->setStore($store)
->setFirstname($firstname)
->setLastname($lasttname)
->setEmail($email)
->setLe_valid_license($lisence)
->setLe_phone_number($mobile)
->setPassword($pass);
try{
$customer->save();
}
catch (Exception $e) {
//Zend_Debug::dump($e->getMessage());
$message = $e->getMessage();
$ret['error'] = $message ;
$error='true';
}
if($error=='false')
{ $id=$customer->getId();
$ret['sucess']="true";
$ret['id']=$id;
}
$result=json_encode($ret) ;
echo $result;
?>