Changeset 57
- Timestamp:
- 11/07/06 02:30:26 (16 years ago)
- Location:
- dev
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
dev/common/class.http.php
r50 r57 1 1 <?php 2 /* 3 * http_request class 4 * 5 * useful to avoid allow_url_fopen_wrapper issues 6 * and to get or post data from anywhere we want 7 * 8 */ 2 9 3 10 class http_request … … 11 18 $this->useragent = 'Mozilla/4.0 (compatible)'; 12 19 $this->method = $method; 20 $this->postform = array(); 21 $this->postdata = array(); 13 22 } 14 23 … … 60 69 $fp = &$this->fp; 61 70 62 $request_string = $this->method." ".$this->url['path']."?".$this->url['query']." HTTP/1.0\r\n" . 63 "Accept-Language: en\r\n" . 64 'User-Agent: '.$this->useragent."\r\n" . 65 "Host: ".$this->url['host']."\r\n". 66 "Connection: close\r\n"; 71 // define a linefeed (carriage return + newline) 72 $lf = "\r\n"; 73 74 $request_string = $this->method.' '.$this->url['path'].'?'.$this->url['query'].' HTTP/1.0'.$lf 75 .'Accept-Language: en'.$lf 76 .'User-Agent: '.$this->useragent.$lf 77 .'Host: '.$this->url['host'].$lf 78 .'Connection: close'.$lf; 67 79 if ($this->method == 'POST') 68 80 { 69 $boundary = "-----".substr(md5(rand(0,32000)),0,10); 70 $data ="--$boundary\r\n"; 81 $boundary = substr(md5(rand(0,32000)),0,10); 82 $data = '--'.$boundary.$lf; 83 84 foreach ($this->postform as $name => $content_file) 85 { 86 $data .= 'Content-Disposition: form-data; name="'.$name.'"'.$lf.$lf; 87 $data .= $content_file.$lf; 88 $data .= '--'.$boundary.$lf; 89 } 71 90 72 91 foreach ($this->postdata as $name => $content_file) 73 92 { 74 $data .= "Content-Disposition: form-data; name=\"".$name."\"; filename=\"upload_".rand(0,1000).".txt\"\r\n";75 $data .= "Content-Type: text/plain\r\n\r\n";76 $data .= $content_file. "\r\n";77 $data .= "--$boundary\r\n";93 $data .= 'Content-Disposition: form-data; name="'.$name.'"; filename="'.$name.'"'.$lf; 94 $data .= 'Content-Type: text/plain'.$lf.$lf; 95 $data .= $content_file.$lf; 96 $data .= '--'.$boundary.$lf; 78 97 } 79 $request_string .= "Content-Length: ".strlen($data)."\r\n"; 80 $request_string .= "Content-Type: multipart/form-data, boundary=$boundary\r\n"; 98 99 $request_string .= 'Content-Length: '.strlen($data).$lf; 100 $request_string .= 'Content-Type: multipart/form-data, boundary='.$boundary.$lf; 81 101 } 82 102 else … … 84 104 $data = ''; 85 105 } 86 $request_string .= "\r\n";106 $request_string .= $lf; 87 107 88 108 fputs($fp, $request_string.$data); … … 101 121 $file .= $line; 102 122 } 103 if ($header && $line == "\r\n")123 if ($header && $line == $lf) 104 124 { 105 125 $header = 0; … … 118 138 } 119 139 140 // this is to send file-data to be accessed with $_FILES[$name] 120 141 function set_postdata($name, $data) 121 142 { 122 143 $this->method = 'POST'; 123 144 $this->postdata[$name] = $data; 145 } 146 147 // this function sends form data objects like $_POST[$name] = $data 148 function set_postform($name, $data) 149 { 150 $this->method = 'POST'; 151 $this->postform[$name] = $data; 124 152 } 125 153 -
dev/common/class.page.php
r54 r57 43 43 $html .= '<head>'; 44 44 $html .= '<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">'; 45 $html .= "<title>" . KB_TITLE . " Killboard - " . $this->title_ ."</title>\n";46 $html .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . STYLE_URL ."/common.css\">";45 $html .= '<title>'.KB_TITLE.' Killboard - '.$this->title_."</title>\n"; 46 $html .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"".STYLE_URL."/common.css\">"; 47 47 48 48 $style = $config->getStyleName(); 49 $html .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . STYLE_URL . "/" . $style ."/style.css\">";49 $html .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"".STYLE_URL."/".$style."/style.css\">"; 50 50 51 51 if (!$this->igb_) 52 $html .= "<script language=javascript src=\"" . COMMON_URL ."/generic.js\"></script>";52 $html .= "<script language=javascript src=\"".COMMON_URL."/generic.js\"></script>"; 53 53 $html .= "</head>\n"; 54 54 $html .= "<body bgcolor=\"#222222\""; 55 55 if ($this->onload_) 56 $html .= " onload=\"" . $this->onload_ ."\"";56 $html .= " onload=\"".$this->onload_."\""; 57 57 58 $html .= " >\n";58 $html .= " style=\"height: 100%\">\n"; 59 59 // header 60 $html .= "<table class= main-table height=\"100%\" align=\"center\" bgcolor=\"#111111\" border=\"0\" cellspacing=\"1\"><tr><td valign=\"top\" height=\"100%\">\n";60 $html .= "<table class=\"main-table\" height=\"100%\" align=\"center\" bgcolor=\"#111111\" border=\"0\" cellspacing=\"1\" style=\"height: 100%\"><tr style=\"height: 100%\"><td valign=\"top\" height=\"100%\" style=\"height: 100%\">\n"; 61 61 if (!$this->igb_) 62 62 { -
dev/common/sync_server.php
r44 r57 25 25 if (!file_exists($_FILES['data']['tmp_name'])) 26 26 { 27 var_dump($_REQUEST); 27 28 var_dump($_FILES); 28 29 echo "malformed request, expecting data-file<br>\n"; -
dev/style/blue/style.css
r16 r57 4 4 color: #dfdfdf; 5 5 padding: 0px; 6 height: 100%; 6 7 } 7 8 -
dev/style/default/style.css
r16 r57 4 4 color: #dfdfdf; 5 5 padding: 0px; 6 height: 100%; 6 7 } 7 8