11<?php
2- error_reporting ( E_ALL );
3- ini_set ( 'display_errors ' , '1 ' );
2+ error_reporting (0 );
43# Database Connection
54class database extends SQLite3
65{
@@ -54,62 +53,62 @@ function __construct()
5453 $ myDateTime = new DateTime ( Date ( '' ), new DateTimeZone ( 'GMT ' ) );
5554 $ myDateTime ->setTimezone ( new DateTimeZone ( 'Asia/Kolkata ' ) );
5655 $ date = $ myDateTime ->format ( 'Y-m-d H:i:s ' );
57- $ name = $ _POST ['sp-name ' ];
56+ $ name = SQLite3:: escapeString ( $ _POST ['sp-name ' ] ) ;
5857 if ( empty ( $ _POST ['sp-email ' ] ) )
5958 {
6059 $ emailerror = "Required Field " ;
6160 }
6261 else
6362 {
64- $ email = $ _POST ['sp-email ' ];
63+ $ email = SQLite3:: escapeString ( $ _POST ['sp-email ' ] ) ;
6564 if ( !preg_match ( "/([\w\-]+\@[\w\-]+\.[\w\-]+)/ " , $ email ) )
6665 {
6766 $ emailerror = "Invalid Format " ;
6867 }
6968 }
70- $ org = $ _POST ['sp-org ' ];
71- $ city = $ _POST ['sp-city ' ];
69+ $ org = SQLite3:: escapeString ( $ _POST ['sp-org ' ] ) ;
70+ $ city = SQLite3:: escapeString ( $ _POST ['sp-city ' ] ) ;
7271 if ( !preg_match ( '/$^|^[a-zA-Z]+[0-9]*[\. ,]*[a-zA-Z0-9]*$/ ' , $ city ) )
7372 {
7473 $ cityerror = "City name must start with a letter and can contain only alphanumerics, spaces, periods and commas " ;
7574 }
7675 if ( empty ( $ _POST ['sp-profile ' ] ) ) {
7776 $ profilerror = "No profile " ;
7877 } else {
79- $ profile = $ _POST ['sp-profile ' ];
78+ $ profile = SQLite3:: escapeString ( $ _POST ['sp-profile ' ] ) ;
8079 }
8180
8281 if ( empty ( $ _POST ['sp-tshirt ' ] ) ) {
8382 $ tshirt = "0 " ;
8483 } else {
85- $ tshirt = $ _POST ['sp-tshirt ' ];
84+ $ tshirt = SQLite3:: escapeString ( $ _POST ['sp-tshirt ' ] ) ;
8685 }
8786
8887 if ( empty ( $ _POST ['sp-arrival ' ] ) ) {
8988 $ arrivalerror = "No arriving date given " ;
9089 } else {
91- $ arrival = $ _POST ['sp-arrival ' ];
90+ $ arrival = SQLite3:: escapeString ( $ _POST ['sp-arrival ' ] ) ;
9291 }
9392 if ( empty ( $ _POST ['sp-depart ' ] ) ) {
9493 $ departureerror = "No departure date given " ;
9594 } else {
96- $ departure = $ _POST ['sp-depart ' ];
95+ $ departure = SQLite3:: escapeString ( $ _POST ['sp-depart ' ] ) ;
9796 }
9897 $ lap = 1 ;
9998 if ( empty ( $ _POST ['sp-accom ' ] ) ) {
10099 $ accom = "0 " ;
101100 } else {
102- $ accom = $ _POST ['sp-accom ' ];
101+ $ accom = SQLite3:: escapeString ( $ _POST ['sp-accom ' ] ) ;
103102 }
104- $ pretitle = $ _POST ['sp-title ' ];
103+ $ pretitle = SQLite3:: escapeString ( $ _POST ['sp-title ' ] ) ;
105104 if ( empty ( $ pretitle ) )
106105 {
107106 $ titleerror = "Required Field " ;
108107 }
109108 else
110109 {
111- $ title = $ _POST ['sp-title ' ];
112- $ desc = $ _POST ['sp-desc ' ];
110+ $ title = SQLite3:: escapeString ( $ _POST ['sp-title ' ] ) ;
111+ $ desc = SQLite3:: escapeString ( $ _POST ['sp-desc ' ] ) ;
113112
114113 }
115114 if ( $ nameerror == "" && $ emailerror == "" && $ arrivalerror == "" && $ departureerror == "" && $ orgerror == "" && $ cityerror == "" && $ titleerror == "" && $ profilerror == "" )
@@ -123,11 +122,11 @@ function __construct()
123122 header ( 'location:../../registration_success.html ' );
124123 } else {
125124 echo "fail " ;
126- // header( 'location:../../registration_fail.html' );
125+ header ( 'location:../../registration_fail.html ' );
127126 }
128127 } else {
129128 echo "fail " ;
130- // header( 'location:../../registration_fail.html' );
129+ header ( 'location:../../registration_fail.html ' );
131130 }
132131 }
133132}
0 commit comments