7421b83f35fd5f9ead66eee66241c9f2d409fcd2
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) 
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) */
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) {
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

21)   $email = db_escape_string($email);
bernd Tabelle 'kundenkontakt' kom...

bernd authored 14 years ago

22)   $result = db_query("SELECT id FROM kundendaten.kunden WHERE email='{$email}' OR email_rechnung='{$email}' OR email_extern='{$email}' LIMIT 1;");
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

23)   if ($result->rowCount() == 0)
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

24)     return NULL;
25)   else
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

26)     return $result->fetch(PDO::FETCH_OBJ)->id;
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

27) }
28) 
29) 
30) 
31) function create_customer($data)
32) {
33) 
34)   if (customer_with_email($data['email']) !== NULL)
35)   {
bernd Logger mit Logleveln

bernd authored 14 years ago

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

bernd authored 16 years ago

37)     return NULL;
38)   }
39) 
Bernd Wurst Funktion maybe_null() umdef...

Bernd Wurst authored 6 years ago

40)   logger(LOG_INFO, 'modules/register/include/register', 'register', "Creating new account: ".print_r($data, true));
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

41)   
Bernd Wurst Funktion maybe_null() umdef...

Bernd Wurst authored 6 years ago

42)   db_query("INSERT INTO kundendaten.kunden (firma, nachname, vorname, anrede, email, erstellungsdatum,status) VALUES (:firma, :nachname, :vorname, :anrede, :email, CURDATE(), 3)", $data);
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

43)   $customerno = db_insert_id();
bernd Neues Modul für "Kunde werden"

bernd authored 16 years ago

44)   return $customerno;
45) 
46) }
47) 
48) 
bernd Neue Token-Mail, Erstellung...

bernd authored 16 years ago

49) function send_initial_customer_token($customerno)
50) {
51)   $customerno = (int) $customerno;
52)   $token = get_customer_token($customerno);
53)   $customer = get_customer_info($customerno);
54)   $anrede = "Sehr geehrte Damen und Herren";
55)   if ($customer['title'] == 'Herr')
56)     $anrede = "Sehr geehrter Herr {$customer['name']}";
57)   elseif ($customer['title'] == 'Frau')
58)     $anrede = "Sehr geehrte Frau {$customer['name']}";
59)   $msg = "{$anrede},
60) 
61) wir freuen uns, Sie bei schokokeks.org begrüßen zu dürfen.
62) 
63) 
bernd AGB muss man annehmen und A...

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

85) ";
bernd Tabelle 'kundenkontakt' kom...

bernd authored 14 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

90) function notify_admins_about_new_customer($customerno)
91) {
92)   $customerno = (int) $customerno;
93)   $customer = get_customer_info($customerno);
94)   $msg = "Folgender Kunde hat sich gerade über's Webinterface neu angemeldet:
95) 
96) Kundennummer: {$customerno}
97) Name: {$customer['name']}
bernd Tabelle 'kundenkontakt' kom...

bernd authored 14 years ago

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

bernd authored 16 years ago

99) 
100) Registriert von IP-Adresse {$_SERVER['REMOTE_ADDR']}.
101) ";
102)   send_mail("root@schokokeks.org", "[Webinterface] Neuer Kunde", $msg);
103)   
104)   
105) }
106) 
bernd Neue Token-Mail, Erstellung...

bernd authored 16 years ago

107) function welcome_customer($customerno)
108) {
109)   $customerno = (int) $customerno;
110)   $customer = get_customer_info($customerno);
111)   $anrede = "Sehr geehrte Damen und Herren";
112)   if ($customer['title'] == 'Herr')
113)     $anrede = "Sehr geehrter Herr {$customer['name']}";
114)   elseif ($customer['title'] == 'Frau')
115)     $anrede = "Sehr geehrte Frau {$customer['name']}";
116)   $msg = "{$anrede}.
117) 
118) Herzlich willkommen bei schokokeks.org!
119) 
120) Wir freuen uns, dass Sie sich für schokokeks.org entschieden haben.
121) 
122) Um Ihnen den Einstieg besonders angenehm zu gestalten, haben wir in 
123) unserem Wiki eine Seite eingerichtet, die Ihnen die ersten Schritte 
124) erläutern soll.
125) Rufen Sie dazu bitte die Adresse 
126)  https://wiki.schokokeks.org/Erste_Schritte
127) auf.
128) 
129) Auch die anderen Bereiche des Wikis stecken voller Tipps und 
130) Informationen. Schauen Sie sich um, es lohnt sich!
131) 
132) ";
133)  /*
134)   * FIXME: Diese Mail muss noch überarbeitet werden!
135)   */
136) 
bernd Tabelle 'kundenkontakt' kom...

bernd authored 14 years ago

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

bernd authored 16 years ago

138) }
139) 
140) 
141) 
142) 
143)