<?php session_start(); ?>
<?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;
}
}

mysql_select_db($database_telmanik_press, $telmanik_press);
$query_selectpopu = "SELECT * FROM pages";
$selectpopu = mysql_query($query_selectpopu, $telmanik_press) or die(mysql_error());
$row_selectpopu = mysql_fetch_assoc($selectpopu);
$totalRows_selectpopu = mysql_num_rows($selectpopu);
$query_selectpopu = "SELECT * FROM pages";
$selectpopu = mysql_query($query_selectpopu, $telmanik_press) or die(mysql_error());
$row_selectpopu = mysql_fetch_assoc($selectpopu);
$totalRows_selectpopu = mysql_num_rows($selectpopu);

$colname_displaystory = "-1";
if (isset($_POST['select'])) {
  $colname_displaystory = $_POST['select'];
}
mysql_select_db($database_telmanik_press, $telmanik_press);
$query_displaystory = sprintf("SELECT * FROM content WHERE page_name = %s", GetSQLValueString($colname_displaystory, "text"));
$displaystory = mysql_query($query_displaystory, $telmanik_press) or die(mysql_error());
$row_displaystory = mysql_fetch_assoc($displaystory);
$totalRows_displaystory = mysql_num_rows($displaystory);
?>
<?php require("assets/wrapper/header.php"); ?>

<script type="text/javascript" src="ckeditor.js"></script>
	<script src="sample.js" type="text/javascript"></script>


<div id="editload">
<form id="form1" name="form1" method="post" action="">
  <p>
    <label for="select"></label>
    <div id="edithead"><select name="select" id="select" onchange="form1.submit()">
      <option value=""><?php echo $translate->__('Select Page');?></option>
      <?php
do {  
?>
      <option value="<?php echo $row_selectpopu['page_name']?>"><?php echo $row_selectpopu['page_name']?></option>
      <?php
} while ($row_selectpopu = mysql_fetch_assoc($selectpopu));
  $rows = mysql_num_rows($selectpopu);
  if($rows > 0) {
      mysql_data_seek($selectpopu, 0);
	  $row_selectpopu = mysql_fetch_assoc($selectpopu);
  }
?>
    </select></div>
  </p>
  <p>
    
  </p>
</form>
</div>
<?php do { ?>
  <table width="100%" border="0">
    <tr>
      <td width="15%" align="center" valign="top"><?php echo $row_displaystory['title']; ?></td>
      <td width="80%" valign="top">
        
        <div style="border:1px solid black; bgcolor:170b01; width:800px;height:300px;overflow:scroll;">
          
  <?php echo $row_displaystory['block_content']; ?></div></td>
      <td width="5%" align="center" valign="top"><a href="update-edit-rec.php?idedit=<?php echo $row_displaystory['id']; ?>&amp;<?php echo $_SERVER['QUERY_STRING'];?>"><?php echo $translate->__('Edit');?></a></td>
    </tr>
  </table>
  <?php } while ($row_displaystory = mysql_fetch_assoc($displaystory)); ?>

<p>
  <?php
mysql_free_result($selectpopu);

mysql_free_result($displaystory);
?>
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<?php require("assets/wrapper/footer.php"); ?>