Jump to content

Wolverine68

Members
  • Posts

    83
  • Joined

  • Last visited

    Never

Everything posted by Wolverine68

  1. Yes, I saw that script but didn't understand how to use it. My PHP is not that far advanced. Is there a more basic script I can use or can you break it down and explain how it works?
  2. I pasted a copy of a code that someone shared on another site for forcing downloads. I tested it out for downloading mp3 files. When you click on the link for calling the php code it does prompt you and asks if you want to open or save the file. The file type shows as "mp3" however the file size says 221 bytes. I know that the file is about 20MB. If I click on Save, it prompts me to save to my local hard drive. The "Save as Type" shows up, by default, as HTML document. Why would it do that? This is an mp3 file. Even if I change it to "All Files" and save it as an mp3, it doesn't play. I get an error saying it doesn't recognize the file. Anyone one have a diagnosis? CODE<?php ini_set('session.cache_limiter', ''); header('Expires: Thu, 19 Nov 1981 08:52:00 GMT'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: no-cache'); header("Content-Disposition: disposition-type=attachment; filename=movie.wmv"); readfile("http://www.remotedomain.com/movie.wmv"); <!-- the movie,mp3,mpeg file can be sitting on a remote domain and you just call to it. --> ?> Code for the calling link: CODE<html> <head> <title>Testing Movie Download</title> </head> <body> <a href="/path/to/script.php">Download Movie[/url] <!-- Where script.php is stored on your domain --> </body> </html>
  3. I pasted a copy of a code that someone shared on another site for forcing downloads. I tested it out for downloading mp3 files. When you click on the link for calling the php code it does prompt you and asks if you want to open or save the file. The file type shows as "mp3" however the file size says 221 bytes. I know that the file is about 20MB. If I click on Save, it prompts me to save to my local hard drive. The "Save as Type" shows up, by default, as HTML document. Why would it do that? This is an mp3 file. Even if I change it to "All Files" and save it as an mp3, it doesn't play. I get an error saying it doesn't recognize the file. Anyone one have a diagnosis? CODE<?php ini_set('session.cache_limiter', ''); header('Expires: Thu, 19 Nov 1981 08:52:00 GMT'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: no-cache'); header("Content-Disposition: disposition-type=attachment; filename=movie.wmv"); readfile("http://www.remotedomain.com/movie.wmv"); <!-- the movie,mp3,mpeg file can be sitting on a remote domain and you just call to it. --> ?> Code for the calling link: CODE<html> <head> <title>Testing Movie Download</title> </head> <body> <a href="/path/to/script.php">Download Movie</a> <!-- Where script.php is stored on your domain --> </body> </html>
  4. I'm trying to create a basic form. The user fills in the information and submits. If all the required info is submitted, it gives a thank you message. If not, it gives an error stating what info needs to be submitted. I uploaded the php file to my web server. When trying to view the url via the web, it just give a blank white screen. Here's the coding: <html> <head> <title>Submitting a Form PHP</title> <style type="text/css"> .text { color: #000077; font-weight: bold;} </style> </head> <body bgcolor="#DDDDDD"> <? //Create function to display form when called function display_form() { //Create global variables global $fname; global $lname; global $email; global $age; $theForm=<<<EndForm <form action="$PHP_SELF" method="post"> <table> <tr><td><span class="text">Enter First Name:</span></td><td><input type="text" name="fname" size="20"></td></tr> <tr><td><span class="text">Enter Last Name:</span></td><td><input type="text" name="lname" size="20"></td></tr> <tr><td><span class="text">Enter E-mail Address:</span></td><td><input type="text" name="email" size="20"></td></tr> <tr><td><span class="text">Enter Age:</span></td><td><input type="text" name="age" size="20"></td></tr> <tr><td><input type="submit" value="Submit Information" name="submit"></td></tr> </table> </form> </body> </html> EndForm; return $theForm; } //check if this is the first time form is called if((!$fname) || (!$lname) || (!$email) || (!$age)) { print(display_form($theForm)); exit(); } //Check to make sure required info has been entered if((!$fname) || (!$lname) || (!$email) || (!$age)) { $message=<<<EndMessage <h2 align="center">Error- Your registration cannot be processed because some information was missing or incorrectly entered:</h2> EndMessage; //Display the error print($message); } //Show user what info was missing if(!$fname) { print("Your First name "); } if(!$lname) { print("Your Last name "); } if(!$email) { print("Your e-mail address "); } if (strlen($email) < 7) { print("The e-mail address entered was only " . strlen($email) . " characters in length and needs to be at least 7 "); } if(!strpos($email, "@")) { print("Your e-mail address is missing the @ symbol "); } if(!strpos($email, ".")) { print("Your e-mail address is missing the period "); } if(!$age) { print("Your age "); } if (!is_numeric($age)) { print("Your entry for age must be numeric "); } //Redisplay the form { print("Please make the necessary corrections and resubmit: "); print(display_form($theForm)); } //If all the required info is in there, give a thank you message else { $message=<<<EndMessage <h2>Thank you $fname, your order should be processed within the next 24 hours</h2> EndMessage; print($message); } ?> </body> </html> Please use CODE tags for code.
  5. Thanks Quickstopman, but that didn't fix it.
  6. I'm trying to create a basic form. The user fills in the information and submits. If all the required info is submitted, it gives a thank you message. If not, it gives an error stating what info needs to be submitted. I uploaded the php file to my web server. When trying to view the url via the web, it just give a blank white screen. Here's the coding: <html> <head> <title>Submitting a Form PHP</title> <style type="text/css"> .text { color: #000077; font-weight: bold;} </style> </head> <body bgcolor="#DDDDDD"> <? //Create function to display form when called function display_form() { //Create global variables global $fname; global $lname; global $email; global $age; $theForm=<<<EndForm <form action="$PHP_SELF" method="post"> <table> <tr><td><span class="text">Enter First Name:</span></td><td><input type="text" name="fname" size="20"></td></tr><br> <tr><td><span class="text">Enter Last Name:</span></td><td><input type="text" name="lname" size="20"></td></tr><br> <tr><td><span class="text">Enter E-mail Address:</span></td><td><input type="text" name="email" size="20"></td></tr><br> <tr><td><span class="text">Enter Age:</span></td><td><input type="text" name="age" size="20"></td></tr><br> <tr><td><input type="submit" value="Submit Information" name="submit"></td></tr> </table> </form> </body> </html> EndForm; return $theForm; } //check if this is the first time form is called if((!$fname) || (!$lname) || (!$email) || (!$age)) { print(display_form($theForm)); exit(); } //Check to make sure required info has been entered if((!$fname) || (!$lname) || (!$email) || (!$age)) { $message=<<<EndMessage <h2 align="center">Error- Your registration cannot be processed because some information was missing or incorrectly entered:</h2> EndMessage; //Display the error print($message); } //Show user what info was missing if(!$fname) { print("Your First name<br>"); } if(!$lname) { print("Your Last name<br>"); } if(!$email) { print("Your e-mail address<br>"); } if (strlen($email) < 7) { print("The e-mail address entered was only " . strlen($email) . " characters in length and needs to be at least 7<br>"); } if(!strpos($email, "@")) { print("Your e-mail address is missing the @ symbol<br>"); } if(!strpos($email, ".")) { print("Your e-mail address is missing the period<br>"); } if(!$age) { print("Your age<br>"); } if (!is_numeric($age)) { print("Your entry for age must be numeric<br>"); } //Redisplay the form { print(<b>"Please make the necessary corrections and resubmit:<br>"</b>); print(display_form($theForm)); } //If all the required info is in there, give a thank you message else { $message=<<<EndMessage <h2>Thank you $fname, your order should be processed within the next 24 hours</h2> EndMessage; print($message); } ?> </body> </html>
  7. Do you mean change the "time.php" file to "time.html"?
  8. Hello, I'm trying to display the date and time on a webpage. Here's the code for the PHP file, named "time.php": <html> <body> <?php echo date("m/d/y : h:i:A", timestamp) ?> </body> </html> ************************* I then tried to display it on my html page this way: <p align="center"><?php include("cgi-bin\time.php") ?)</p> ************************* It did not display. Any suggestions? Ken
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.