Browse code

Neue Datenbanktabelle für Tokens

Bernd Wurst authored on12/01/2018 10:12:38
Showing2 changed files
1 1
deleted file mode 100644
... ...
@@ -1,83 +0,0 @@
1
-<?php
2
-/*
3
-This file belongs to the Webinterface of schokokeks.org Hosting
4
-
5
-Written 2008-2014 by schokokeks.org Hosting, namely
6
-  Bernd Wurst <bernd@schokokeks.org>
7
-  Hanno Böck <hanno@schokokeks.org>
8
-
9
-To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10
-
11
-You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
12
-http://creativecommons.org/publicdomain/zero/1.0/
13
-
14
-Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
15
-*/
16
-
17
-require_once('kundendaten.php');
18
-
19
-require_role(ROLE_CUSTOMER);
20
-
21
-title("Adressen ändern");
22
-
23
-output('<p>Die nachfolgende Adresse ist bei uns für Ihre Kundendaten gespeichert. Wenn Sie weitere Informationen ändern möchten, z.B. Name oder Firmierung, wenden Sie sich bitte per E-Mail <a href="mailto:'.config('adminmail').'">an unseren Support</a>. Die Angabe bzw. Änderung einer separaten Rechnungsanschrift ist hier leider nicht möglich, dies bitte auch über unseren Support veranlassen.</p>');
24
-
25
-
26
-$c = lese_kundendaten();
27
-
28
-$odd = false;
29
-$html = '<table>
30
-    <tr class="'.($odd == true ? 'odd' : 'even').'"><td>Kundennummer:</td><td><strong>'.$c['id'].'</strong></td></tr>';
31
-    $odd = !$odd;
32
-if ($c['firma']) {
33
-    $html .= '    <tr class="'.($odd == true ? 'odd' : 'even').'"><td>Firmenname:</td><td><strong>'.$c['firma'].'</strong></td></tr>';
34
-    $odd = !$odd;
35
-    if ($c['nachname']) {
36
-        $html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td>Verwalter:</td><td><strong>'.$c['vorname'].' '.$c['nachname'].'</strong></td></tr>';
37
-        $odd = !$odd;
38
-    }
39
-} else {
40
-    $html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td>Name:</td><td><strong>'.$c['vorname'].' '.$c['nachname'].'</strong></td></tr>';
41
-    $odd = !$odd;
42
-}
43
-
44
-$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="adresse">Adresse:</label></td><td><input type="text" name="adresse" id="adresse" value="'.$c['adresse'].'"></td></tr>';
45
-$odd = !$odd;
46
-$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="adresse2">Adresse:</label></td><td><input type="text" name="adresse2" id="adresse2" value="'.$c['adresse2'].'"></td></tr>';
47
-$odd = !$odd;
48
-if ($c['adresszusatz']) {
49
-    $html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="adresse">Adresszusatz:</label></td><td><input type="text" name="adresszusatz" id="adresszusatz" value="'.$c['adresszusatz'].'"></td></tr>';
50
-    $odd = !$odd;
51
-}
52
-$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="plz">PLZ:</label></td><td><strong>'.$c['land'].'-</strong><input type="text" name="plz" id="plz" value="'.$c['plz'].'"></td></tr>';
53
-$odd = !$odd;
54
-$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="ort">Ort:</label></td><td><input type="text" name="ort" id="ort" value="'.$c['ort'].'"></td></tr>';
55
-$odd = !$odd;
56
-
57
-
58
-$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="email">E-Mail-Adresse:</label></td><td><input type="text" name="email" id="email" value="'.$c['email'].'"></td></tr>';
59
-$odd = !$odd;
60
-if (have_module('newsletter')) {
61
-    $html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="email_newsletter">E-Mail-Adresse (Newsletter):</label></td><td><strong>'.$c['email_newsletter'].'</strong> (Änderung '.internal_link('../newsletter/newsletter', 'hier').')</td></tr>';
62
-    $odd = !$odd;
63
-}
64
-$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="email_extern">E-Mail-Adresse (extern):</label></td><td><input type="text" name="email_extern" id="email_extern" value="'.$c['email_extern'].'"></td></tr>';
65
-$odd = !$odd;
66
-$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="email_rechnung">E-Mail-Adresse (Rechnungen):</label></td><td><input type="text" name="email_rechnung" id="email_rechnung" value="'.$c['email_rechnung'].'"></td></tr>';
67
-$odd = !$odd;
68
-
69
-$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="telefon">Telefonnummer:</label></td><td><input type="text" name="telefon" id="telefon" value="'.$c['telefon'].'"></td></tr>';
70
-$odd = !$odd;
71
-$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="telefon">Mobil:</label></td><td><input type="text" name="mobile" id="mobile" value="'.$c['mobile'].'"></td></tr>';
72
-$odd = !$odd;
73
-$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="telefon">Telefax:</label></td><td><input type="text" name="telefax" id="telefax" value="'.$c['telefax'].'"></td></tr>';
74
-$odd = !$odd;
75
-
76
-$html .= '<tr class="even"><td>&nbsp;</td><td><input type="submit" value="Speichern" /></td></tr>';
77
-$html .= '</table>';
78
-
79
-
80
-output(html_form('chdetails_all', 'chdetails_save', '', $html));
81
-
82
-
83
-?>
... ...
@@ -19,7 +19,7 @@ function verify_mail_token($token)
19 19
 {
20 20
   db_query("DELETE FROM kundendaten.mailaddress_token WHERE expire<NOW()");
21 21
   $args = array(":token" => $token);
22
-  $result = db_query("SELECT kunde, typ, email FROM kundendaten.mailaddress_token WHERE token=:token AND expire>NOW()", $args);
22
+  $result = db_query("SELECT handle, email FROM kundendaten.mailaddress_token WHERE token=:token AND expire>NOW()", $args);
23 23
   if ($result->rowCount() > 0)
24 24
   {
25 25
     $line = $result->fetch();
... ...
@@ -33,41 +33,17 @@ function verify_mail_token($token)
33 33
 
34 34
 function update_mailaddress($daten)
35 35
 {
36
-    $kunde = $daten['kunde'];
37
-    $typ = $daten['typ'];
36
+    $kunde = $daten['handle'];
38 37
     $email = $daten['email'];
39 38
 
40
-    $dbfield = NULL;
41
-    if ($typ == 'regular') {
42
-        $dbfield = 'email';
43
-    } elseif ($typ == 'rechnung') {
44
-        $dbfield = 'email_rechnung';    
45
-    } elseif ($typ == 'newsletter') {
46
-        $dbfield = 'email_newsletter';    
47
-    } elseif ($typ == 'extern') {
48
-        $dbfield = 'email_extern';
49
-    }
50
-    if ($dbfield == NULL) {
51
-        system_failure('Ungültige Daten hinterlegt. Bitte die Änderung nochmal von vorne vornehmen.');
52
-    }
53
-    
54 39
     if (! check_emailaddr($email)) {
55 40
         system_failure('Es ist eine ungültige Adresse hinterlegt. So wird das nichts. Bitte die Änderung von vorne machen.');
56 41
     } 
57 42
 
58
-    $args = array(':kunde' => $kunde,
43
+    $args = array(':handle' => $handle,
59 44
                   ':email' => $email);
60
-    db_query("UPDATE kundendaten.kunden SET $dbfield=:email WHERE id=:kunde", $args);
45
+    db_query("UPDATE kundendaten.handles SET email=:email WHERE id=:handle", $args);
61 46
     
62 47
 }
63 48
 
64 49
 
65
-function lese_kundendaten()
66
-{
67
-    require_role(ROLE_CUSTOMER);
68
-    $customerno = $_SESSION['customerinfo']['customerno'];
69
-    $result = db_query("SELECT id, anrede, firma, vorname, nachname, adresse, adresse2, adresszusatz, land, plz, ort, email, email_newsletter, email_rechnung, email_extern, telefon, mobile, telefax FROM kundendaten.kunden WHERE id=?", array($customerno));
70
-    return $result->fetch();    
71
-}
72
-
73
-