refiking Posted June 9, 2007 Share Posted June 9, 2007 Here is the message I am getting Parse error: parse error, unexpected $ in /home/ctpwebco/public_html/leads/proc.php on line 374 I only have 373 lines. Here is the code. Am I missing something or is something in the wrong place? Please let me know. <? session_start(); // start session. include 'header.php'; PRINT "<br/>"; PRINT "<br/>"; if(!isset($username) | !isset($password)) { // escape from php mode. ?> <form action="<?=$PHP_SELF?><?if($QUERY_STRING){ echo"?". $QUERY_STRING;}?>" method="POST"> <p align="center">Members only. Please login to access this document.</p> <table align="center" border="0"> <tr> <th> Username: </th> <th> <input type="text" name="username"> </th> </tr> <tr> <th> Password: </th> <th> <input type="password" name="password"> </th> </tr> <tr> <th colspan="2" align="right"> <input type="submit" value="Login"> </form> </th> </tr> </table> </body> </html> <? exit(); } // If all is well so far. session_register("username"); session_register("password"); // register username and password as session variables. // Here you would check the supplied username and password against your database to see if they exist. // For example, a MySQL Query, your method may differ. // Connects to your Database mysql_connect("localhost", "user", "pass") or die(mysql_error()); mysql_select_db("mydb") or die(mysql_error()); $sql = mysql_query("SELECT password FROM Analysts WHERE username = '$username'"); $fetch_em = mysql_fetch_array($sql); $numrows = mysql_num_rows($sql); $state = "FL"; $que = mysql_query("SELECT `analyst_id` FROM `Analysts` WHERE username = '$username'"); while($row = mysql_fetch_assoc($que)){ $analyst_id = $row['analyst_id']; } if($numrows != "0" & $password == $fetch_em["password"]) { $valid_user = 1; } else { $valid_user = 0; } // If the username exists and pass is correct, don't pop up the login code again. // If info can't be found or verified.... if (!($valid_user)) { session_unset(); // Unset session variables. session_destroy(); // End Session we created earlier. // escape from php mode. ?> <form action="<?=$PHP_SELF?><?if($QUERY_STRING){ echo"?". $QUERY_STRING;}?>" method="POST"> <p align="center">Incorrect login information, please try again. You must login to access this document.</p> <table align="center" border="0"> <tr> <th> Username: </th> <th> <input type="text" name="username"> </th> </tr> <tr> <th> Password: </th> <th> <input type="password" name="password"> </th> </tr> <tr> <th colspan="2" align="right"> <input type="submit" value="Login"> </form> </th> </tr> </table> </body> </html> <? exit(); } ?> <?php extract($_POST); /* Validation */ function check_field1($tel) { if(!preg_match("/[^0-9\ ]+$/",$tel)) return TRUE; else return FALSE; } function check_field2($zip) { if(!preg_match("/[^0-9\ ]+$/",$zip)) return TRUE; else return FALSE; } function check_field3($la) { if(!preg_match("/[^0-9]+$/ ",$la)) return TRUE; else return FALSE; } function check_field4($iir) { if(!preg_match("/[^0-9]+$/ ",$iir)) return TRUE; else return FALSE; } function check_field5($adjc) { if(!preg_match("/[^0-9]+$/ ",$adjc)) return TRUE; else return FALSE; } function check_field6($hf) { if(!preg_match("/[^0-9]+$/ ",$hf)) return TRUE; else return FALSE; } function check_field7($ch) { if(!preg_match("/[^0-9]+$/ ",$ch)) return TRUE; else return FALSE; } /* Validation */ $error=0; // check up variable /* get it checking */ if(!check_field1($tel)) { echo "Illegal input " . $tel . " in Telephone Field"; $error++; // $error=$error+1; $tel = ""; } if(!check_field2($zip)) { echo "Illegal input " . $zip . " in Zip Code Field"; $error++; $zip = ""; } if(!check_field3($la)) { echo "Illegal input " . $la . " in Loan Amount Field"; $error++; $la = ""; } if(!check_field4($iir)) { echo "Illegal input " . $iir . " in Initial Interest Rate Field"; $error++; // $error=$error+1; $iir = ""; } if(!check_field5($adjc)) { echo "Illegal input " . $adjc . " in Adjustment Cap Field"; $error++; // $error=$error+1; $adjc = ""; } if(!check_field6($hf)) { echo "Illegal input " . $hf . " in House Front Field"; $error++; // $error=$error+1; $hf = ""; } if(!check_field7($ch)){ echo "Illegal input " . $ch . " in Cyber Homes Field"; $error++; // $error=$error+1; $ch = ""; } if($name = "") { echo "Please enter the Borrower's Last Name"; $error++; } if($bfn = "") { echo "Please enter the Borrower's First Name"; $error++; } if($tel = "") { echo "Please enter a valid telephone number"; $error++; } if($add = "") { echo "Please enter a valid address"; $error++; } if($city = "") { echo "Please enter a valid city"; $error++; if($zip = "") { echo "Please enter a valid zip code"; $error++; } if($la = "") { echo "Please enter the loan amount"; $error++; } if($iir = "") { echo "Please enter the initial interest rate"; $error++; } if($adjc = "") { echo "Please enter the adjustment cap"; $error++; } if($error == 0) { //Adjusted House Front Value $ahf = $hf * 0.95; //Adjusted Cyber Homes Value $ach = $ch * 0.95; //Adjusted Value Undivided $ajv = $ahf + $ach; //Count Number of Values Picked Up IF ($hf < 1) { $chf = 0; } ELSE { $chf = 1; } IF ($ch < 1) { $cch = 0; } ELSE { $cch = 1; } $count = $cch + $chf; //Adjusted Value Divided $adjv = ($ajv) / ($count); $avm = number_format($adjv, 2); //Calculate Home's LTV $ultv = ($la) / ($adjv); $altv = $ultv * 100; $ltv = number_format($altv,2); $irate = $iir *.01; $rate = ($iir *.01) / 12; $r1 = $rate + 1; $r2 = pow($r1,360); $r3 = $rate * $r2; $r4 = $la * $r3; $r5 = $r2 - 1; $mpay = $r4 / $r5; $mopay = number_format($mpay, 2); $mypay = number_format($r4 / $r5, 2); $nr = $iir + $adjc; $nrate = $nr *.01; $nra = $nrate / 12; $nr1 = $nra + 1; $nr2 = pow($nr1, 360); $nr3 = $nra * $nr2; $nr4 = $la * $nr3; $nr5 = $nr2 - 1; $nmpay = $nr4 / $nr5; $nmopay = number_format($nmpay, 2); $chang = ($nmpay) - ($mpay); $change = number_format($chang, 2); $dun = date("Y:m:d H:i"); $date = date("Y:m:d"); $dql = mysql_query("SELECT record_id FROM Records WHERE date_record = '$date'"); $daily = mysql_num_rows($dql); $weekly = mysql_num_rows($dql); }else{ PRINT "<br />"; echo "Number of errors: $error"; PRINT "<br />"; PRINT "You must return and fix the errors listed above."; } $ipaddy = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; $store = "INSERT INTO Records(analyst_id , record_id , b_first_name , b_last_name , c_first_name , c_last_name , address, city , state , zip , loan_amount , rate , cap , mo_pay , new_rate , new_mopay , pay_change , change_date , ltv , lender , telephone , ipaddy , timestamp, date_record) VALUES('$analyst_id','$record_id','$bfn','$name','$cfn','$cln','$add','$city','$state','$zip','$la','$iir', '$adjc','$mpay','$nr','$nmpay','$change','$cpdate','$ltv','$lender','$tel','$ipaddy','$dun','$date')"; mysql_query($store); PRINT "<br />"; PRINT "Total Number of Mortgages Recorded Today: "; PRINT $daily; PRINT "<br><br><br />"; ?> <form action="proc.php" method="post"> Borrower's Last Name: <input type="text" name="name" value="<?php isset($_SESSION['$name'])?$_SESSION['$name']:''; ?>" /><br> Borrower's First Name: <input type="text" name="bfn" value="<?php isset($_SESSION['$bfn'])?$_SESSION['$bfn']:''; ?>" /><br> Co-Borrower's Last Name: <input type="text" name="cln" value="<?php isset($_SESSION['$cln'])?$_SESSION['$cln']:''; ?>" /><br> Co-Borrower's First Name: <input type="text" name="cfn" value="<?php isset($_SESSION['$cfn'])?$_SESSION['$cfn']:''; ?>" /><br> Telephone Number: <input type="text" name="tel" value="<?php isset($_SESSION['$tel'])?$_SESSION['$tel']:''; ?>" /><br> Property Address: <input type="text" name="add" value="<?php isset($_SESSION['$add'])?$_SESSION['$add']:''; ?>" /><br> City: <input type="text" name="city" value="<?php isset($_SESSION['$city'])?$_SESSION['$city']:''; ?>" /><br> Zip Code:<input type="text" name="zip" value="<?php isset($_SESSION['$zip'])?$_SESSION['$zip']:''; ?>" /><br> Lender: <select name="lender" size="1"> <option value="Option One">Option One</option> <option value="New Century">New Century</option> <option value="Fremont">Fremont</option> <option value="Southstar Funding">Southstar Funding</option> </select><br> Date of Payment Change: <select name="cpdate" size="1"> <option value="Jul07">July 1, 2007</option> <option value="Aug07">August 1, 2007</option> <option value="Sep07">September 1, 2007</option> <option value="Oct07">October 1, 2007</option> <option value="Nov07">November 1, 2007</option> <option value="Dec07">December 1, 2007</option> <option value="Jan08">January 1, 2008</option> <option value="Feb08">February 1, 2008</option> <option value="Mar08">March 1, 2008</option> <option value="Apr08">April 1, 2008</option> <option value="May08">May 1, 2008</option> <option value="Jun08">June 1, 2008</option> </select><br> Loan Amount: <input type="text" name="la" value="<?php isset($_SESSION['$la'])?$_SESSION['$la']:''; ?>" /><br> Initial Interest Rate: <input type="text" name="iir" value="<?php isset($_SESSION['$irr'])?$_SESSION['$irr']:''; ?>" /><br> Adjustment Cap: <input type="text" name="adjc" value="<?php isset($_SESSION['$adjc'])?$_SESSION['$adjc']:''; ?>" /><br> House Front: <input type="text" name="hf" value="<?php isset($_SESSION['$hf'])?$_SESSION['$hf']:''; ?>" /><br> Cyber Homes: <input type="text" name="ch" value="<?php isset($_SESSION['$ch'])?$_SESSION['$ch']:''; ?>" /><br> <input type="submit" value="Submit"> </form> Link to comment https://forums.phpfreaks.com/topic/54906-solved-what-am-i-missing/ Share on other sites More sharing options...
AndyB Posted June 9, 2007 Share Posted June 9, 2007 I don't want to wade through the code, but that error means you have an unclosed loop - look for a missing curly brace closer } Indenting your loops makes it so much easier to spot the unclosed ones. Link to comment https://forums.phpfreaks.com/topic/54906-solved-what-am-i-missing/#findComment-271573 Share on other sites More sharing options...
simcoweb Posted June 9, 2007 Share Posted June 9, 2007 This may not be the only error but you're missing an closing } here: if (!($valid_user)) { session_unset(); // Unset session variables. session_destroy(); // End Session we created earlier. // escape from php mode. ?> Link to comment https://forums.phpfreaks.com/topic/54906-solved-what-am-i-missing/#findComment-271574 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.