Insert the contact form code somewhere in your php-enabled web site (no mysql, gdlib or any other extensions required). Please do not forget to set your xinbox login in "$xinbox_login" variable. If you do not have XInbox account yet, please register it.
|
<? // XINBOX CONTACT FORM - BEGIN $xinbox_login = "Your_Login_Here"; $data = ""; $fp = fsockopen("xinbox.com",80); if($fp) { $fn = $_FILES['userfile']['name']; srand((double)microtime()*1000000); $boundary = "---------------------------".substr(md5(rand(0,32000)),0,10); foreach($_POST as $k=>$v) { $data .= "--".$boundary."\r\n"; $data .= "Content-Disposition: form-data; name=\"$k\"\r\n\r\n{$v}\r\n"; } if ($fn) { $data .= "--".$boundary."\r\n". "Content-Disposition: form-data; name=\"userfile\"; filename=\"$fn\"\r\n". "Content-Type: {$_FILES['userfile']['type']}\r\n". "Content-Transfer-Encoding: binary\r\n\r\n". file_get_contents($_FILES['userfile']['tmp_name'])."\r\n"; } if ($data != "") $data .= "--".$boundary."--\r\n\r\n"; $headers = "POST /go.php?i=$xinbox_login&r=1&mode={$_GET[mode]} HTTP/1.0\r\n". "Host: xinbox.com\r\nContent-Type: multipart/form-data; boundary=". $boundary."\r\nContent-Length: ".strlen($data)."\r\n\r\n"; fwrite($fp, $headers.$data); $m = false; while (!feof($fp)) { $rs=fgets($fp, 1024); if ($m) echo $rs; if (trim($rs)=="") $m=true; } fclose($fp); } else { echo "Error loading contact form. Please try later."; } // XINBOX CONTACT FORM - END ?> |
You can view the form demo at http://www.sixfiles.com/contact.php.
Here is an example showing the minimum amount of code needed to embed a XInbox contact form to your php site:
|
<? header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified ?> <html> <body> <h1> Contact Us </h1> <? // XINBOX CONTACT FORM - BEGIN $xinbox_login = "aklabs"; $data = ""; $fp = fsockopen("xinbox.com",80); if($fp) { $fn = $_FILES['userfile']['name']; srand((double)microtime()*1000000); $boundary = "---------------------------".substr(md5(rand(0,32000)),0,10); foreach($_POST as $k=>$v) { $data .= "--".$boundary."\r\n"; $data .= "Content-Disposition: form-data; name=\"$k\"\r\n\r\n{$v}\r\n"; } if ($fn) { $data .= "--".$boundary."\r\n". "Content-Disposition: form-data; name=\"userfile\"; filename=\"$fn\"\r\n". "Content-Type: {$_FILES['userfile']['type']}\r\n". "Content-Transfer-Encoding: binary\r\n\r\n". file_get_contents($_FILES['userfile']['tmp_name'])."\r\n"; } if ($data != "") $data .= "--".$boundary."--\r\n\r\n"; $headers = "POST /go.php?i=$xinbox_login&r=1&mode={$_GET[mode]} HTTP/1.0\r\n". "Host: xinbox.com\r\nContent-Type: multipart/form-data; boundary=". $boundary."\r\nContent-Length: ".strlen($data)."\r\n\r\n"; fwrite($fp, $headers.$data); $m = false; while (!feof($fp)) { $rs=fgets($fp, 1024); if ($m) echo $rs; if (trim($rs)=="") $m=true; } fclose($fp); } else { echo "Error loading contact form. Please try later."; } // XINBOX CONTACT FORM - END ?> <p>Thank you!</p> </body> </html> |
Here you can find the result: 'Contact us' example.