<?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
// Tworzy połączenie z bazą danych
$host = "localhost";
$user = "root";
$pwd = "mefisto";
$dbConn = mysql_connect($host,$user,$pwd);
mysql_query("SET NAMES latin2"); 
// Połaczenie z bazą danych newland_tours
$database = "newland_tours";
mysql_select_db($database);
$query_rs_regions = "SELECT * FROM tbl_region ORDER BY regionName";
$rs_regions = mysql_query($query_rs_regions);
$row_rs_regions = mysql_fetch_assoc($rs_regions);
?>
<!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>
<title>Newland Tours: Administracja: Wstaw opis kraju</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
<link href="css/newland.css" rel="stylesheet" type="text/css" /></head>

<body>
<a href="#top"><img src="images/spacer.gif" alt="Skip to main page content" width="1" height="1" border="0" align="left" /></a>
<table width="750" border="0" cellpadding="3" cellspacing="0">
 <tr>
  <td><img src="images/banner_left.gif" width="451" height="68" alt="Newland Tours Banner, Left." /></td>
  <td width="280"><img src="images/banner_right.jpg" width="276" height="68" alt="Newland Tour Banner, Right." /></td>
 </tr>
 <tr>
  <td><img src="images/navbar.gif" name="navbar" width="450" height="20" border="0" usemap="#navbarMap" alt="Navigation Bar." /></td>
  <td><img name="copyright_bar" src="images/copyright_bar.gif" width="272" height="20" border="0" alt="Copyright 2006 Newland Tours." /></td>
 </tr>
 <tr>
  <td colspan="2">	
	<h1><br />
	  <a name="top" id="top"></a>Wstaw nowy  opis kraju </h1>
    <form id="frm_insertProfile" name="frm_insertProfile" method="post" action="admin_cp_insert_processor.php">
      <table width="95%" border="1" cellspacing="0" cellpadding="3">
        <tr>
          <td width="47%">Rejon</td>
          <td width="53%"><select name="region" id="region">
		  <?php
		  do
		  {
		  	echo "<option value=\"".$row_rs_regions['regionID']."\">".$row_rs_regions['regionName']."</option>";
		  }
		  while ($row_rs_regions = mysql_fetch_assoc($rs_regions));
		  ?>		  
          </select>
          </td>
        </tr>
        <tr>
          <td>Nazwa kraju </td>
          <td><input name="countryName" type="text" id="countryName" /></td>
        </tr>
        <tr>
          <td>Liczba ludności (nie rozdzielaj cyfr) </td>
          <td><input name="population" type="text" id="population" /></td>
        </tr>
        <tr>
          <td>Waluta</td>
          <td><input name="country_currency" type="text" id="country_currency" /></td>
        </tr>
        <tr>
          <td>Opis kraju </td>
          <td><textarea name="description" cols="55" rows="9" id="description"></textarea></td>
        </tr>
        <tr>
          <td>Adres URL obrazu (Użyj następującego formatu:<br />
            <strong>images/nazwaobrazu.jpg</strong> i nie zapomnij wgrać<br />
            pliku z obrazem do katalogu obrazów na serwerze </td>
          <td><input name="imageURL" type="text" id="imageURL" /></td>
        </tr>
        <tr>
          <td>Alternatywny opis obrazu </td>
          <td><textarea name="imageALT" cols="55" id="imageALT"></textarea></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input type="submit" name="Submit" value="Wyślij" /></td>
        </tr>
      </table>
      </form>    <p>&nbsp;</p>
    </td>
 </tr>
</table>

<br />


<map name="navbarMap" id="navbarMap">
 <area shape="rect" coords="1,0,62,20" href="index.php" alt="Home" />
 <area shape="rect" coords="71,0,117,20" href="about.php" alt="About" />
 <area shape="rect" coords="129,0,196,20" href="tours.php" alt="Find Tours" />
 <area shape="rect" coords="209,0,311,20" href="profiles.php" alt="Country Profiles" />
 <area shape="rect" coords="327,0,434,20" href="contact.php" alt="Contact An Agent" />
</map>
</body>
</html>
<?php
mysql_free_result($rs_regions);
?>