Jump to content

php script does not execute anymore...


networker1

Recommended Posts

Greetings to all...

 

I am doing an update on a webpage, hosted on an external server, that has a php script in it. While browsing and opening the files through fireftp on my pc in wordpad, suddenly the script stop working. I am not a programmer, but I checked the code and everything looks identical to the time when the script was actually working. Does any one has an idea as to  why this would happen? I figure that a probable cause would be if the ftp re-uploaded as binary the php file. I tried to re-upload as text but it still not working.

 

Thanks in advance!!

Link to comment
Share on other sites

Here is the script code...

 

<?php

include("library.php");

session_start();


if ( $step == "" ) {

//	session_start();
	$_form = "";
	session_register("_form");


	$content = "
	<div class='title'>Purchase flood coverage - Step 1 of 3</div>
	<div class='parrafo'>
	<p style='font-size:1em' >You can purchase flood coverage at any time. There is a 30-day waiting
	period after you've applied and paid the premium before the policy is
	effective, with the following exceptions:

	<li style='font-size:1em' >If the initial purchase of flood insurance is in connection with the making, increasing, extending,
	or  renewing of a loan, there is no waiting period. The coverage
	becomes effective at the time of the loan, provided application and presentment of the premium is made at or prior to loan closing.

	<li style='font-size:1em' >If the initial purchase of flood insurance is made during the one-year period
	following the issuance of a revised flood map for a community, there is a
	one-day waiting period.
	<br><br>
	<a href='apply.php?step=2'><img src='images/go_get_a_quote.gif'  border=0></a>
	</div>
	";
}

if ( $step==2 ) {


	$base[$_form[basement]] = "selected";
	$condo[$_form[condo]] = "selected";
	$bt[$_form[building_type]] = "selected";

	$condo["N"] = "selected";
	$base["N"] = "selected";

	$content = "
	<div class=title>Purchase flood coverage - Step 2 of 3</div>
	<div class='parrafo'>
		<form action='save.php' method='post'>
		<input type=hidden name='session' value='".session_id()."'>
		<table class='formulario' cellspacing='0px'>
			<tr>
				<th colspan=2 align=center>Personal Information</th>
			</tr>
			<tr>
				<td> Insured Name: </td><td><input type=text name=form[insured_name] size=40 value='$_form[insured_name]' onBlur='this.value = upper(this.value);'></td>
			</tr>
			<tr>
				<td> Email: </td><td><input type=text name=form[email] size=30 value='$_form[email]' onBlur='this.value = lower(this.value);'></td>
			</tr>
			<tr>
				<td> Phone Number: </td><td><input type=text name=form[phone] size=30 value='$_form[phone]' onBlur='this.value = upper(this.value);'></td>
			</tr>

			<tr>
				<th colspan=2 align=center>Property Address</th>
			</tr>

			<tr>
				<td> Address: </td><td><textarea name=form[address] cols=40 rows=2 onBlur='this.value= upper(this.value);'>$_form[address]</textarea></td>
			</tr>
			<tr>
				<td> City: </td><td><input type=text name=form[city] size=30 value='$_form[city]'     onBlur='this.value = upper(this.value);'></td>></td>
			</tr>
			<tr>
				<td> State: </td><td><input type=text name=form[state] size=2 value='$_form[state]'     onBlur='this.value = upper(this.value);'></td>
			</tr>
			<tr>
				<td> Zip Code: </td><td><input type=text name=form[zip_code] size=12  value='$_form[zip_code]' onBlur='this.value = upper(this.value);'></td>
			</tr>
		<tr>
			<td> Flood Zone(if available): </td><td><input type=text name=form[flood_zone] size=20 value='$_form[flood_zone]' onBlur='this.value = upper(this.value);' ></td>
		</tr>

			<tr>
				<th colspan=2 align=center>Mailing Address</th>
			</tr>


			<tr>
				<td> Address: </td><td><textarea name=form[mail_address] cols=40 rows=2 onBlur='this.value = upper(this.value);'>$_form[mail_address]</textarea></td>
			</tr>
			<tr>
				<td> City: </td><td><input type=text name=form[mail_city] size=30 value='$_form[mail_city]' onBlur='this.value = upper(this.value);'></td>
			</tr>
			<tr>
				<td> State: </td><td><input type=text name=form[mail_state] size=2 value='$_form[mail_state]' onBlur='this.value = upper(this.value);'></td>
			</tr>
			<tr>
				<td> Zip Code: </td><td><input type=text name=form[mail_zip_code] size=12 value='$_form[mail_zip_code]' onBlur='this.value = upper(this.value);'></td>
			</tr>



			<tr>
				<th colspan=2 align=center>Property Information</th>
			</tr>

			<tr>
				<td> Property Tax ID (If Known) : </td><td><input type=text name=form[property_tax] size=30 value='$_form[property_tax]' onBlur='this.value = upper(this.value);'></td>
			</tr>
			<tr>
				<td> Construction Date: </td><td><input type=text name=form[construction_date] size=30 value='$_form[construction_date]' onBlur='this.value = upper(this.value);'></td>
			</tr>

			<tr>
				<td> Basement : </td>
				<td>
					<select name=form[basement] $ro>
						<option value='Y' $base[Y]>Yes</option>
						<option value='N' $base[N]>No</option>
					</select>
				</td>
			</tr>
			<tr>
				<td> Condo : </td>
				<td>
					<select name=form[condo] $ro>
						<option value='Y' $condo[Y]>Yes</option>
						<option value='N' $condo[N]>No</option>
					</select>
				</td>
			</tr>
			<tr>
				<td> Building Type : </td>
				<td>
					<select name=form[building_type] $ro>
						<option value=1 $bt[1]>Single Family Dwelling</option>
						<option value=2 $bt[2]>2 to 4 Family Dwelling</option>
						<option value=3 $bt[3]>Commercial Property</option>
					</select>
				</td>
			</tr>

			<tr>
				<td> Number of Floors : </td><td><input type=text name=form[floors] size=5 value='$_form[floors]' onBlur='this.value = upper(this.value);'></td>
			</tr>
			<tr>
				<td> Amount Requested for Building: </td><td><input type=text name=form[amount_b] size=10 value='$_form[amount_b]' onBlur='this.value=formatCurrency(this.value);'></td>
			</tr>
			<tr>
				<td> Amount Requested for Contents: </td><td><input type=text name=form[amount_c] size=10 value='$_form[amount_c]' onBlur='this.value=formatCurrency(this.value);'></td>
			</tr>

			<tr>
				<td colspan=2 align=center>
					<input type=submit value='Submit Application'>
				</td>
			</tr>
		</table>
		</form>
	</div>
	";
}


