does the web link I sent you work, the page was originally created using dreamweaver wizards. I then started to modify the code.
Code: Select all
<?php
session_start();
require_once('Connections/wain.php');
require_once('navpubadmin.php');
?>
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<?php
$pubid = $HTTP_GET_VARS['pubid'];
echo $pubid;
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "pub")) {
$updateSQL = sprintf("UPDATE alePubs SET user_id=%s, pub_name=%s, slogan=%s, pub_address1=%s, town=%s, county_id=%s, landlord=%s, telephone=%s, email=%s, website=%s, brewery=%s WHERE pub_id=%s",
GetSQLValueString($HTTP_POST_VARS['user_id'], "int"),
GetSQLValueString($HTTP_POST_VARS['pub_name'], "text"),
GetSQLValueString($HTTP_POST_VARS['slogan'], "text"),
GetSQLValueString($HTTP_POST_VARS['address'], "text"),
GetSQLValueString($HTTP_POST_VARS['town'], "text"),
GetSQLValueString($HTTP_POST_VARS['county'], "text"),
GetSQLValueString($HTTP_POST_VARS['textfield2'], "text"),
GetSQLValueString($HTTP_POST_VARS['telephone'], "text"),
GetSQLValueString($HTTP_POST_VARS['email'], "text"),
GetSQLValueString($HTTP_POST_VARS['website'], "text"),
GetSQLValueString($HTTP_POST_VARS['brewery'], "text"),
GetSQLValueString($HTTP_POST_VARS['pub_id'], "int"));
mysql_select_db($database_wain, $wain);
$Result1 = mysql_query($updateSQL, $wain) or die(mysql_error());
}
if ((isset($HTTP_POST_VARS["MM_update2"])) && ($HTTP_POST_VARS["MM_update2"] == "page1")) {
$updateSQL = sprintf("UPDATE aleMainPage SET userid=%s, about=%s, history=%s, futureplans=%s,title1=%s,title2=%s,title3=%s, picture=%s WHERE pubid=%s",
GetSQLValueString($HTTP_POST_VARS['user_id2'], "int"),
GetSQLValueString($HTTP_POST_VARS['about'], "text"),
GetSQLValueString($HTTP_POST_VARS['history'], "text"),
GetSQLValueString($HTTP_POST_VARS['future'], "text"),
GetSQLValueString($HTTP_POST_VARS['title1'], "text"),
GetSQLValueString($HTTP_POST_VARS['title2'], "text"),
GetSQLValueString($HTTP_POST_VARS['title3'], "text"),
GetSQLValueString($HTTP_POST_VARS['picture'], "text"),
GetSQLValueString($HTTP_POST_VARS['pub_id2'], "int"));
mysql_select_db($database_wain, $wain);
$Result1 = mysql_query($updateSQL, $wain) or die(mysql_error());
// echo $updateSQL;
}
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
echo $HTTP_SESSION_VARS['pubid'];
echo $HTTP_SESSION_VARS['user'];
mysql_select_db($database_wain, $wain);
$query_rstPub = sprintf("SELECT * FROM alePubs WHERE pub_id = '$pubid'");
$rstPub = mysql_query($query_rstPub, $wain) or die(mysql_error());
$row_rstPub = mysql_fetch_assoc($rstPub);
$totalRows_rstPub = mysql_num_rows($rstPub);
mysql_select_db($database_wain, $wain);
$query_rstRegion = "SELECT * FROM aleRegions ORDER BY region_name ASC";
$rstRegion = mysql_query($query_rstRegion, $wain) or die(mysql_error());
$row_rstRegion = mysql_fetch_assoc($rstRegion);
$totalRows_rstRegion = mysql_num_rows($rstRegion);
$colname_rstMainPage = "1";
if (isset($HTTP_SESSION_VARS['pubid'])) {
$colname_rstMainPage = (get_magic_quotes_gpc()) ? $HTTP_SESSION_VARS['pubid'] : addslashes($HTTP_SESSION_VARS['pubid']);
}
mysql_select_db($database_wain, $wain);
$query_rstMainPage = sprintf("SELECT * FROM aleMainPage WHERE pubid = '$pubid'");
$rstMainPage = mysql_query($query_rstMainPage, $wain) or die(mysql_error());
$row_rstMainPage = mysql_fetch_assoc($rstMainPage);
$totalRows_rstMainPage = mysql_num_rows($rstMainPage);
mysql_select_db($database_wain, $wain);
$query_rstAbout = sprintf("SELECT * FROM aleMainPage WHERE pubid = '$pubid'");
$rstAbout = mysql_query($query_rstAbout, $wain) or die(mysql_error());
$row_rstAbout = mysql_fetch_assoc($rstAbout);
$totalRows_rstAbout = mysql_num_rows($rstAbout);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body>
<div id="pubPage1" style="position:absolute; left:157; top:165; width:576px; height:115px; z-index:2">
<form action="<?php echo $editFormAction; ?>" method="POST" name="page1" id="page1">
<table width="533" border="0" cellspacing="2" cellpadding="0">
<tr>
<td colspan="2"><font color="#FF0000" size="3" face="Arial, Helvetica, sans-serif"><strong>Main
Page </strong></font> </td>
<td width="343"><input name="user_id2" type="hidden" id="user_id22" value="<?php echo $row_rstPub['user_id']; ?>">
<input name="pub_id2" type="hidden" id="pub_id22" value="<?php echo $row_rstPub['pub_id']; ?>">
<input name="junkno" type="hidden" id="junkno"> </td>
</tr>
<tr>
<td width="109"><?php echo $HTTP_SESSION_VARS['PubID'];?></td>
<td colspan="2"> </td>
</tr>
<tr>
<td valign="top">Title 1</td>
<td colspan="2"><input name="title1" type="text" size="50" value="<?php echo $row_rstMainPage['title1']; ?>"></td>
</tr>
<tr>
<td valign="top">Content 1</td>
<td colspan="2"><textarea name="about" cols="50" rows="5" id="about"><?php echo $row_rstMainPage['about']; ?></textarea></td>
</tr>
<tr>
<td valign="top">Title 2</td>
<td colspan="2"><input name="title2" type="text" value="<?php echo $row_rstMainPage['title2']; ?>" size="50"></td>
</tr>
<tr>
<td valign="top">Content 2</td>
<td colspan="2"><textarea name="history" cols="50" rows="5" id="history"><?php echo $row_rstMainPage['history']; ?></textarea></td>
</tr>
<tr>
<td valign="top">Title 3</td>
<td colspan="2"><input name="title3" type="text" size="50" value="<?php echo $row_rstMainPage['title3']; ?>"></td>
</tr>
<tr>
<td valign="top">Content 3</td>
<td colspan="2"><textarea name="future" cols="50" rows="5" id="future"><?php echo $row_rstMainPage['futureplans']; ?></textarea></td>
</tr>
<tr>
<td>Main Picture</td>
<td width = "60"><input name="picture" type="text" id="picture" value="<?php echo $row_rstMainPage['picture']; ?>" size="40">
</td><td>
<?php
$Button = '<img src=\'images/'.oales.'.gif\' alt="Add Image" width="30" height="30" border=0>';
// echo $Button;
$ImageType = "Pub";
$url = 'image_upload.php?pubid='.$pubid.'&ImageType='.$ImageType.'';
do_pop_url($url,$Button);
echo '</div></td><td width = "6%"></td></tr><tr></tr></table>';
function do_pop_URL($url,$name)
{
?><a href="javascript:;" onClick="MM_openBrWindow('<?php echo $url;?>','template','width=600,height=300, left=100,top=100')" target="_self">
<?php echo $name; ?>
<?php
}?>
</td>
</tr>
<tr>
<td> </td>
<td colspan="2"><input name="Update2" type="submit" id="Update22" value="Update">
</td>
</tr>
</table>
<input type="hidden" name="MM_update2" value="page1">
</form>
</div>
</body>
</html>
<?php
mysql_free_result($rstPub);
mysql_free_result($rstRegion);
mysql_free_result($rstMainPage);
?>