9086c9ad77db90633e0629e9e86a88366265ded0
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

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) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

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) */
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

16) 
bernd Neue Token-Mail, Erstellung...

bernd authored 16 years ago

17) require_once('mail.php');
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

18) 
19) function customer_with_email($email)
20) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

21)     $email = db_escape_string($email);
22)     $result = db_query("SELECT id FROM kundendaten.kunden WHERE email='{$email}' OR email_rechnung='{$email}' OR email_extern='{$email}' LIMIT 1;");
23)     if ($result->rowCount() == 0) {
24)         return null;
25)     } else {
26)         return $result->fetch(PDO::FETCH_OBJ)->id;
27)     }
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

28) }
29) 
30) 
31) 
32) function create_customer($data)
33) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

34)     if (customer_with_email($data['email']) !== null) {
35)         logger(LOG_WARNING, 'modules/register/include/register', 'register', "Attempt to create customer with duplicate email »{$data['email']}«");
36)         return null;
37)     }
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

38) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

39)     logger(LOG_INFO, 'modules/register/include/register', 'register', "Creating new account: ".print_r($data, true));
Hanno remove whitespace in empty...

Hanno authored 5 years ago

40) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

41)     db_query("INSERT INTO kundendaten.kunden (firma, nachname, vorname, anrede, email, erstellungsdatum,status) VALUES (:firma, :nachname, :vorname, :anrede, :email, CURDATE(), 3)", $data);
42)     $customerno = db_insert_id();
43)     return $customerno;
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

44) }
45) 
46) 
bernd Neue Token-Mail, Erstellung...

bernd authored 16 years ago

47) function send_initial_customer_token($customerno)
48) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

49)     $customerno = (int) $customerno;
50)     $token = get_customer_token($customerno);
51)     $customer = get_customer_info($customerno);
52)     $anrede = "Sehr geehrte Damen und Herren";
53)     if ($customer['title'] == 'Herr') {
54)         $anrede = "Sehr geehrter Herr {$customer['name']}";
55)     } elseif ($customer['title'] == 'Frau') {
56)         $anrede = "Sehr geehrte Frau {$customer['name']}";
57)     }
58)     $msg = "{$anrede},
bernd Neue Token-Mail, Erstellung...

bernd authored 16 years ago

59) 
60) wir freuen uns, Sie bei schokokeks.org begrüßen zu dürfen.
61) 
62) 
bernd AGB muss man annehmen und A...

bernd authored 16 years ago

63) Sie haben sich als Kunde von schokokeks.org Webhosting 
64) angemeldet. Diese E-Mail ist ein Zwischenschritt um die Gültigkeit 
65) Ihrer E-Mail-Adresse zu überprüfen.
bernd Neue Token-Mail, Erstellung...

bernd authored 16 years ago

66) 
bernd AGB muss man annehmen und A...

bernd authored 16 years ago

67) Um ein Passwort für Ihren Kunden-Zugang festzulegen, rufen Sie 
68) bitte die folgende Adresse auf:
bernd Neue Token-Mail, Erstellung...

bernd authored 16 years ago

69)  https://config.schokokeks.org/go/index/validate_token.php?customerno={$customer['customerno']}&token={$token}
70) 
71) Sollte Ihr E-Mail-Programm diesen Link nicht korrekt an den Browser
72) übertragen, rufen Sie bitte die Seite
73)  https://config.schokokeks.org/go/index/validate_token.php
74) auf und geben Sie die folgenden Daten ein:
75)  Kundennummer: {$customer['customerno']}
76)  Code:         {$token}
77) 
78) Diese Prozedur müssen Sie bis spätestens 24 Stunden nach Erhalt
79) dieser Nachricht durchführen, sonst verliert der Code seine
bernd AGB muss man annehmen und A...

bernd authored 16 years ago

80) Gültigkeit und der Zugang wird wieder gelöscht.
bernd Neue Token-Mail, Erstellung...

bernd authored 16 years ago

81) 
82) Sofern Sie keinen Account bei schokokeks.org angemeldet haben, 
bernd AGB muss man annehmen und A...

bernd authored 16 years ago

83) können Sie diese Nachricht ignorieren.
bernd Neue Token-Mail, Erstellung...

bernd authored 16 years ago

84) ";
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

85)     send_mail($customer['email'], "Willkommen bei schokokeks.org Webhosting", $msg);
bernd Neue Token-Mail, Erstellung...

bernd authored 16 years ago

86) }
87) 
88) 
bernd AGB muss man annehmen und A...

bernd authored 16 years ago

89) function notify_admins_about_new_customer($customerno)
90) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

91)     $customerno = (int) $customerno;
92)     $customer = get_customer_info($customerno);
93)     $msg = "Folgender Kunde hat sich gerade über's Webinterface neu angemeldet:
bernd AGB muss man annehmen und A...

bernd authored 16 years ago

94) 
95) Kundennummer: {$customerno}
96) Name: {$customer['name']}
bernd Tabelle 'kundenkontakt' kom...

bernd authored 14 years ago

97) E-mail: {$customer['email']}
bernd AGB muss man annehmen und A...

bernd authored 16 years ago

98) 
99) Registriert von IP-Adresse {$_SERVER['REMOTE_ADDR']}.
100) ";
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

101)     send_mail("root@schokokeks.org", "[Webinterface] Neuer Kunde", $msg);
bernd AGB muss man annehmen und A...

bernd authored 16 years ago

102) }
103) 
bernd Neue Token-Mail, Erstellung...

bernd authored 16 years ago

104) function welcome_customer($customerno)
105) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

106)     $customerno = (int) $customerno;
107)     $customer = get_customer_info($customerno);
108)     $anrede = "Sehr geehrte Damen und Herren";
109)     if ($customer['title'] == 'Herr') {
110)         $anrede = "Sehr geehrter Herr {$customer['name']}";
111)     } elseif ($customer['title'] == 'Frau') {
112)         $anrede = "Sehr geehrte Frau {$customer['name']}";
113)     }
114)     $msg = "{$anrede}.
bernd Neue Token-Mail, Erstellung...

bernd authored 16 years ago

115) 
116) Herzlich willkommen bei schokokeks.org!
117) 
118) Wir freuen uns, dass Sie sich für schokokeks.org entschieden haben.
119) 
120) Um Ihnen den Einstieg besonders angenehm zu gestalten, haben wir in 
121) unserem Wiki eine Seite eingerichtet, die Ihnen die ersten Schritte 
122) erläutern soll.
123) Rufen Sie dazu bitte die Adresse 
124)  https://wiki.schokokeks.org/Erste_Schritte
125) auf.
126) 
127) Auch die anderen Bereiche des Wikis stecken voller Tipps und 
128) Informationen. Schauen Sie sich um, es lohnt sich!
129) 
130) ";
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

131)     /*
132)      * FIXME: Diese Mail muss noch überarbeitet werden!
133)      */
bernd Neue Token-Mail, Erstellung...

bernd authored 16 years ago

134) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

135)     send_mail($customer['email'], "Willkommen bei schokokeks.org", $msg);