Jump to content

Travis Estill

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Everything posted by Travis Estill

  1. You could append the parent URL to the query string in JavaScript: [code]<?php $parent = "http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']; ?> window.open("http://www.example.com/?parent=<?php echo urlencode($parent); ?>","mywindow");[/code] Then, on the popup page, grab that GET variable like this: [code]<?php $parent = urldecode($_GET['parent']); ?>[/code]
  2. Hi there, I've noticed this as well. I'm guessing the mail function appends those headers? Perhaps if you connect directly to the SMTP server you can have more control of the headers and get around that. There are some classes to do this at [url=http://www.phpclasses.org/]phpclasses.org[/url]. Travis
  3. Well, I was referring to your database query. Specifically these lines: [code]if($Photos == "")   {   $search_q= $search_q." and m_img.sci_main=1 and m.scm_mem_id = m_img.scm_mem_id";   $search_q_num.=" and m_img.sci_main=1 and m.scm_mem_id = m_img.scm_mem_id";   }[/code] Can you explain what's going on here? It looks like extra restrictions are being placed on the query if the user includes members [i]without[/i] photos in their search. But it seems like only the opposite would make sense.
  4. In the switch block you're using [b]$emailto[/b], but in the mail function you have [b]$EmailTo[/b] instead. Variable names are case-sensitive. Also, it's unnecessary to trim those POST variables more than once.
  5. Are the related SQL image fields indexed? Travis
  6. That [url=http://us2.php.net/manual/en/control-structures.switch.php]switch[/url] block will assign a certain value to $emailto depending on the value of $_POST['emailto']. Switch does basically the same thing as a series of If statements. So, in the example above, if $_POST['emailto'] equals "artem", then $emailto gets set to "artem@gmail.com".
  7. Use the switch construct: [code]switch ($_POST['emailto'])   {   case "artem":       $emailto = "artem@gmail.com";       break;   case "kris":       $emailto = "kris@gmail.com";       break;   default:       die("Missing or invalid recipient");       break;   }[/code] Travis
  8. [!--quoteo(post=388668:date=Jun 27 2006, 05:47 PM:name=melv)--][div class=\'quotetop\']QUOTE(melv @ Jun 27 2006, 05:47 PM) [snapback]388668[/snapback][/div][div class=\'quotemain\'][!--quotec--] I need to compare dates. But this way: I get a date from database. (yyyy-mm-dd format) I need to understand if this date is newer then "6 months" or not. What I need is get the current date, calculate the date 6 months ago, compare "the date from DB" & "the date 6 months ago from now" show the result. How will I do that please? [/quote] Oh, I see. Use strtotime() like this: [code]// Example date $date = "2006-06-04"; $time = strtotime($date); $old = time() - 15778463; /* 6 months ago */ if ($time <= $old)   {   // Date is at least 6 months old   } else if ($time > $old)   {   // Date is less than 6 months old   }[/code]
  9. Retrieve [i]data[/i] from the last 6 months? Assuming you're using timestamps, try this: [code]$query = "SELECT data FROM table WHERE time >= (".time()." - 15778463)";[/code]
  10. You can't really accomplish that with PHP. You need something like a Java applet or Flash that has interaction on the user end. PHP isn't designed to do that.
  11. I'm not familiar with Dreamweaver. Try this in Internet Explorer: 1. Put the following in your address bar (sub in [u]your[/u] [i]username[/i] and [i]password[/i] for the FTP server): ftp://[i]username[/i]:[i]password[/i]@www.funnyemailforwards.com 2. Navigate to "public_html/apex". 3. Right click on the "uploads" folder and choose properties. 4. In the permissions section, check all the boxes, and hit OK. Run your script again.
  12. That "../storage" string was just an example. You'll need a separate folder with proper permissions. For example, create a new folder under that "apex" folder called "uploads". You should then be able to change that new folder's permissions through FTP; change it to "777" (read/write/execute all checked). Now you can write files to that new folder in PHP... [code]// Relative URL with desired folder name and the name of the file on the user's machine $newfile = "uploads/".basename($_FILES['file']['name']); // Attempt to move temporary file to relative URL if (!move_uploaded_file($_FILES['file']['tmp_name'], $newfile))     {     $errorhandler .= "Your file was not uploaded properly.<br />";     $filemanager = false;     $manager = false;     }[/code]
  13. The file types you're accepting are fine. To be on the safe side, you should convert questionable characters in HTML files to ampersand commands (with the htmlspecialchars() function). No telling what kind of code could be injected. It would probably be best to move uploaded files to a different directory like this: [code] if (!move_uploaded_file($_FILES['file']['tmp_name'], "../storage"))     {     $errorhandler .= "Your file was not uploaded properly.<br />";     $filemanager = false;     } [/code] I could probably help you with that last part. What kind of a database are you using? Travis
×
×
  • 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.