php -> 5.5.9

My host server was updated to php 5.5.9 (from 5.4.1) and my php form are not working anymore. Do anyone see some errors?


Start ----

<?php
include('userpass.php');
include('config.php');

$user_id = $_SESSION['username'];
$book_id = $_GET['book_id'];
$varsling = $_GET['varsling'];


//echo "$user_id, $book_id, $FormDict";

$cnx =mysql_connect ($db_host ,$db_user ,$db_pass ); 
mysql_select_db ($database ,$cnx );
 

	$err=0;
	$FormDict = $HTTP_GET_VARS;
	
if ($HTTP_POST_VARS['_wss']) {
		$FormDict = $HTTP_POST_VARS;

	}
	$errUrl = 'main.php';
	$thanksUrl = 'main.php';
	if ($FormDict['_wss'] && strlen($FormDict['errMsg']) < 1) {
		mysql_pconnect($db_host, $db_user,$db_pass);
		mysql_select_db($db_user);
		$stmt = "insert into $booking_log_table (user_id, book_id, info, aktiv, varsel) values (";
		$fields = array("user_id", "book_id", "info","aktiv","varsel");
		$checks = array("-:-:-:", "-:-:-:", "-:-:-:", "-:-:-:", "-:-:-:");
		for($i=0; $i < 5; $i++) {
			$val = $FormDict[$fields[$i]];
			$c = preg_split("/:/", $checks[$i]);
			if ((strcmp($c[0], 'r') == 0) && !$val) $err++;
			if (strcmp($c[1], 'l') == 0) $val = strtolower($val);
			if (strcmp($c[1], 'u') == 0) $val = strtoupper($val);
			if ($c[2] && strlen($val) < $c[2]) $err++;
			if ($c[3] && !$c[3]($val)) $err++;
			if ($i > 0) $stmt .= ',';
			$stmt .= "'" . AddSlashes($val) . "'";
		}
		$stmt .= ')';
		$rs = mysql_query($stmt);
		if (0 == $rs) {
			$err++;
			$errUrl = $errUrl . "?errMsg=" . urlencode(mysql_error());
		}
		if ($err)

 
			$thanksUrl = $errUrl;
		header("Location: $thanksUrl?time_open=1");
		exit;
	}
	/* 	This code was generated via MacSQL (available at
		<http://www.rtlabs.com/macsql/>) and is copyright 2003 Runtime Labs, LLC.
		Registered users of MacSQL are granted unlimited right to use
		this code on websites they build. This notice must be included
		with this code.
		
		This code is provided AS IS with no warranty of any kind. 
	*/
	function isInteger($val) {
		return preg_match("/^\d+$/", $val);
	}
	function isAlphaNum($val) {
		return preg_match("/^\w+$/", $val);
	}
	function hasNonAlphaNum($val) {
		return preg_match("/\W/", $val);
	}
	function isCCExpDate($val) {
		$d = preg_split("/\//", $val);
		if (strlen($d[1]) < 7) $d[1] += 2000;
		return (($d[0] > 0) && ($d[0] <= 12) && ($d[1] > 2002) && ($d[1] < 2050));
	}
	function isDate($val) {
		return preg_match("#\d\d?[-/]\d\d?[-/]\d{2,6}#", $val);
	}
?>

Open in new window

<?php //include("config.php") ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $tekstKoding ?>">
		<meta name="generator" content="Lavine WebSystem PHP/MySQL">
		<title>Meld meg p&aring; time</title>

	</head>
                                                 <?php



$sql5 =mysql_query("SELECT navn, book_id FROM $booking_table where book_id = '$book_id'" ) or die ( mysql_error ()); 
while( $row =mysql_fetch_array ($sql5 )) { 

$navnet = $row ['navn' ];

}

?>
<?php echo $navn ?>
	<?PHP if (strlen($Form['errMsg']) > 0) echo($Form['errMsg']);?>
