<?php require_once('../Connections/telmanik_press.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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 = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "website_info")) {
  $updateSQL = sprintf("UPDATE info SET website=%s WHERE id=%s",
                       GetSQLValueString($_POST['website_link'], "text"),
                       GetSQLValueString($_POST['id'], "int"));

  mysql_select_db($database_telmanik_press, $telmanik_press);
  $Result1 = mysql_query($updateSQL, $telmanik_press) or die(mysql_error());

  $updateGoTo = "success.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}

mysql_select_db($database_telmanik_press, $telmanik_press);
$query_website_info = "SELECT * FROM info";
$website_info = mysql_query($query_website_info, $telmanik_press) or die(mysql_error());
$row_website_info = mysql_fetch_assoc($website_info);
$totalRows_website_info = mysql_num_rows($website_info);
?>
<?php require("assets/wrapper/header.php"); ?>
<div align="center"><div class="mainlayout">
  <p>&nbsp;</p>
 <p><?php echo $translate->__('website info');?></p><form action="<?php echo $editFormAction; ?>" method="POST" name="website_info"> <input type="hidden" name="id" id="id" value="<?php echo $row_website_info['id']; ?>"/>
 <?php echo $translate->__('Website Link: - Must have http://. Depending on your server setup you can have www or no www. Most servers it does not matter.');?><BR />
 <input name="website_link" type="text" value="<?php echo $row_website_info['website']; ?>" size="100" maxlength="255" /><BR />
  <p>&nbsp;</p>
 
 
 <input name="submit" type="submit" value="<?php echo $translate->__('Update');?>" />
 <input type="hidden" name="MM_update" value="website_info" />
 </form>
  <p>&nbsp;</p>
   <p>&nbsp;</p>
</div>
</div>
<?php require("assets/wrapper/footer.php"); ?>
<?php
mysql_free_result($website_info);
?>
