-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
Erm an API would be for use with the software you choose to use! i assume you want to do some web scraping, for pulling data from multiple sites but you really should get permission first, then they may give you a link to an XML or an API!
-
if you only want to send an email then read email() in the manual
-
Show content based on the visitor's physical location.
MadTechie replied to jmbinfo's topic in PHP Coding Help
Okay, to find where a visitor is, its probably best use an IP lookup, eash ISP buy a range of IP address and register them under their name, this includes country, town and city. to get the visitors IP address just use $_SERVER['REMOTE_HOST'] to find the details about that IP, you can use ip2location this is a paid for service, so their will be a cost, their are some free ones (google for IP to city database, or something like that) as a note, you may want to allow the uses to also select their location as a manual override, as the lookup will not always be 100% correct -
okay.. but what do you want it to do ?
-
Check file permissions and make sure your not trying to delete a folder
-
Thumbnail linking to an specific position to a looped <ul>?
MadTechie replied to co.ador's topic in PHP Coding Help
OKay whats the problem your having ? -
Thumbnail linking to an specific position to a looped <ul>?
MadTechie replied to co.ador's topic in PHP Coding Help
Erm.. if thats the full script then wheres $cat being set ? -
Thumbnail linking to an specific position to a looped <ul>?
MadTechie replied to co.ador's topic in PHP Coding Help
Sessions are used for passing from script to script, they are basically server side cookies however, POST + GET are use for getting data from the form! -
Thumbnail linking to an specific position to a looped <ul>?
MadTechie replied to co.ador's topic in PHP Coding Help
can you post both pages in code tags (the # button) and i'll take a look (might have to wait until i leave work ) -
[SOLVED] Need help in removing validation from upload files script
MadTechie replied to agron's topic in Third Party Scripts
if ($_FILES['fileupload']['type'] != "image/jpeg") { unlink($_FILES['fileupload']['tmp_name']); header("Location: fail.html"); exit(); } should be $validfiles = array("image/gif","image/jpeg","image/png","image/jpeg","image/x-png"); if (!in_array($_FILES['fileupload']['type'] ,$validfiles)) { unlink($_FILES['fileupload']['tmp_name']); header("Location: fail.html"); exit(); } -
[SOLVED] Need help in removing validation from upload files script
MadTechie replied to agron's topic in Third Party Scripts
Okay change if ($_FILES['fileupload']['type'] != "image/gif" AND $fileupload_Mime_Type != "image/jpeg" AND $fileupload_Mime_Type != "image/png" ) to $validfiles = array("image/gif","image/jpeg","image/png","image/jpeg","image/x-png"); if (!in_array($_FILES['fileupload']['type'] ,$validfiles)) -
Thumbnail linking to an specific position to a looped <ul>?
MadTechie replied to co.ador's topic in PHP Coding Help
if your using menu2.php then this $uri3 = "example2.php?menu_type=".urlencode($content['Subject']); should be $uri3 = "menu2.php?menu=".urlencode($content['Subject']); -
encoding not start and image not being grabbed
MadTechie replied to mysoogal's topic in PHP Coding Help
Okay.. i am not testing the whole code, YOU need to debug it.. as my setup will be different from yours! when you choose to supplie some useful/requested information i will continue to help! -
[SOLVED] Need help in removing validation from upload files script
MadTechie replied to agron's topic in Third Party Scripts
if ($_FILES['fileupload']['size'] == 0) { to if ($_FILES['fileupload']['size'] == 0 || $_FILES['fileupload']['size'] > 5242880) { note 5000000 would be fine but 5MB in bytes is 5242880 -
Your using POST not GET, and i wouldn't like the idea of passing a password via a URL!
-
[SOLVED] problem pulling data from database? I am sure it is right.
MadTechie replied to daveoffy's topic in PHP Coding Help
change $result = @mysql_query($qry); to $result = mysql_query($qry) or die(mysql_error()); and your see why -
[SOLVED] problem pulling data from database? I am sure it is right.
MadTechie replied to daveoffy's topic in PHP Coding Help
Erm.. whats with the infinitive loop ? while (1) { -
Multiple Emails with different Message Bodys
MadTechie replied to horse1970's topic in PHP Coding Help
check each mail by them selfs i think the first mails header is wrong but you have removed alot so its hard to say try a simple test like this mail('user1@example.com', 'My Subject1', 'hello'); mail('user2@example.com', 'My Subject2', 'world'); but also keep inmind that some hosts block mass mails so you will need to wait a few seconds before sending the next mail! -
[SOLVED] Need help in removing validation from upload files script
MadTechie replied to agron's topic in Third Party Scripts
Okay heres a cleaned up version, it looks fine to me <?php error_reporting(0); // Receiving variables $pfw_ip = $_SERVER['REMOTE_ADDR']; $name = (! empty($_POST['name'])) ? addslashes($_POST['name']) : ""; $companyname = (! empty($_POST['name'])) ? addslashes($_POST['companyname']) : ""; $address = (! empty($_POST['name'])) ? addslashes($_POST['address']) : ""; $city = (! empty($_POST['name'])) ? addslashes($_POST['city']) : ""; $stateprovince = (! empty($_POST['name'])) ? addslashes($_POST['stateprovince']) : ""; $postalzipcode = (! empty($_POST['name'])) ? addslashes($_POST['postalzipcode']) : ""; $country = (! empty($_POST['name'])) ? addslashes($_POST['country']) : ""; $phonenumber = (! empty($_POST['name'])) ? addslashes($_POST['phonenumber']) : ""; $phonenrextention = (! empty($_POST['name'])) ? addslashes($_POST['phonenrextention']) : ""; $contactfax = (! empty($_POST['name'])) ? addslashes($_POST['contactfax']) : ""; $email = (! empty($_POST['name'])) ? addslashes($_POST['email']) : ""; $services = (! empty($_POST['name'])) ? addslashes($_POST['services']) : ""; $servicenotinlistdescription = (! empty($_POST['name'])) ? addslashes($_POST['servicenotinlistdescription']) : ""; $materialtype = (! empty($_POST['name'])) ? addslashes($_POST['materialtype']) : ""; $materialnotinlistdescription = (! empty($_POST['name'])) ? addslashes($_POST['materialnotinlistdescription']) : ""; $dimensionheight = (! empty($_POST['name'])) ? addslashes($_POST['dimensionheight']) : ""; $dimensionswidth = (! empty($_POST['name'])) ? addslashes($_POST['dimensionswidth']) : ""; $dimensionslength = (! empty($_POST['name'])) ? addslashes($_POST['dimensionslength']) : ""; $dimensionsdia = (! empty($_POST['name'])) ? addslashes($_POST['dimensionsdia']) : ""; $additionalcomments = (! empty($_POST['name'])) ? addslashes($_POST['additionalcomments']) : ""; // File Validation if (! empty($_FILES['fileupload']['name'])) { if ($_FILES['fileupload']['size'] == 0) { header("Location: fail.html"); exit(); } if ($_FILES['fileupload']['type'] != "image/jpeg") { unlink($_FILES['fileupload']['tmp_name']); header("Location: fail.html"); exit(); } $uploadFile = "uploads/" . $_FILES['fileupload']['name']; if (! is_dir(dirname($uploadFile))) { @RecursiveMkdir(dirname($uploadFile)); } else { @chmod(dirname($uploadFile), 0777); } @move_uploaded_file($_FILES['fileupload']['tmp_name'], $uploadFile); chmod($uploadFile, 0644); $fileupload_URL = "http://website.com/uploads/" . $_FILES['fileupload']['name']; } else { $fileupload_URL = "No file uploader"; } //Sending Email to form owner $pfw_header = "From: $email\r\nReply-To: $email\r\n"; $pfw_subject = "Service Request"; $pfw_email_to = "email@website.com"; $pfw_message = "Visitor's IP: $pfw_ip\n name: $name\n companyname: $companyname\n address: $address\n city: $city\n stateprovince: $stateprovince\n postalzipcode: $postalzipcode\n country: $country\n phonenumber: $phonenumber\n phonenrextention: $phonenrextention\n contactfax: $contactfax\n email: $email\n services: $services\n servicenotinlistdescription: $servicenotinlistdescription\n materialtype: $materialtype\n materialnotinlistdescription: $materialnotinlistdescription\n fileupload: $fileupload_URL\n dimensionheight: $dimensionheight\n dimensionswidth: $dimensionswidth\n dimensionslength: $dimensionslength\n dimensionsdia: $dimensionsdia\n additionalcomments: $additionalcomments\n"; $sentmail = mail($pfw_email_to, $pfw_subject, $pfw_message, $pfw_header); //Sending auto respond Email to visitor $pfw_header = "From: email@website.com\r\nReply-To: email@webiste.com\r\n"; $pfw_subject = "Service Request"; $pfw_email_to = "$email"; $pfw_message = "Your request has been received. A representative will review your request and call you back with an estimate.\n If you have any questions or concern do not hesitate to call our hotline number at: 111-111-1111\n\n Thank you for your business\n\nBusiness name"; $sentmail = mail($pfw_email_to, $pfw_subject, $pfw_message, $pfw_header); header("Location: success.html"); function RecursiveMkdir ($path) { if (! file_exists($path)) { RecursiveMkdir(dirname($path)); mkdir($path, 0777); } } ?> -
[SOLVED] Need help in removing validation from upload files script
MadTechie replied to agron's topic in Third Party Scripts
try this <?php // Receiving variables @$pfw_ip= $_SERVER['REMOTE_ADDR']; @$name = addslashes($_POST['name']); @$companyname = addslashes($_POST['companyname']); @$address = addslashes($_POST['address']); @$city = addslashes($_POST['city']); @$stateprovince = addslashes($_POST['stateprovince']); @$postalzipcode = addslashes($_POST['postalzipcode']); @$country = addslashes($_POST['country']); @$phonenumber = addslashes($_POST['phonenumber']); @$phonenrextention = addslashes($_POST['phonenrextention']); @$contactfax = addslashes($_POST['contactfax']); @$email = addslashes($_POST['email']); @$services = addslashes($_POST['services']); @$servicenotinlistdescription = addslashes($_POST['servicenotinlistdescription']); @$materialtype = addslashes($_POST['materialtype']); @$materialnotinlistdescription = addslashes($_POST['materialnotinlistdescription']); @$fileupload_Name = $_FILES['fileupload']['name']; @$fileupload_Size = $_FILES['fileupload']['size']; @$fileupload_Temp = $_FILES['fileupload']['tmp_name']; @$fileupload_Mime_Type = $_FILES['fileupload']['type']; @$dimensionheight = addslashes($_POST['dimensionheight']); @$dimensionswidth = addslashes($_POST['dimensionswidth']); @$dimensionslength = addslashes($_POST['dimensionslength']); @$dimensionsdia = addslashes($_POST['dimensionsdia']); @$additionalcomments = addslashes($_POST['additionalcomments']); function RecursiveMkdir($path) { if (!file_exists($path)) { RecursiveMkdir(dirname($path)); mkdir($path, 0777); } } // Validation if(!empty($fileupload_Name)) { if( $fileupload_Size == 0) { header("Location: fail.html"); exit; } if( $fileupload_Mime_Type != "image/jpeg" ) { unlink($fileupload_Temp); header("Location: fail.html"); exit; } $uploadFile = "uploads/".$fileupload_Name ; if (!is_dir(dirname($uploadFile))) { @RecursiveMkdir(dirname($uploadFile)); }else{ @chmod(dirname($uploadFile), 0777); } @move_uploaded_file( $fileupload_Temp , $uploadFile); chmod($uploadFile, 0644); $fileupload_URL = "http://website.com/uploads/".$fileupload_Name ; }else{ $fileupload_URL =""; } //Sending Email to form owner $pfw_header = "From: $email\n" . "Reply-To: $email\n"; $pfw_subject = "Service Request"; $pfw_email_to = "email@website.com"; $pfw_message = "Visitor's IP: $pfw_ip\n" . "name: $name\n" . "companyname: $companyname\n" . "address: $address\n" . "city: $city\n" . "stateprovince: $stateprovince\n" . "postalzipcode: $postalzipcode\n" . "country: $country\n" . "phonenumber: $phonenumber\n" . "phonenrextention: $phonenrextention\n" . "contactfax: $contactfax\n" . "email: $email\n" . "services: $services\n" . "servicenotinlistdescription: $servicenotinlistdescription\n" . "materialtype: $materialtype\n" . "materialnotinlistdescription: $materialnotinlistdescription\n" . "fileupload: $fileupload_URL\n" . "dimensionheight: $dimensionheight\n" . "dimensionswidth: $dimensionswidth\n" . "dimensionslength: $dimensionslength\n" . "dimensionsdia: $dimensionsdia\n" . "additionalcomments: $additionalcomments\n"; @mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ; //Sending auto respond Email to visitor $pfw_header = "From: email@website.com\n" . "Reply-To: email@webiste.com\n"; $pfw_subject = "Service Request"; $pfw_email_to = "$email"; $pfw_message = "Your request has been received. A representative will review your request and call you back with an estimate.\n" . "If you have any questions or concern do not hesitate to call our hotline number at: 111-111-1111\n" . "\n" . "Thank you for your business\n" . "\n" . "Business name"; @mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ; header("Location: success.html"); ?> EDIT: Oh and your welcome, -
They look look identical to me as well so will all do the same thing.. well technically if you used all of them then only the first one will create a cookie if it doesn't exist, the rest would update it .. but if only one of those existed it wouldn't matter which one
-
[SOLVED] Need help in removing validation from upload files script
MadTechie replied to agron's topic in Third Party Scripts
Okay, remove them but add this <?php // Validation if(!empty($fileupload_Name)) { if( $fileupload_Size == 0) { header("Location: fail.html"); exit; } if( $fileupload_Mime_Type != "image/jpeg" ) { unlink($fileupload_Temp); header("Location: fail.html"); exit; } } ?> this check to see if a file was used if it was then checks -
Yes, just pass the input from the form as normal ie <form action="page2.php" method="POST"> <input name="example" type="text"> <input type="submit" value="press"> </form> <?php echo "you submitted: ".$_POST['example']; ?> once thats done and works correctly you need to force the page to download so change it to <?php header("Cache-Control: no-cache"); header("Expires: -1"); header("Content-disposition: attachment; filename=\"myfile.txt\""); //filename header("Content-type: application/octet-stream"); echo "you submitted: ".$_POST['example']; ?> and that should do it *untested*
-
[SOLVED] Need help in removing validation from upload files script
MadTechie replied to agron's topic in Third Party Scripts
remove // Validation if( $fileupload_Size == 0) { header("Location: fail.html"); exit; } and if( $fileupload_Mime_Type != "image/jpeg" ) { unlink($fileupload_Temp); header("Location: fail.html"); exit; } and WOW @ @'s -
try a hard coded version, this works fine on my WAMPSERVER 5 <?php $dl_details['directory'] = "i:/"; //update $dl_details['file_name'] = "activator.iso"; //update $dl_details['size'] =filesize($dl_details['directory'].$dl_details['file_name']); $last_dl_date = date('H:i') . ' on ' . date('d-m-Y'); $last_dl = $dl_details['file_name']; $last_dl_size = $dl_details['size']; $dl_size = $dl_details['size']; $dl_directory = urldecode($dl_details['directory']); $file_dl = urldecode($dl_details['file_name']); $dl_directory .= $dl_details['file_name']; header("Cache-Control: no-cache"); header("Expires: -1"); header("Content-disposition: attachment; filename=\"$file_dl\""); header("Content-type: application/octet-stream"); header("Content-length: $dl_size"); // set the download rate limit (=> 100 = 100 kb/s) $download_rate = 200; if(file_exists($dl_directory) && is_file($dl_directory)) { // flush content flush(); // open file stream $file_op = fopen($dl_directory, "rb"); while(!feof($file_op)) { // send the current file part to the browser print fread($file_op, round($download_rate * 1024)); // flush the content to the browser set_time_limit(0); ob_flush(); flush(); // sleep one second sleep(1); } // close file stream fclose($file_op); exit; }else{ die('Error: The file '.$dl_directory.' does not exist!'); } ?>