www.webdeveloper.com
Results 1 to 4 of 4

Thread: Basic Form Processor for Windows Server

  1. #1
    Join Date
    Apr 2007
    Posts
    21

    Exclamation Basic Form Processor for Windows Server

    Hi I have a linux server and I have found that the PHP script I use is not commpatible with the Windows server I need to upload a file on. I need a basic form processor for 4 text fields and 1 text areas that works well with Windows NT. Thanks in advance.

  2. #2
    Join Date
    Jun 2003
    Location
    here
    Posts
    4,551
    it's proberly more likly to be paths causing the confliction than anything else, replace the / in linux paths with \\ for windows paths and it should work again.

    if your going to be switching a lot you may want to make a new variable called something like $lash, test if the servers linux or windows, and assign acordingly(which is what I've done for some customers) :P
    PHP Code:
    if(is_dir("/")){//checks if / is a valid directory,
                 // in linux it always is, rarely so in windows.
      
    $lash "/";
    }else{
      
    $lash="\\";
    }; 

  3. #3
    Join Date
    Mar 2006
    Location
    California
    Posts
    306
    Quote Originally Posted by scragar
    it's proberly more likly to be paths causing the confliction than anything else, replace the / in linux paths with \\ for windows paths and it should work again.

    if your going to be switching a lot you may want to make a new variable called something like $lash, test if the servers linux or windows, and assign acordingly(which is what I've done for some customers) :P
    PHP Code:
    if(is_dir("/")){//checks if / is a valid directory,
                 // in linux it always is, rarely so in windows.
      
    $lash "/";
    }else{
      
    $lash="\\";
    }; 
    '/' still comes up as a drectory under Windows as well. And for the solution you posted, you can just use the constant DIRECTORY_SEPARATOR. However, using a foward-slash with PHP running in Windows should still work.

    So, we can't know how to make your script work without seeing it...

  4. #4
    Join Date
    Apr 2007
    Posts
    21

    Here is the script

    Thanks guys, here is the script:

    PHP Code:
    <?php
    include("global.inc.php");
    $errors=0;
    $error="The following errors occured while processing your form input.<ul>";
    pt_register('POST','Name');
    pt_register('POST','StreetAddress');
    pt_register('POST','City');
    pt_register('POST','StateandorPostalCode');
    pt_register('POST','Email');
    pt_register('POST','Comments');
    $Comments=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />"$Comments);if($errors==1) echo $error;
    else{
    $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
    $message="Name: ".$Name."
    Street Address: "
    .$StreetAddress."
    City: "
    .$City."
    State and or Postal Code: "
    .$StateandorPostalCode."
    Email: "
    .$Email."
    Comments: "
    .$Comments."
    "
    ;
    $message stripslashes($message);
    mail("youremail@email.com","Form Submitted at your website",$message,"From: phpFormGenerator");

    header("Refresh: 0;url=http://www.google.com");
    ?><?php 
    }
    ?>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles