<?php require_once('Connections/conn_newland.php'); ?><?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "administrator";
$MM_donotCheckaccess = "false";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && false) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
  $MM_referrer .= "?" . $QUERY_STRING;
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $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_insert"])) && ($_POST["MM_insert"] == "frm_update_tj")) {
  $insertSQL = sprintf("INSERT INTO tbl_journal (author, journal_entry) VALUES (%s, %s)",
                       GetSQLValueString($_POST['author'], "text"),
                       GetSQLValueString($_POST['journal_entry'], "text"));

  mysql_select_db($database_conn_newland, $conn_newland);
  $Result1 = mysql_query($insertSQL, $conn_newland) or die(mysql_error());

  $insertGoTo = "index.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Newland Tours: Uaktualnianie Dziennika Podróżnika</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>

<body class="oneColFixCtrHdr">
<a href="#top"><img src="images/spacer.gif" alt="Przejdź do głównej treści strony" border="0" /></a>
<div id="container">
  <div id="header">
    <img src="images/banner_left.gif" width="451" height="68" alt="Banner Newland Tours, strona lewa." /><img src="images/banner_right.jpg" width="276" height="68" id="bannerRight" alt="Banner Newland Tours, strona prawa" />
  <!-- end #header --></div>
  <div id="navigation">
  	<ul>
        <li><a href="index.php">Główna</a></li>
        <li><span class=""><span class=""><a href="about.cfm">O firmie</a></span></span></li>
<li><a href="tours.php">Znajdź wyjazd</a></li>
        <li><a href="profiles.php">Opisy krajów</a></li>
        <li><a href="contact.php">Kontakt z nami</a></li>
    </ul>
    </div>
  <div id="mainContent">
    <h1><a name="top" id="top"></a>Uaktualnij  Dziennik Podróżnika</h1>
    <p>Użyj  poniższego formularza do uaktualnienia Dziennika Podróżnika. Upewnij się, że  nie nadpisałeś żadnego kodu HTML, a jedynie zmieniłeś tekst zawarty między  znacznikami.</p>
    <p>Wskazówka: Aby dodać w  nowym wierszu nowy akapit, wpisz: &lt;p&gt;Nowy akapit&lt;/p&gt;. Aby usunąć  akapit, skasuj nie tylko jego treść, ale i znaczniki &lt;p&gt; i &lt;/p&gt;.</p>
    <form id="frm_update_tj" name="frm_update_tj" method="POST" action="<?php echo $editFormAction; ?>">
        <textarea name="journal_entry" id="journal_entry" cols="55" rows="9">
<h3>Tutaj wpisz nagłówek</h3>
<p class="author">Imię i nazwisko autora</p>
<p>Pierwszy akapit</p>
<p>Drugi akapit</p>		
        </textarea>
      <p>
        <input type="submit" name="button" id="button" value="Wyślij" />
        <input name="author" type="hidden" id="author" value="<?php echo $_SESSION['MM_Username']; ?>" />
      </p>
      <input type="hidden" name="MM_insert" value="frm_update_tj" />
    </form>
    <br clear="all" />
  <!-- end #mainContent --></div>
  <div id="footer">
    <p>&copy; 2007 Newland Tours</p>
  <!-- end #footer --></div>
<!-- end #container --></div>

</body>
</html>
