d4c1bfec03cbdcf81ea97332961db13076e30563
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

1) <?php
2) session_start();
3) 
4) if (! isset($_SESSION['handle'])) {
5)     $_SESSION['handle'] = sprintf('%09s', ( round(microtime(true)*10) % 1000000000));
Bernd Wurst Änderungen Stand 2019

Bernd Wurst authored 3 years ago

6)     $_SESSION['date'] = date('Y-m-d H:i:s.v');
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

7)     $_SESSION['complete'] = false;
8) }
9) 
Bernd Wurst Änderungen Stand 2019

Bernd Wurst authored 3 years ago

10) 
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

11) $redirect = NULL;
12) if (isset($_REQUEST['form'])) {
13)     switch ($_REQUEST['form']) {
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

14)         case 'start':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

15)             $number = NULL;
16)             if (isset($_REQUEST['phone']) && trim($_REQUEST['phone']) != '') {
Bernd Wurst Ergänze lokale Vorwahl bei...

Bernd Wurst authored 6 years ago

17)                 $number = trim($_REQUEST['phone']);
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

18)             }
19)             if (! $number) {
20)                 $redirect = 'index.php?error&num=';
21)                 break;
22)             }
Bernd Wurst Änderungen Stand 2019

Bernd Wurst authored 3 years ago

23) 
24)             if (substr($number, 0, 1) != 0 && substr($number, 0, 3) != '+49') {
Bernd Wurst Ergänze lokale Vorwahl bei...

Bernd Wurst authored 6 years ago

25)                 $number = '07192'.$number;
26)             }
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

27) 
28)             require_once('vendor/autoload.php');
29) 
30)             function format_number($number) {
31)                 $phoneNumberUtil = \libphonenumber\PhoneNumberUtil::getInstance();
32)                 try {
33)                     $phoneNumber = $phoneNumberUtil->parse($number, 'DE');
34)                 } catch (Exception $e) {
35)                     return NULL;
36)                 }
37)                 if ($phoneNumberUtil->isValidNumber($phoneNumber)) {
38)                     return $phoneNumberUtil->format($phoneNumber, \libphonenumber\PhoneNumberFormat::NATIONAL);
39)                 }
40)                 return NULL;
41)             }
42)             $number = format_number($number);
43) 
Bernd Wurst bestehende Kunden über die...

Bernd Wurst authored 3 years ago

44)             $name = trim($_REQUEST['name']);
45)             if (! $name) {
46)                 $redirect = 'index.php?error&name=';
47)                 break;
48)             }
49) 
50)             $_SESSION['name'] = htmlspecialchars($name);
51) 
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 6 years ago

52)             $_SESSION['phone'] = htmlspecialchars($number);
Bernd Wurst Cookie löschbar, Datenschut...

Bernd Wurst authored 6 years ago

53)             if (isset($_REQUEST['save']) && $_REQUEST['save'] == 'yes') {
Bernd Wurst bestehende Kunden über die...

Bernd Wurst authored 3 years ago

54)                 setcookie('NAME', $name, time() + 24*3600*500, "");
Bernd Wurst Cookie löschbar, Datenschut...

Bernd Wurst authored 6 years ago

55)                 setcookie('NUMBER', $number, time() + 24*3600*500, "");
56)             }
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

57) 
58)             if (! $_SESSION['phone']) {
Bernd Wurst Ergänze lokale Vorwahl bei...

Bernd Wurst authored 6 years ago

59)                 $redirect = 'index.php?error&num='.urlencode($_REQUEST['phone']);
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

60)                 break;
61)             }   
62) 
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 6 years ago

63)             $redirect = 'address.php';
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

64)             break;
65) 
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

66)         case 'address':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

67)             $fields = array("fname", "lname", "address", "zip", "city");
68)             foreach ($fields as $f) {
69)                 if (isset($_REQUEST[$f])) {
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 6 years ago

70)                     $_SESSION[$f] = trim(htmlspecialchars($_REQUEST[$f]));
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

