1
1
<?php
2
- error_reporting ( E_ALL );
3
- ini_set ( 'display_errors ' , '1 ' );
2
+ error_reporting (0 );
4
3
# Database Connection
5
4
class database extends SQLite3
6
5
{
@@ -54,62 +53,62 @@ function __construct()
54
53
$ myDateTime = new DateTime ( Date ( '' ), new DateTimeZone ( 'GMT ' ) );
55
54
$ myDateTime ->setTimezone ( new DateTimeZone ( 'Asia/Kolkata ' ) );
56
55
$ date = $ myDateTime ->format ( 'Y-m-d H:i:s ' );
57
- $ name = $ _POST ['sp-name ' ];
56
+ $ name = SQLite3:: escapeString ( $ _POST ['sp-name ' ] ) ;
58
57
if ( empty ( $ _POST ['sp-email ' ] ) )
59
58
{
60
59
$ emailerror = "Required Field " ;
61
60
}
62
61
else
63
62
{
64
- $ email = $ _POST ['sp-email ' ];
63
+ $ email = SQLite3:: escapeString ( $ _POST ['sp-email ' ] ) ;
65
64
if ( !preg_match ( "/([\w\-]+\@[\w\-]+\.[\w\-]+)/ " , $ email ) )
66
65
{
67
66
$ emailerror = "Invalid Format " ;
68
67
}
69
68
}
70
- $ org = $ _POST ['sp-org ' ];
71
- $ city = $ _POST ['sp-city ' ];
69
+ $ org = SQLite3:: escapeString ( $ _POST ['sp-org ' ] ) ;
70
+ $ city = SQLite3:: escapeString ( $ _POST ['sp-city ' ] ) ;
72
71
if ( !preg_match ( '/$^|^[a-zA-Z]+[0-9]*[\. ,]*[a-zA-Z0-9]*$/ ' , $ city ) )
73
72
{
74
73
$ cityerror = "City name must start with a letter and can contain only alphanumerics, spaces, periods and commas " ;
75
74
}
76
75
if ( empty ( $ _POST ['sp-profile ' ] ) ) {
77
76
$ profilerror = "No profile " ;
78
77
} else {
79
- $ profile = $ _POST ['sp-profile ' ];
78
+ $ profile = SQLite3:: escapeString ( $ _POST ['sp-profile ' ] ) ;
80
79
}
81
80
82
81
if ( empty ( $ _POST ['sp-tshirt ' ] ) ) {
83
82
$ tshirt = "0 " ;
84
83
} else {
85
- $ tshirt = $ _POST ['sp-tshirt ' ];
84
+ $ tshirt = SQLite3:: escapeString ( $ _POST ['sp-tshirt ' ] ) ;
86
85
}
87
86
88
87
if ( empty ( $ _POST ['sp-arrival ' ] ) ) {
89
88
$ arrivalerror = "No arriving date given " ;
90
89
} else {
91
- $ arrival = $ _POST ['sp-arrival ' ];
90
+ $ arrival = SQLite3:: escapeString ( $ _POST ['sp-arrival ' ] ) ;
92
91
}
93
92
if ( empty ( $ _POST ['sp-depart ' ] ) ) {
94
93
$ departureerror = "No departure date given " ;
95
94
} else {
96
- $ departure = $ _POST ['sp-depart ' ];
95
+ $ departure = SQLite3:: escapeString ( $ _POST ['sp-depart ' ] ) ;
97
96
}
98
97
$ lap = 1 ;
99
98
if ( empty ( $ _POST ['sp-accom ' ] ) ) {
100
99
$ accom = "0 " ;
101
100
} else {
102
- $ accom = $ _POST ['sp-accom ' ];
101
+ $ accom = SQLite3:: escapeString ( $ _POST ['sp-accom ' ] ) ;
103
102
}
104
- $ pretitle = $ _POST ['sp-title ' ];
103
+ $ pretitle = SQLite3:: escapeString ( $ _POST ['sp-title ' ] ) ;
105
104
if ( empty ( $ pretitle ) )
106
105
{
107
106
$ titleerror = "Required Field " ;
108
107
}
109
108
else
110
109
{
111
- $ title = $ _POST ['sp-title ' ];
112
- $ desc = $ _POST ['sp-desc ' ];
110
+ $ title = SQLite3:: escapeString ( $ _POST ['sp-title ' ] ) ;
111
+ $ desc = SQLite3:: escapeString ( $ _POST ['sp-desc ' ] ) ;
113
112
114
113
}
115
114
if ( $ nameerror == "" && $ emailerror == "" && $ arrivalerror == "" && $ departureerror == "" && $ orgerror == "" && $ cityerror == "" && $ titleerror == "" && $ profilerror == "" )
@@ -123,11 +122,11 @@ function __construct()
123
122
header ( 'location:../../registration_success.html ' );
124
123
} else {
125
124
echo "fail " ;
126
- // header( 'location:../../registration_fail.html' );
125
+ header ( 'location:../../registration_fail.html ' );
127
126
}
128
127
} else {
129
128
echo "fail " ;
130
- // header( 'location:../../registration_fail.html' );
129
+ header ( 'location:../../registration_fail.html ' );
131
130
}
132
131
}
133
132
}
0 commit comments