4dcba87472366959277b6592a631c3ba8ced868a
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 Initial commit

Bernd Wurst authored 6 years ago

43)             setcookie('NUMBER', $number, time() + 24*3600*500, "");
44) 
45)             if (! $_SESSION['phone']) {
Bernd Wurst Ergänze lokale Vorwahl bei...

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

47)                 break;
48)             }   
49) 
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

51)             break;
52) 
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

53)         case 'address':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

58)                 } else {
59)                     if (! isset($_SESSION[$f])) {
60)                         $_SESSION[$f] = '';
61)                     }
62)                 }
63)             }
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

64)             if (isset($_SESSION['angeliefert'])) {
65)                 if ($_SESSION['angeliefert']) {
66)                     $redirect = 'gitterbox.php';
67)                 } else {
68)                     $redirect = 'gitterbox_spaeter.php';
69)                 }
70)             } else {
71)                 $redirect = 'anlieferung.php';
72)             }
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

73)             break;
74) 
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

75)         case 'anlieferung':
76)             if (isset($_REQUEST['schonda'])) {
77)                 $_SESSION['angeliefert'] = true;
78)                 $redirect = 'gitterbox.php';
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

79)             }
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

80)             if (isset($_REQUEST['kommtnoch'])) {
81)                 $_SESSION['angeliefert'] = false;
82)                 $redirect = 'gitterbox_spaeter.php';
83)             }
84)             break;
85)         case 'gitterbox':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

86)             if (isset($_REQUEST['lieferart'])) {
87)                 if ($_REQUEST['lieferart'] == 'gitterbox') {
88)                     $_SESSION['lieferart'] = 'gitterbox';
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

90)                 }
91)                 if ($_REQUEST['lieferart'] == 'anhaenger') {
92)                     $_SESSION['lieferart'] = 'anhaenger';
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

94)                     if ($_SESSION['angeliefert'] === false && ! $_SESSION['kennz']) {
95)                         $redirect = 'gitterbox_spaeter.php?error';
96)                         break;
97)                     }
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

98)                 }
99)             }
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

101)             break;
102) 
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

103)          case 'gebrauchte':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

104)             if (isset($_REQUEST['kartonsja'])) {
105)                 $_SESSION['kartons'] = true;
106)             } 
107)             if (isset($_REQUEST['kartonsnein'])) {
108)                 $_SESSION['kartons'] = false;
109)             }
110) 
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

112)             break;
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

113)          case 'auftrag':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

114)             if (isset($_REQUEST['5er'])) {
115)                 $_SESSION['neue'] = '5er';
116)             }
117)             if (isset($_REQUEST['10er'])) {
118)                 $_SESSION['neue'] = '10er';
119)             }
120)             if (isset($_REQUEST['submit']) && isset($_REQUEST['sonstiges']) && $_REQUEST['sonstiges'] != '') {
121)                 $_SESSION['neue'] = 'sonstiges';
Bernd Wurst anmerkungen ermöglicht

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

123)             }
124) 
125) 
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

127)             break;
128) 
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

129)          case 'frischsaft':
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

134)             }
135) 
Bernd Wurst Dateinamen geändert

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

137)             break;
Bernd Wurst Spätere Anlieferung eingebaut

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

139)             if (isset($_REQUEST['anmerkungen'])) {
140)                 $_SESSION['anmerkungen'] = htmlspecialchars($_REQUEST['anmerkungen']);
141)             }
Bernd Wurst Initial commit

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 6 years ago

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