<body background="grafikk/bk.jpg" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td><?php include("heading.php") ?></td>
				</tr>
				<tr>
					<td>
						<form method="get" name="FormName">
							<div align="left">
								<div align="center">
								  <table border="0" cellpadding="2" cellspacing="1" bgcolor="#333333">
								    <tr>
								      <td>
								        <table width="500" border="0" cellspacing="2" cellpadding="2" bgcolor="#f5f5f5">
								          <tr>
								            <td valign="top">
								              <table width="100%" border="0" cellspacing="4" cellpadding="4">
                                                <tr>
                                                  <td><font size="3" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">Meld meg p&aring;: 
                                                  
 </font>
                                                    <hr align="left" noshade size="1" width="100%">                                                  </td>
                                                </tr>
                                              </table>
								              <table width="500" border="0" cellspacing="4" cellpadding="4">
								                <tr>
								                  <td align="right" valign="top"><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b></b></font></td>
											      <td align="left" valign="top"><?php echo $event_id ?></td>
												  </tr>
								                <tr>
								                  <td align="right" valign="top"><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Medlemsnr.:</b></font></td>
								                  <td align="left" valign="top"><input name="user_id" type="hidden" value="<?php echo $user_id ?>" size="30" maxlength="30" border="0"><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><?php echo $user_id ?></font></td>
							                    </tr>
								                <tr>
								                  <td align="right" valign="top"><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Time/Øvelse:</b></font></td>
											      <td align="left" valign="top"><input type="hidden" value="<?php echo $book_id ?>" name="book_id" size="30" maxlength="30" border="0"><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><?php echo $navnet ?></font></td>
											    </tr>
								                <tr>
								                  <td align="right" valign="top"><font size="2" face="Arial"><b>Beskjed:</b></font></td>
								                  <td align="left" valign="top"><textarea name="info" cols="30" rows="5" wrap="virtual"></textarea></td>
							                    </tr>
								                <tr>
								                  <td align="right" valign="top"><font size="2" face="Arial"><b>SMS-varsling:</b></font></td>
								                  <td align="left" valign="middle"><font size="2" face="Arial"><?php if($varsling=='1')$varseltext = "<label><input type=\"radio\" name=\"varsel\" value=\"1\">Ja  <input type=\"radio\" name=\"varsel\" value=\"0\" checked>Nei<br><br>(krever at ditt mobilnummer er registrert)"; else $varseltext = 'Det ser ut til at du får plass på denne treningen.<br><br> Venligst husk å meld deg av om du ikke kan komme!<br>Da vil noen på ventelista få plass!'; echo $varseltext ?>
							                      
								                  </font></td>
							                    </tr>
							                </table>										    </td>
										    </tr>
								          <tr>
								            <td>								              </td>
										    </tr>
								          <tr align="center" valign="middle">
								            <td>
								              <div align="center" valign="middle">
								                <hr align="left" noshade size="1" width="100%">
								                <input type="submit" name="submit" value="Meld meg på denne timen"></div>											  </td>
										    </tr>
								          </table>									    </td>
								      </tr>
								    </table>
								  <input type="hidden" name="_wss" value="1">
								  <input type="hidden" name="_wss" value="1">
							  </div>
							</div>
					  </form>
					</td>
				</tr>
				<tr>
					<td><div align="center"><?php include("footer.php") ?></div></td>
				</tr>
			</table>
		</div>
	</body>

</html>

Open in new window



--- END
Hans Inge HagenOwner and programmerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GaryCommented:
First thing is
HTTP_GET_VARS

...maybe others but enable error reporting so it tells you these problems
0
Ray PaseurCommented:
What is the symptom of failure?

I would suggest to start the debugging process by adding error_reporting(E_ALL) to the top of the scripts.  You might also want to test for the return values from the PHP functions.  For example, consider this.  Both of these functions return values to your PHP script, but the script does not test to see if the return values indicate that the functions actually worked!
$cnx =mysql_connect ($db_host ,$db_user ,$db_pass ); 
mysql_select_db ($database ,$cnx );

Open in new window

0
Hans Inge HagenOwner and programmerAuthor Commented:
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/sporty/www/medlemer/event_booking.php on line 15

Notice: Undefined variable: HTTP_GET_VARS in /home/sporty/www/medlemer/event_booking.php on line 20

Notice: Undefined variable: HTTP_POST_VARS in /home/sporty/www/medlemer/event_booking.php on line 22

Notice: Undefined variable: navn in /home/sporty/www/medlemer/event_booking.php on line 107

Notice: Undefined variable: Form in /home/sporty/www/medlemer/event_booking.php on line 108
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Ray PaseurCommented:
Thanks, that's helpful.  For the HTTP_GET_VARS you can switch over to using $_GET.  Same pattern for POST.
http://php.net/manual/en/reserved.variables.get.php

For the MySQL issues, be aware that PHP is doing away with MySQL support and you will need to switch over to another extension.  This article explains why PHP is doing that and what you must do to keep your scripts running.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/A_11177-PHP-MySQL-Deprecated-as-of-PHP-5-5-0.html
0
Ray PaseurCommented:
$navn and $Form appear to be undefined variables.  Perhaps they are confused with other variable names (like maybe $navnet)?  Unfortunately PHP does not tell you about reliance on an undefined variable unless you raise the error_reporting() level.  Probably the best thing to do is review the program logic and see if you really need these variables.  If so, you'll want to change the scripts to provide the right data for these variables.  If not, you'll also want to change the scripts to remove the reliance.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hans Inge HagenOwner and programmerAuthor Commented:
Thanks a lot, Ray! Im sure I will be able to fix this now. Thanks.
0
Hans Inge HagenOwner and programmerAuthor Commented:
Very good!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.