if ( $step == 3 ) {
	$bt[1] = "Single Family Dwelling";
	$bt[2] = "2 to 4 Family Dwelling";
	$bt[3] = "Commercial Property";

	$db = db_connect();

	$result = db_sql( "select * from financial_apps where application_id = $id");
	$row = db_fetch_array( $result );

	if ( session_id() != $row["session"] ) {
		echo "<h1>Security Violation</h1>";
		exit;
	}

	$content = "
	<div class=title>Purchase flood coverage - Step 3/3</div>
	<div class=parrafo>
	<h1>Thank you!</h2>
	<!-- <h1>Application Number : $id </h1> -->
	<p>
	 	Your insurance application was submitted successfully. Please print this page for your records.
	</p>

	<table class=confirm width=600px>
		<tr>
			<th colspan=2 align=left>Personal Information</th>
		</tr>

		<tr>
			<td> Insured Name: </td><td>$row[insured_name]</td>
		</tr>
		<tr>
			<td> Email: </td><td>$row[email]</td>
		</tr>
		<tr>
			<td> Phone Number: </td><td>$row[phone]</td>
		</tr>

		<tr>
			<th colspan=2 align=left>Property Address</th>
		</tr>

		<tr>
			<td> Address: </td><td>".nl2br($row[address])."</td>
		</tr>
		<tr>
			<td> City: </td><td>$row[city]</td>
		</tr>
		<tr>
			<td> State: </td><td>$row[state]</td>
		</tr>
		<tr>
			<td> Zip Code: </td><td>$row[zip_code]</td>
		</tr>";

		if(	$row["flood_zone"] !=''	){
			$content.="		<tr><td> Flood Zone: </td><td>$row[flood_zone]</td></tr>";
		}

		$content.="
		<tr>
			<th colspan=2 align=left>Mailing Address</th>
		</tr>

		<tr>
    			<td> Address: </td><td>".nl2br($row[mail_address])."</td>
		</tr>
		<tr>
    			<td> City: </td><td>$row[mail_city]</td>
		</tr>
		<tr>
			<td> State: </td><td>$row[mail_state]</td>
		</tr>
		<tr>
			<td> Zip Code: </td><td>$row[mail_zip_code]</td>
		</tr>
		<tr>
			<th colspan=2 align=left>Property Information</th>
		</tr>
		<tr>
			<td> Property Tax ID (If Known) : </td><td>$row[property_tax]</td>
		</tr>
		<tr>
			<td> Construction Date: </td><td>$row[construction_date]</td>
		</tr>

		<tr>
			<td> Basement : </td>
			<td>
				$row[basement]
			</td>
		</tr>
		<tr>
			<td> Condo : </td>
			<td>
				$row[condo]
			</td>
		</tr>
		<tr>
			<td> Building Type : </td>
			<td>
				".$bt[$row[building_type]]."
			</td>
		</tr>

		<tr>
			<td> Number of Floors : </td><td>$row[floors]</td>
		</tr>
		<tr>
			<td> Amount Requested for Building: </td><td id='amountba'>$row[amount_b]</td>
		</tr>
		<tr>
			<td> Amount Requested for Contents: </td><td id='amountca'>$row[amount_c]</td>
		</tr>
            <tr>
                <td colspan=2>


                    <a href='index.php'>
                        <div style='    font-size: 1.2em;
                                        width: 8em;
                                        padding: 1em; 
                                        border: 2px outset red; 
                                        font-weight: bold; 
                                        padding-right:20px; 
                                        padding-left: 20px; 
                                        background-color:red;
                                        text-align: center; 
                                        color:white;'>
                            Exit
                        </div>                   
                    </a>
                </td>
            </tr>
	</table>
	</div>
        <br><br><br><br>
        
	<script>
            amountb = document.getElementById('amountba').innerHTML;
            amountc = document.getElementById('amountca').innerHTML;
            
            amountba.innerHTML = formatCurrency(amountb);  
            amountca.innerHTML = formatCurrency(amountc);  

        </script>
        <br><br><br><br>
	";
}

