dcc202fb249a446ac15c7cf413b9f1b4a3f31b58
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) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

5) Written 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) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

9) This code is published under a 0BSD license.
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

15) 
16) function customer_with_email($email)
17) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

bernd authored 16 years ago

25) }
26) 
27) 
28) 
29) function create_customer($data)
30) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

bernd authored 16 years ago

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

Hanno authored 5 years ago

36)     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

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

Hanno authored 5 years ago

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

bernd authored 16 years ago

41) }
42) 
43) 
bernd Neue Token-Mail, Erstellung...

bernd authored 16 years ago

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

Hanno authored 5 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

Hanno authored 5 years ago

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

bernd authored 16 years ago

83) }
84) 
85) 
bernd AGB muss man annehmen und A...

bernd authored 16 years ago

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

Hanno authored 5 years ago

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

bernd authored 16 years ago

91) 
92) Kundennummer: {$customerno}
93) Name: {$customer['name']}
bernd Tabelle 'kundenkontakt' kom...

bernd authored 14 years ago

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

bernd authored 16 years ago

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

Hanno authored 5 years ago

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

bernd authored 16 years ago

99) }
100) 
bernd Neue Token-Mail, Erstellung...

bernd authored 16 years ago

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

Hanno authored 5 years ago

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

bernd authored 16 years ago

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

Hanno authored 5 years ago

128)     /*
129)      * FIXME: Diese Mail muss noch überarbeitet werden!
130)      */
bernd Neue Token-Mail, Erstellung...

bernd authored 16 years ago

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

Hanno authored 5 years ago

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