forked from web2project/web2project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
do_updatecontact.php
38 lines (31 loc) · 1.25 KB
/
do_updatecontact.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
<?php
require_once 'base.php';
require_once W2P_BASE_DIR . '/includes/config.php';
require_once W2P_BASE_DIR . '/includes/main_functions.php';
require_once W2P_BASE_DIR . '/includes/db_adodb.php';
$AppUI = new w2p_Core_CAppUI();
$updatekey = w2PgetParam($_POST, 'updatekey', 0);
$updatekey = preg_replace("/[^A-Za-z0-9]/", "", $updatekey);
$contact_id = (int) CContact::getContactByUpdatekey($updatekey);
if (!$contact_id) {
echo $AppUI->_('You are not authorized to use this page. If you should be authorized please contact the sender to give you another valid link, thank you.');
exit;
}
$contact = new CContact();
if (!$contact->bind($_POST)) {
$msg = $AppUI->_('There was an error recording your contact data, please contact the system administrator. Thank you very much.');
} else {
$result = $contact->store();
if (is_array($result)) {
$msg = $AppUI->_('There was an error recording your contact data, please contact the system administrator. Thank you very much.');
} else {
$contact->clearUpdateKey();
$msg = $AppUI->_('Your contact data has been recorded successfully. Your may now close your browser window. Thank you very much, ' . $contact->contact_first_name);
}
}
?>
<html>
<body>
<?php echo $msg; ?>
</body>
</html>