71)                 } else {
72)                     if (! isset($_SESSION[$f])) {
73)                         $_SESSION[$f] = '';
74)                     }
75)                 }
76)             }
Bernd Wurst Fehlermeldungen auf BS4 por...

Bernd Wurst authored 6 years ago

77)             if ($_SESSION['lname'] == '') {
78)                 $redirect = 'address.php?error';
79)                 break;
80)             }
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

81)             if (isset($_SESSION['angeliefert'])) {
82)                 if ($_SESSION['angeliefert']) {
83)                     $redirect = 'gitterbox.php';
84)                 } else {
85)                     $redirect = 'gitterbox_spaeter.php';
86)                 }
87)             } else {
88)                 $redirect = 'anlieferung.php';
89)             }
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

90)             break;
91) 
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

92)         case 'anlieferung':
93)             if (isset($_REQUEST['schonda'])) {
94)                 $_SESSION['angeliefert'] = true;
95)                 $redirect = 'gitterbox.php';
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

96)             }
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

97)             if (isset($_REQUEST['kommtnoch'])) {
98)                 $_SESSION['angeliefert'] = false;
99)                 $redirect = 'gitterbox_spaeter.php';
100)             }
101)             break;
102)         case 'gitterbox':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

103)             if (isset($_REQUEST['lieferart'])) {
104)                 if ($_REQUEST['lieferart'] == 'gitterbox') {
105)                     $_SESSION['lieferart'] = 'gitterbox';
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 6 years ago

106)                     $_SESSION['gbcount'] = htmlspecialchars($_REQUEST['gbcount']);
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

107)                 }
108)                 if ($_REQUEST['lieferart'] == 'anhaenger') {
109)                     $_SESSION['lieferart'] = 'anhaenger';
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 6 years ago

110)                     $_SESSION['kennz'] = htmlspecialchars($_REQUEST['kennz']);
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

111)                     if ($_SESSION['angeliefert'] === false && ! $_SESSION['kennz']) {
112)                         $redirect = 'gitterbox_spaeter.php?error';
113)                         break;
114)                     }
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

115)                 }
116)             }
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 6 years ago

117)             $redirect = 'gebrauchte.php';
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

118)             break;
119) 
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

120)          case 'gebrauchte':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

121)             if (isset($_REQUEST['kartonsja'])) {
122)                 $_SESSION['kartons'] = true;
123)             } 
124)             if (isset($_REQUEST['kartonsnein'])) {
125)                 $_SESSION['kartons'] = false;
126)             }
127) 
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 6 years ago

128)             $redirect = 'auftrag.php';
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

129)             break;
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

130)          case 'auftrag':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

131)             if (isset($_REQUEST['5er'])) {
132)                 $_SESSION['neue'] = '5er';
133)             }
134)             if (isset($_REQUEST['10er'])) {
135)                 $_SESSION['neue'] = '10er';
136)             }
137)             if (isset($_REQUEST['submit']) && isset($_REQUEST['sonstiges']) && $_REQUEST['sonstiges'] != '') {
138)                 $_SESSION['neue'] = 'sonstiges';
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 6 years ago

139)                 $_SESSION['sonstiges'] = htmlspecialchars($_REQUEST['sonstiges']);
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

140)             }
141) 
142) 
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 6 years ago

143)             $redirect = 'frischsaft.php';
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

144)             break;
145) 
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

146)          case 'frischsaft':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

147)             if (isset($_REQUEST['frischsaftnein'])) {
148)                 $_SESSION['frischsaft'] = 0;
149)             } elseif (isset($_REQUEST['frischsaft'])) {
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 6 years ago

150)                 $_SESSION['frischsaft'] = htmlspecialchars($_REQUEST['frischsaft']);
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

151)             }
152) 
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 6 years ago

153)             $redirect = 'summary.php';
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

154)             break;
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

155)         case 'summary':
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 6 years ago

156)             if (isset($_REQUEST['anmerkungen'])) {
157)                 $_SESSION['anmerkungen'] = htmlspecialchars($_REQUEST['anmerkungen']);
158)             }
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

159)             if (!isset($_REQUEST['agb'])) {
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 6 years ago

160)                 $redirect = 'summary.php?error';