changeset 1 | 29ae580f12bd |
parent 0 | a4bc6ef5dbfe |
child 3 | ad69d332e9dc |
0:a4bc6ef5dbfe | 1:29ae580f12bd |
---|---|
4 { |
4 { |
5 return ( preg_match('/^(http|https):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $str)) ? TRUE : FALSE; |
5 return ( preg_match('/^(http|https):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $str)) ? TRUE : FALSE; |
6 } |
6 } |
7 |
7 |
8 // get user ID from cookie |
8 // get user ID from cookie |
9 $currID = $_COOKIE['h4c_ID']; |
9 $currID = $_COOKIE['n4c_ID']; |
10 |
10 |
11 if ($currID == "") |
11 if ($currID == "") |
12 { |
12 { |
13 $currID = 1; |
13 $currID = 1; |
14 } |
14 } |
33 } |
33 } |
34 |
34 |
35 // retrieve cookie if it exists |
35 // retrieve cookie if it exists |
36 if ($search_term != "") |
36 if ($search_term != "") |
37 { |
37 { |
38 $conn = mysql_connect('localhost','root','') or die(mysql_error()); |
38 $conn = mysql_connect('localhost','www-data','www-data') or die(mysql_error()); |
39 mysql_select_db('h4c_db'); |
39 mysql_select_db('members'); |
40 |
40 |
41 $query = mysql_query("INSERT INTO requests_tbl (req_ID, user_ID, req_val, req_response, req_created) VALUES ('', '$currID', '$search_term', 0, CURDATE())"); |
41 $query = mysql_query("INSERT INTO requests_tbl (req_ID, uid, req_val, req_response, req_created) VALUES ('', '$currID', '$search_term', 0, CURDATE())"); |
42 $query2 = mysql_query("SELECT MAX(req_ID) as id FROM requests_tbl"); |
42 $query2 = mysql_query("SELECT MAX(req_ID) as id FROM requests_tbl"); |
43 mysql_close(); |
43 mysql_close(); |
44 |
44 |
45 while ($db_field2 = mysql_fetch_assoc($query2)) |
45 while ($db_field2 = mysql_fetch_assoc($query2)) |
46 { |
46 { |
48 } |
48 } |
49 |
49 |
50 // construct message string |
50 // construct message string |
51 $message = "#" . $currID . "#" . $reqID . "#" . $search_term; |
51 $message = "#" . $currID . "#" . $reqID . "#" . $search_term; |
52 |
52 |
53 $host="134.226.36.154"; |
53 $host="localhost"; |
54 $port = 8080; |
54 $port = 8080; |
55 $timeout = 30; |
55 $timeout = 30; |
56 |
56 |
57 $sk=fsockopen($host,$port,$errnum,$errstr,$timeout); |
57 $sk=fsockopen($host,$port,$errnum,$errstr,$timeout); |
58 |
58 |
78 |
78 |
79 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
79 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
80 <html xmlns="http://www.w3.org/1999/xhtml"> |
80 <html xmlns="http://www.w3.org/1999/xhtml"> |
81 <head> |
81 <head> |
82 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
82 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
83 <title>H4C - deleting request information...</title> |
83 <title>N4C - deleting request information...</title> |
84 <link href="files/h4c_main.css" rel="stylesheet" type="text/css" media="screen" /> |
84 <link href="files/n4c_main.css" rel="stylesheet" type="text/css" media="screen" /> |
85 </head> |
85 </head> |
86 |
86 |
87 <body> |
87 <body> |
88 <?php |
88 <?php |
89 // FOR TEST PURPOSES - CHECK QUERYSTRING |
89 // FOR TEST PURPOSES - CHECK QUERYSTRING |