DisplayPage( $content );
?>

 

mod-edit: added CODE tags

Link to comment
Share on other sites

First, please use the CODE button when posting blocks of code. It's the one with the # sign on it on the toolbar when posting.

 

Second, you still didn't answer my questions:

Does it show up as a blank page?

Or is it showing the code as text?

Are you getting a specific error?

Have you looked in your Apache logs for errors?

 

Link to comment
Share on other sites

First thing I notice is that $step isn't declared. Right before this line:

if ( $step == "" ) {

add this:

$step = $_GET['step'];

 

If that doesn't help, I pose the question: What does the URL look like before and after you click the button to go to step 2?

Link to comment
Share on other sites

It is going to the next step - good there... apply.php?step=2

 

but when I fill information it tells me that all fields are required even though all fields are filled up. It should go from there to save.php

 

I tried to post the code for save.php but the forum is giving me the error.

>Not Acceptable

 

>An appropriate representation of the requested resource /forums/index.php could not be found on this server.

 

I took the code out and it let me post..

 

 

Link to comment
Share on other sites

Ok, so you get to step two, you fill out all the fields (Personal Information, Property Address, etc). Then you click 'Submit Application' and it 'tells you' to fill in more fields. Am I following correctly? How does it tell you? Where is the validation (in save.php or in javascript somewhere and you didn't post that)? If you want to post save.php, just use the Additional Options when posting and put it as an attachment.

Link to comment
Share on other sites

Ok...first, it is probably not affecting the script, but you need to start putting quotes around your array keys. So something like this:

$form[insured_name]

should be

$form['insured_name']

Without the quotes is wrong, and should be producing NOTICE errors (although PHP is probably configured to ignore notices)

 

Now the big question. Where is $form getting set? Is something happening in library.php to generate that variable? Try replacing your IF statement with this and let me know what happens:

 

	if ( 	$form['email']  == "" or
		$form['insured_name'] == "" or
		$form['phone'] == "" or
		$form['address'] == "" or
		$form['city'] == "" or
		$form['state'] == "" or
		$form['zip_code'] == "" or
		$form['mail_address'] == "" or
		$form['mail_city'] == "" or
		$form['mail_state'] == "" or
		$form['mail_zip_code'] == "" or
		$form['construction_date'] == "" or
		$form['basement'] == "" or
		$form['condo'] == "" or
		$form['building_type'] == "" or
		$form['floors'] == "" or
		$form['amount_b'] == "" or
		$form['amount_c'] == "" ) {

print_r($form);print_r($_POST);exit;
}

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.