root/trunk/responses/change_email.response.php
| Revision 1, 2.5 KB (checked in by anonymous, 7 years ago) |
|---|
| Line | |
|---|---|
| 1 | <?php |
| 2 | /****************************************************** Open .node *** |
| 3 | * Description: |
| 4 | * Status: Stable. |
| 5 | * Author: Alexandre Dath <alexandre@dotnode.com> |
| 6 | * $Id$ |
| 7 | * |
| 8 | * Copyright (C) 2005 Alexandre Dath <alexandre@dotnode.com> |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, write to the Free Software Foundation, |
| 22 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 23 | ******************** http://opensource.ikse.net/projects/dotnode ***/ |
| 24 | |
| 25 | $_robot_name = 'modif_email'; |
| 26 | $todo =& $db->getRow('SELECT id_todo, param, id, date FROM todo WHERE id=? AND robot=? AND status=?', array($url_id, 'modif_email', 'doing')); |
| 27 | |
| 28 | if(isset($todo['id'])) |
| 29 | { |
| 30 | /*********** recup des param de la todo ******************/ |
| 31 | if(strstr($todo['param'],'|') != false) |
| 32 | $param_array = split("\|", $todo['param']); |
| 33 | else |
| 34 | $param_array = array($todo['param']); |
| 35 | |
| 36 | foreach($param_array as $item) |
| 37 | { |
| 38 | list($parameter, $value) = split('=', $item); |
| 39 | $param[$parameter] = $value; |
| 40 | } |
| 41 | /*********************************************************/ |
| 42 | |
| 43 | if($todo['date']>time()-86400) |
| 44 | if( $user =& $db->getRow('SELECT id, login, fname, lname, status FROM user WHERE id=?', array($todo['id'])) ) |
| 45 | { |
| 46 | $db->query('UPDATE user_contact SET email=? WHERE id=? and email=?', array($param['email'], $todo['id'], $param['old_email']) ); |
| 47 | $db->query('UPDATE todo SET status=? WHERE robot=? AND id=? AND status=?', array('done', $_robot_name, $todo['id'], 'doing')); |
| 48 | |
| 49 | header('Location: /my/profile/contact'); |
| 50 | } |
| 51 | else |
| 52 | { |
| 53 | $db->query('DELETE FROM todo WHERE robot=? AND id=?', array($_robot_name, $todo['id'])); |
| 54 | header('Location: /error/bad_link/nouser'); |
| 55 | } |
| 56 | else |
| 57 | { |
| 58 | $db->query('DELETE FROM todo WHERE robot=? AND id=?', array($_robot_name, $todo['id'])); |
| 59 | header('Location: /error/bad_link/date_expire'); |
| 60 | } |
| 61 | } |
| 62 | else |
| 63 | { |
| 64 | header('Location: /error/bad_link/not_found'); |
| 65 | } |
| 66 | ?> |
| 67 |
Note: See TracBrowser
for help on using the browser.
