How to change from Register_Globals=on to off
Moderator: General Moderators
-
Maluendaster
- Forum Contributor
- Posts: 124
- Joined: Fri Feb 25, 2005 1:14 pm
How to change from Register_Globals=on to off
hey all, i want to change a script that requeries the register_globals=on , but my hosting service just change to register_globals=on to off... What do i have to change in order to work???
-
Maluendaster
- Forum Contributor
- Posts: 124
- Joined: Fri Feb 25, 2005 1:14 pm
Code: Select all
<?
require 'secure.php';
require 'global.php';
require 'config/config.php';
// process and store data
if($stock) {
//check to see if the stock number entered already exists in db
$link = mysql_connect($dbhost, $dbuser, $dbpass);
$query = "SELECT id FROM $dbvin WHERE stock='$stock'";
$result = mysql_db_query($dbname, $query, $link);
if(mysql_num_rows($result)) {
echo "<script language='JavaScript'> alert('The stock number you entered already exists in the database.'); </script>";
// } else {
// make input query friendly
// foreach($_POST as $key => $value) {
// $_POST[$key] = addslashes($value);
// }
// add listing to database
$time = time();
$ccode = substr(time().rand(10000,99999),-15);
$link = mysql_connect($dbhost, $dbuser, $dbpass);
$query = "INSERT INTO $dbvin VALUES('0',
'$ccode',
'$time',
'$time',
'0',
'0',
'$_POST[stock]',
'$_POST[vin]',
'$_POST[year]',
'$_POST[make]',
'$_POST[model]',
'$_POST[condition]',
'$_POST[category]',
'$_POST[mileage]',
'$_POST[price]',
'$_POST[exterior]',
'$_POST[interior]',
'$_POST[body]',
'$_POST[doors]',
'$_POST[engine]',
'$_POST[fuel]',
'$_POST[trans]',
'$_POST[stereo]',
'$_POST[comments]'
)";
mysql_db_query($dbname, $query, $link);
mysql_close($link);
echo "<script language='JavaScript'> window.location='summary.php?ccode=$ccode'; </script>";
echo "You added a vehicle";
exit();
}
}
?>
<html>
<head>
<title>autoBoss Control Panel - Add Vehicle Listing</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/default.css" rel="stylesheet" type="text/css">
<script language='JavaScript' src='functions.js'></script>
</head>
<body>
<table class='trim' width=700 border=0 cellpadding=3 cellspacing=0>
<form action='<?=$PHP_SELF?>' method=post onSubmit='return checkrequired(this)'>
<tr><td class='highlight' align='center' colspan=4><b>Add Vehicle Listing</b></td></td></tr>
<tr class='fill'><td height=1 colspan=4><!-- LINE --></td></tr>
<tr><td class='hint' colspan=4>
Use this form to add a new vehicle to your online inventory. Once you have added the vehicle listing to your online inventory
you will be able to upload images to accompany the listing, as well as edit and remove the listing.<br><br>
</td></tr>
<tr><td class='highlight' colspan=2><b>Required Information</b></td><td class='highlight' colspan=2><b>Optional Information</b></td></tr>
<tr class='fill'><td height=1 colspan=4><!-- LINE --></td></tr>
<tr>
<td width=80 class='text'>Catalitico</td>
<td width=270><input class='text' type=text name='stock' value='<?=$stock?>' style='width:150px' alt='required' maxlength=20 tabindex='1'> <img src='common/arrow_left.jpg' align='absmiddle'></td>
<td width=80 class='text'>Exterior Color</td>
<td width=270><input class='text' type=text name='exterior' value='<?=$exterior?>' style='width:150px' maxlength=30 tabindex='10'></td>
</tr>
<tr>
<td class='text'>Papeles</td>
<td><input class='text' type=text name='vin' value='<?=$vin?>' style='width:150px' alt='required' maxlength=30 tabindex='2'> <img src='common/arrow_left.jpg' align='absmiddle'></td>
<td class='text'>Interior Color</td>
<td><input class='text' type=text name='interior' value='<?=$interior?>' style='width:150px' maxlength=30 tabindex='11'></td>
</tr>
<tr>
<td class='text'>Year</td>
<td><input class='text' type=text name='year' value='<?=$year?>' style='width:50px' maxlength=4 alt='required' tabindex='3'> <img src='common/arrow_left.jpg' align='absmiddle'> <font class='hint'>(2004)</font></td>
<td class='text'>Body Style</td>
<td><input class='text' type=text name='body' value='<?=$body?>' style='width:150px' maxlength=20 tabindex='12'> <font class='hint'>(Coupe)</font></td>
</tr>
<tr>
<td class='text'>Make</td>
<td>
<select class='text' name='make' alt='required' style='width:150px' tabindex='4'>
<option value='<?=$make?>'><?=$make?></option>
<? for ($n = 0; $n < count($mset); $n++) { echo "<option value='$mset[$n]'>$mset[$n]</option>"; } ?>
</select>
<img src='common/arrow_left.jpg' align='absmiddle'>
</td>
<td class='text'>Doors</td>
<td><input class='text' type=text name='doors' value='<?=$doors?>' style='width:50px' maxlength=1 tabindex='13'> <font class='hint'>(2, 4)</font></td>
</tr>
<tr>
<td class='text'>Model</td>
<td><input class='text' type=text name='model' value='<?=$model?>' style='width:150px' alt='required' maxlength=30 tabindex='5'> <img src='common/arrow_left.jpg' align='absmiddle'></td>
<td class='text'>Engine</td>
<td><input class='text' type=text name='engine' value='<?=$engine?>' style='width:150px' maxlength=40 tabindex='14'> <font class='hint'>(6 Cylinder)</font></td>
</tr>
<tr>
<td class='text'>Condition</td>
<td>
<select class='text' name='condition' alt='required' style='width:150px' tabindex='6'>
<option value='<?=$condition?>'><?=$condition?></option>
<option value='New'>New</option>
<option value='Used'>Used</option>
</select>
<img src='common/arrow_left.jpg' align='absmiddle'>
</td>
<td class='text'>Fuel Type</td>
<td><input class='text' type=text name='fuel' value='<?=$fuel?>' style='width:150px' maxlength=20 tabindex='15'> <font class='hint'>(Gasoline)</font></td>
</tr>
<tr>
<td class='text'>Category</td>
<td>
<select class='text' name='category' alt='required' style='width:150px' tabindex='7'>
<option value='<?=$category?>'><?=$category?></option>
<? for ($n = 0; $n < count($cset); $n++) { echo "<option value='$cset[$n]'>$cset[$n]</option>"; } ?>
</select>
<img src='common/arrow_left.jpg' align='absmiddle'>
</td>
<td class='text'>Transmission</td>
<td><input class='text' type=text name='trans' value='<?=$trans?>' style='width:150px' maxlength=20 tabindex='16'> <font class='hint'>(Automatic)</font></td>
</tr>
<tr>
<td class='text'>Mileage</td>
<td><input class='text' type=text name='mileage' value='<?=$mileage?>' style='width:150px' alt='required' maxlength=9 tabindex='8'> <img src='common/arrow_left.jpg' align='absmiddle'></td>
<td class='text'>Stereo</td>
<td><input class='text' type=text name='stereo' value='<?=$stereo?>' style='width:150px' maxlength=40 tabindex='17'></td>
</tr>
<tr>
<td class='text'>Price</td>
<td><input class='text' type=text name='price' value='<?=$price?>' style='width:150px' alt='required' maxlength=15 tabindex='9'> <img src='common/arrow_left.jpg' align='absmiddle'></td>
</tr>
<tr>
<td class='text'>Comments</td>
<td colspan=3><br><textarea class='text' name='comments' style='width:507; height:50' tabindex='18'><?=$comments?></textarea><br><br></td>
</tr>
<tr class='fill'><td height=1 colspan=4><!-- LINE --></td></tr>
<tr>
<td align='center' colspan=4>
<input class='text' type=button value='Cancel' onClick="window.location='cpanel.php';">
<input class='text' type=submit value='Add Listing' tabindex='19'>
</td>
</tr>
</form>
</table>
<table width=700 border=0 cellpadding=5 cellspacing=0><tr><td align='center'><? require 'footer.php'; ?></td></tr></table>
</body>
</html>feyd | Please review how to post code using
Code: Select all
andCode: Select all
tags. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
- compile a list of all the field names.
- make the names to an array.
- use a foreach or similar looping control to look through $_POST for each of those names using the following
Code: Select all
// ... your loop start $$fieldname = (isset($_POST[$fieldname]) ? $_POST['fieldname'] : ''); // ... end of your loop