29f04bd87fc2cc186714155e59175ade366ec106
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));
6)     $_SESSION['date'] = date('c');
7)     $_SESSION['complete'] = false;
8) }
9) 
10) $redirect = NULL;
11) if (isset($_REQUEST['form'])) {
12)     switch ($_REQUEST['form']) {
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

13)         case 'start':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

17)             }
18)             if (! $number) {
19)                 $redirect = 'index.php?error&num=';
20)                 break;
21)             }
Bernd Wurst Ergänze lokale Vorwahl bei...

Bernd Wurst authored 6 years ago

22)             if (substr($number, 0, 1) != 0 && substr($number, 0, 3) != '+49' && substr($number, 0, 4) != '0049') {
23)                 $number = '07192'.$number;
24)             }
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

43)             if (isset($_REQUEST['save']) && $_REQUEST['save'] == 'yes') {
44)                 setcookie('NUMBER', $number, time() + 24*3600*500, "");
45)             }
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

49)                 break;
50)             }   
51) 
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

53)             break;
54) 
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

55)         case 'address':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

60)                 } else {
61)                     if (! isset($_SESSION[$f])) {
62)                         $_SESSION[$f] = '';
63)                     }
64)                 }
65)             }
Bernd Wurst Fehlermeldungen auf BS4 por...

Bernd Wurst authored 6 years ago

66)             if ($_SESSION['lname'] == '') {
67)                 $redirect = 'address.php?error';
68)                 break;
69)             }
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

70)             if (isset($_SESSION['angeliefert'])) {
71)                 if ($_SESSION['angeliefert']) {
72)                     $redirect = 'gitterbox.php';
73)                 } else {
74)                     $redirect = 'gitterbox_spaeter.php';
75)                 }
76)             } else {
77)                 $redirect = 'anlieferung.php';
78)             }
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

79)             break;
80) 
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

81)         case 'anlieferung':
82)             if (isset($_REQUEST['schonda'])) {
83)                 $_SESSION['angeliefert'] = true;
84)                 $redirect = 'gitterbox.php';
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

85)             }
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

86)             if (isset($_REQUEST['kommtnoch'])) {
87)                 $_SESSION['angeliefert'] = false;
88)                 $redirect = 'gitterbox_spaeter.php';
89)             }
90)             break;
91)         case 'gitterbox':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

92)             if (isset($_REQUEST['lieferart'])) {
93)                 if ($_REQUEST['lieferart'] == 'gitterbox') {
94)                     $_SESSION['lieferart'] = 'gitterbox';
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

96)                 }
97)                 if ($_REQUEST['lieferart'] == 'anhaenger') {
98)                     $_SESSION['lieferart'] = 'anhaenger';
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

100)                     if ($_SESSION['angeliefert'] === false && ! $_SESSION['kennz']) {
101)                         $redirect = 'gitterbox_spaeter.php?error';
102)                         break;
103)                     }
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

104)                 }
105)             }
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

107)             break;
108) 
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

109)          case 'gebrauchte':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

110)             if (isset($_REQUEST['kartonsja'])) {
111)                 $_SESSION['kartons'] = true;
112)             } 
113)             if (isset($_REQUEST['kartonsnein'])) {
114)                 $_SESSION['kartons'] = false;
115)             }
116) 
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

118)             break;
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

119)          case 'auftrag':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

120)             if (isset($_REQUEST['5er'])) {
121)                 $_SESSION['neue'] = '5er';
122)             }
123)             if (isset($_REQUEST['10er'])) {
124)                 $_SESSION['neue'] = '10er';
125)             }
126)             if (isset($_REQUEST['submit']) && isset($_REQUEST['sonstiges']) && $_REQUEST['sonstiges'] != '') {
127)                 $_SESSION['neue'] = 'sonstiges';
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

129)             }
130) 
131) 
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

133)             break;
134) 
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

135)          case 'frischsaft':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

140)             }
141) 
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

143)             break;
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

145)             if (isset($_REQUEST['anmerkungen'])) {
146)                 $_SESSION['anmerkungen'] = htmlspecialchars($_REQUEST['anmerkungen']);
147)             }
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

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