please help! - basic php - asp conversion needed..

Discussion in 'C#' started by new2coding, Jan 25, 2006.

  1. #1
    Hi There,

    I am just wandering if any of you lot can help me with this request, I am up against a deadline and have been up for hours trying to get this to work.

    The form was working fine, but the server I am publishing the site to has changed someting (maybe php version) and the flash form I have on all the pages no longer works... I have been advised to do it in ASP instead of PHP.

    The flash movie sends the variables to the php form which sends the information to the email address I have specified in the php form.

    I basically need an ASP version of the following PHP mailform.. Can anyone help me with the conversion? - it would be greatly appriciated, as I have gone as far as I can and am really stuck.

    Here is the PHP code:

    	<?  
    	
    	$adminaddress = "steve@digimodus.com"; 
    	$siteaddress ="http://www.mountstar.com    http://www.scrap-metal.info     http://www.plastic-recycling.info"; 
    	$sitename = "Mountstar"; 
    	
    	//No need to change anything below ... 
    	// Gets the date and time from your server
    	$date = date("m/d/Y H:i:s");
    	
    	// Gets the IP Address
    	if ($REMOTE_ADDR == "") $ip = "no ip";
    	else $ip = getHostByAddr($REMOTE_ADDR);
    	
    	// Gets the POST Headers - the Flash variables
    	$action = $HTTP_POST_VARS['action'] ;
    	$email = $HTTP_POST_VARS['email'] ;
    	$name = $HTTP_POST_VARS['name'] ;
    	$company_name = $HTTP_POST_VARS['company_name'] ;
    	$telephone = $HTTP_POST_VARS['telephone'] ;
    	$comments = $HTTP_POST_VARS['comments'] ;
    	$dropdown = $HTTP_POST_VARS['hear'] ;
    	
    	//Process the form data!
    	// and send the information collected in the Flash form to Your nominated email address
    	
    	if ($action == "send") {
    	
    	
    		//SEND 1st MAIL TO ADMIN
    		mail ("steve@digimodus.com","Brookside/About page enquiry",
    		"A visitor at $sitename has sent the following information\n
    		Name: $name 
    		Company Name: $company_name
    		Telephone Number: $telephone
    		Email: $email\n
    		The visitor commented:
    		------------------------------
    		$comments
    		$dropdown
    		
    		Logged Info :
    		------------------------------
    		Using: $HTTP_USER_AGENT
    		Hostname: $ip
    		IP address: $REMOTE_ADDR
    		Date/Time:  $date","FROM: steve@digimodus.comm" ) ; 
    		
    		
    		//SEND 2ND MAIL TO ADMIN
    		mail ("steve@thewaystudio.com","Brookside/About page enquiry",
    		"A visitor at $sitename has sent the following information\n
    		Name: $name 
    		Company Name: $company_name
    		Telephone Number: $telephone
    		Email: $email\n
    		The visitor commented:
    		------------------------------
    		$comments
    		$dropdown
    		
    		Logged Info :
    		------------------------------
    		Using: $HTTP_USER_AGENT
    		Hostname: $ip
    		IP address: $REMOTE_ADDR
    		Date/Time:  $date","FROM: steve@thewaystudio.com" ) ; 
    		
    		
    		
    		
    	mail ("$email","Thank You for visiting the Mountstar Website", 
    		"Hi $name,\n
    		Thank you for your interest in Mountstar's products and/or services.\n
    		We have received your enquiry and will respond within 8 business working hours.
    		
    		$sitename
    		
    		$siteaddress","FROM: traders@brooksidemetal.com") ; 
    		
    		//Confirmation is sent back to the Flash form that the process is complete
    		$sendresult = "Thank you. You will receive a confirmation email shortly.";
    		$send_answer = "answer=";
    		$send_answer .= rawurlencode($sendresult);
    		echo $send_answer;
    	} //
    	
    	
    	?>
    	
    
    HTML:


    Hopefully if I get this converted, all I will have to do is change the code on the flash frame to point to an ASP file instead of a PHP one like so..

    mailVar.sendAndLoad("b-about.asp", mailVar, "POST");
    mailVar.onLoad = function() {
    _root.comments = "Form Submitted, Thank you.";
    _root.name = "";
    _root.company_name = "";
    _root.telephone = "";
    _root.email = "";
    _root.howmany = "please state";
    gotoAndPlay("clearNgo");

    Many thanks in advance....


    Steve
     
    new2coding, Jan 25, 2006 IP
  2. new2coding

    new2coding Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I have been this mailform with my flash site for a while (PHP 4.4.1) , but now when I try the same mailform on another server running PHP 5, It wont send the emails !

    do I need to update the code to allow this to run on PHP 5?

    If anyone can help me get to the bottom of this - I will be eternally grateful.
    I could always ask the new host to downgrade to the version that worked (PHP 4.4.1) - but I'm not that confident I can get them to do that...

    I also tried directing the link in flash code to the mailform on the old server, but this doesn't allow external scripting on a different server - so I need to try and get this mailform working on the new server... any ideas?
     
    new2coding, Jan 26, 2006 IP
  3. neterslandreau

    neterslandreau Peon

    Messages:
    279
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Check to insure the register_long_arrays is on in the php.ini file. Out of the box, this is off. You may be able to set this value in the .htaccess file:
    
    php_value 'register_long_arrays' 'On'
    
    Code (markup):
    If this doesn't work, ask your host to change the value in the php.ini file.
     
    neterslandreau, Jan 27, 2006 IP