Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2009
    Posts
    70

    PHP processing working on local machine not on live server

    Hi guys,

    I've made a contact us form that uses a PHP form processor. It works fine on my local machine but when I upload it to my server, it hangs on the processor (form-processor.php) page.

    Any ideas why this might be? Any tips would be appreciated.

    Thanks in advance,

    Brendan.

  2. #2
    Join Date
    Feb 2006
    Location
    Kusadasi, Turkey
    Posts
    3,273
    It would help to see the code.
    Fraud Record - Stop Fraud Clients, Report Abusive Customers.
    █ Combine your efforts to fight misbehaving clients.

    HarzemDesign - Highest quality, well designed and carefully coded hosting designs. Not cheap though.
    █ Large and awesome portfolio, just visit and see!

  3. #3
    Turn on error reporting,

    add
    Code:
    error_reporting(E_ALL);
    near the beginning of your code. Also as much as I hate to say this, use IE to test. Sometimes FF does not display php errors.
    ZZ Servers - Business Hosting, HIPAA and PCI Compliant Hosting Solutions - http://www.zzservers.com
    Xen Virtual Private Servers | Dedicated Servers | Shared Hosting
    Custom configurations, firewall, VPN, load balancers, private networks and more.

  4. #4
    sounds like an error in your code.

  5. #5
    Join Date
    Jul 2009
    Posts
    70
    Hi guys,

    Thanks for your feedback. Here's my code for the form-processing.php file.
    Code:
    <?php
    /* $sendto is the email where form results are sent to */
       $sendto = "[email protected]";
    
    /* $ccto is the email where form results can be carbon copied to */
       $ccto = "";
    
    $report_errors = "NONE";
    
    
    $setokurl = "0";
    
    $okurls = "";
    
    $footer = "<br><br><br><br><br><center><font face=\"Arial\"><a href=\"http://www.noviceform.com/\" target=\"_blank\"><font color=\"#ff0000\">Form processing script provided by Novice Form</font></a> </center></font>";
    
    $backbutton = "<br><br><b>Hit your browsers back button and resubmit the form.</b>";
    
    
    if ($report_errors == "NONE") {
    error_reporting(0);
    }else{
    error_reporting(E_ALL);
    }
    
    
    /* --- I F   S E T   O K   U R L   = 1  ----- */
    
    	if ($setokurl == "1"){
    
      $found_url = "0";
      $referer =$_SERVER["HTTP_REFERER"];
      $referer = str_replace("://", "[CS]", $referer);
      $referer_sp = explode("/", $referer);
      $referer = "$referer_sp[0]";
      $referer .= "/";
      $referer = str_replace("[CS]", "://", $referer);
      $referer = strtolower($referer);
    
      $okurls = split(",", $okurls);
    
    foreach ($okurls as $myokurls) {
    
    $myokurls = strtolower($myokurls);
    
         if ($referer == strtolower($myokurls)) { 
          $found_url = "1"; 
          }
    
      }
    
      if ($found_url == "0") {
      $ERROR_action = "bad_okurl";
      include("$PATH_error$PAGE_error");
      }
    
    	}
    /* --- E N D   I F   S E T   O K   U R L   = 1  --- */
    
    
    
    /* check to see if posted */
    if ($HTTP_GET_VARS || ! $HTTP_POST_VARS || $_GET || ! $_POST) {
    include("nverror.php");
    no_pst();
    
    }else{
    
    
     /* IF OLDER VERSION OF PHP CONVERT TO NEWER VARIABLES */
    	if (! $_POST) {
    	$_POST = "$HTTP_POST_VARS";
    	}
    
    	if (! $_SERVER) {
    	$_SERVER = "$HTTP_SERVER_VARS";
    	}
    
    
    $year = date("Y");
    $month = date("m");
    $day = date("d");
    $hour = date("h");
    $min = date("i");
    $tod = date("a");
    
    
    $ip=$_SERVER["REMOTE_ADDR"];
    
    $SEND_prnt = "The form below was submited by " . $_POST{"email"} . " from Ip address: $ip on $monthnameactual $month/$day/$year at $hour:$min $tod \n";
    $SEND_prnt .= "-------------------------------------------------------------------------\n\n";
    
    
    /* CHECK TO SEE IF $_POST{"required"} IS SET */
    if ($_POST{"required"}){
    
    
      $post_required = $_POST{"required"};
      $required = split(",", $post_required);
      $reqnum = count($required);
    
    	for ($req=0; $req < $reqnum; $req++) {
    
    	$REQ_name = $required[$req];
    	$REQ_value = $POST{"$REQ_name"};
    
    
      if ($REQ_name == "email") {
         $goodem = ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$", $_POST{"email"}, $trashed);
    
            if (! $goodem) {
    	include("nverror.php");
    	msng_email();
            }  /* end ! $goodem */
    
      }
      elseif (! $_POST{"$REQ_name"}) {
     		 $isreqe = "1";
     		 $REQ_error .= "<li> $REQ_name ";
      		 } /* end ! req val */
    
              } /* end REQ for loop  */
    
    
                    /* IF THERE ARE ANY REQUIRED FIELDS NOT FILLED IN */
    
    		if ($isreqe == "1") {
    		include("nverror.php");
    		msng_required();
    		}
    
    
    } /* END CHECK TO SEE IF $_POST{"required"} IS SET */
    
    
    /* END IF THERE ARE ANY REQUIRED FIELDS NOT FILLED IN */
    
    
    /* GET POSTED VARIABLES */
    
    
    foreach ($_POST as $NVPOST_name => $NVPOST_value) {
    
    $NVPOST_value = str_replace("\n", "", $NVPOST_value);
    $NVPOST_value = str_replace("\r", "", $NVPOST_value);
    
    $NVPOST_value = preg_replace("'\cc:'si", "Cc ", $NVPOST_value);
    $NVPOST_value = preg_replace("'\bcc:'si", "bcc ", $NVPOST_value);
    $NVPOST_value = preg_replace("'\to:'si", "to ", $NVPOST_value);
    $NVPOST_value = preg_replace("'\bc:'si", "bc ", $NVPOST_value);
    
    
    
    	if (strtolower($NVPOST_name) == "subject") {
    
    	$NVPOST_value = str_replace(":", ";", $NVPOST_value);
    	}
    
    
                /* G E T   E M A I L */
           
                if (strtolower($NVPOST_name) == "email") {
                $SEND_email = "$NVPOST_value";
    	    $SEND_email = str_replace(":", "", $SEND_email);
    	    $SEND_email = str_replace(" ", "", $SEND_email);
                }
    
                /* END GET LEADS EMAIL */
     
       if (! $_POST{"sort"}) {
    
    
                                /* CHECK TO SEE IF CONFIG FIELD */
                                if ($NVPOST_name == "subject" || $NVPOST_name == "sort" || $NVPOST_name == "required" || $NVPOST_name == "success_page"){}else{
                                $SEND_prnt .= "$NVPOST_name;  $NVPOST_value \n";
                                }
       } /* end ! sort */
      
    
    } /* end foreach */
    
    
      /* END GET POSTED VARIABLES */
    
    
    
    
      if ($_POST{"sort"}) {
    
      /* SORT VARIABLES */
    
    	$sortvars = split(",", $_POST{"sort"});
    	$sortnum = count($sortvars);
    
                   for ($num=0; $num < $sortnum; $num++) {
    	       $SEND_prnt .= "$sortvars[$num]: " . $_POST{"$sortvars[$num]"} . " \n";
    	       }
    
      }   /* END SORT VARIABLES */
    
    
    
    
    /* send mail */
    
    
    if (! $ccto) {
    $header = "From: $SEND_email\r\nReply-to: $SEND_email";
    }else{
    $header = "From: $SEND_email\r\nReply-to: $SEND_email\r\nCc: $ccto";
    }
    
    
    mail($sendto, $_POST{"subject"}, $SEND_prnt, $header);
    
    /* END sendmail */
    
         /* CHECK TO SEE IF FORM SPECIFYS A SUCCESS PAGE */
         if (! $_POST{"success_page"}) {
    
    include("nverror.php");
    default_success();
    
         }else{
         $successpage=$_POST{"success_page"};
         header("Location: $successpage");  /* redirect */  
         exit;
         }
    
    
    
    } /* END IF POSTED */
    
    
    ?>
    This is a link to my info.php file so you can see the configuration. I've used this script on many many sites before without a hitch.

    Any help would be appreciated.

    Thanks.

Similar Threads

  1. how to upload a file from local machine to server?
    By graham262 in forum Programming Discussion
    Replies: 5
    Last Post: 07-26-2005, 11:42 PM
  2. Server monitoring from local machine !!!
    By atul in forum Hosting Security and Technology
    Replies: 13
    Last Post: 09-15-2004, 03:25 PM
  3. Server status report from local machine !!! Help needed
    By atul in forum Hosting Security and Technology
    Replies: 1
    Last Post: 07-27-2004, 03:07 AM
  4. Code works on local machine but not server.
    By JeremyL in forum Dedicated Server
    Replies: 7
    Last Post: 09-24-2001, 01:42 PM

Posting Permissions

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