0

I have taken little CMS script. but there some lines in script it confises me.
who can help me to understand this lines
this is index.php

<?
//ə
session_start();
$sid = md5('atlasmed.az');
define('_INCLUDED_', true);
include_once('config.php');
include_once('class.php');
$class = new functions();
$id = $class->is_num($_GET['id']);
$menu = $_GET['menu'];
$menus = array
(
	'pages' => 'pages.php',
	'doctors' => 'doctors.php',
	'doctor' => 'doctor.php',
	'articles' => 'articles.php',
	'view-article' => 'article_view.php',
	'departments' => 'departments.php',
	'news' => 'news.php',
	'registration' => 'registration.php',
	'view-news' => 'news_view.php',
	'account' => 'account.php',
	'consultation' => 'consultation.php',
	'pass' => 'change_pass.php',
	'forgotpass' => 'forgotpass.php',
	'view-faq' => 'faq_view.php',
	'reception' => 'reception.php',
	'prod' => 'product.php'
);
if ($_POST['enter_Submit'])
{
	$login = $class->check($_POST['person_login'], 25);
	$pass = $class->check($_POST['person_pass'], 25);
	$query = "select id, login, name, surname, birthday, gender, email, phone from cms_persons where login='$login' and pass=md5('$pass') and active='2'";
	//echo $query.'<br>';
	$query = $class->query($query);
	$m = $class->fetch_array($query);
	if ($m['id'])
	{
		$_SESSION[$sid]['persons'] = $m;
	}
	else
	{
		$login_alert = _not_authorisation_;
	}
}
elseif ($menu == 'logout' && $_SESSION[$sid]['persons']['id'] > 0)
{
	unset($_SESSION[$sid]['persons']);
	$login_alert = _logout_;
}

if ($menus[$menu])
{
	$file = $menus[$menu];
}
else
{
	$file = 'main.php';
	$menu = 'main';
}

$link = $_SERVER['REQUEST_URI'];
if (strstr($link, '/'.$lang.'/') == '')
{
	$link = _basedir_.$lang.'/';
}
include('lang/'.$lang.'.php');
$_GET['search'] = $class->check($_GET['search']);
$sword = ($_GET['search']) ? $_GET['search'] : _search_;
?>
<!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>Atlas Medical Center</title>
<link href="<?=_basedir_?>css/main.css" rel="stylesheet" type="text/css" />
<link href="<?=_basedir_?>css/jquery.multi-ddm.css" rel="stylesheet" type="text/css" />
<link href="<?=_basedir_?>css/prettyPhoto.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?=_basedir_?>js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="<?=_basedir_?>js/jquery.multi-ddm.js"></script>
<script type="text/javascript" src="<?=_basedir_?>js/common.js"></script>
<!--[if lt IE 7]>
        <script type="text/javascript" src="<?=_basedir_?>js/unitpngfix.js"></script>
<![endif]-->
<script src="<?=_basedir_?>Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>

<body>

<div class="main_wrapper">
	<div class="header_wrapper">
		<div class="animation_corners"></div>
		<div class="animation">
        	<?
			$query = "select name, url from cms_banners where id=1 and active=2 and lang='$lang'";
			//echo $query.'<br>';
			$query = $class->query($query);
			$m = $class->fetch_array($query);
			echo $class->ViewBanner(_upldir_, _upldir1_, $m['name'], $m['url'], '', 'opaque');
			?>
        </div>
		<a href="<?=_basedir_.$lang.'/'?>" class="logo"></a>
        <ul class="langs">
        	<?
			foreach ($langs as $value)
            {
                ?><li class="<?=$value?>"><a href="<?=str_replace('/'.$lang.'/', '/'.$value.'/', $link)?>"></a></li><?
            }
			?>
        </ul>
        <ul id="multi-ddm">
        <?
		function CreateMenu($parent)
		{
			global $lang;
			$query1 = "select id, title, link, link_target, parent from cms_pages where active=2 and lang='$lang' and parent='".$parent."' order by ordering";
			//echo $query.'<br>';
			$query1 = mysql_query($query1);
			$say = mysql_num_rows($query1);
			$html = '';
			if ($say)
			{
				$html = '<ul>';
				while ($m1 = mysql_fetch_array($query1))
				{
					$link = ($m1['link']) ? $m1['link'] : _basedir_.$lang.'/pages/'.$m1['id'].'/';
					$m1['link_target'] = ($m1['link_target']) ? ' target="'.$m1['link_target'].'"' : '';
					$html .= '
                    <li>';
					$z = CreateMenu($m1['id']);
					if ($z)
					{
						$html .= '<a href="javascript:;"><span>&raquo;</span>'.$m1['title'].'</a>';
						$html .= $z;
					}
					else
					{
						if ($parent == 5) $link = _basedir_.$lang.'/articles/'.$m1['id'].'/';
						$html .= '<a href="'.$link.'"'.$m1['link_target'].'>'.$m1['title'].'</a>';
					}
					$html .= '</li>';
				}
				$html .= '</ul>';
			}
			return $html;
		}
		$query = "select id, title, link, link_target from cms_pages where active=2 and lang='$lang' and parent='1' order by ordering";
        $query = $class->query($query);
		while ($m = $class->fetch_array($query))
		{
			?>
            <li>
            	<?
            	$link = ($m['link']) ? $m['link'] : _basedir_.$lang.'/pages/'.$m['id'].'/';
                $m['link_target'] = ($m['link_target']) ? ' target="'.$m['link_target'].'"' : '';
				$z = CreateMenu($m['id']);
				if ($z)
				{
					?><a href="javascript:;"><?=$m['title']?></a><?
					echo $z;                    
				}
				else
				{
					?><a href="<?=$link?>"<?=$m['link_target']?>><?=$m['title']?></a><?
                }
				?>
            </li>
            <?
		}
		?>
        </ul>
    </div>
    <div class="middle_block_wrapper">
    	<div class="middle_block_top_bg">
        	<div class="middle_block_bottom_bg">
            	<?
				$query = "select id, title, pic, link, link_target from cms_pages where active=2 and lang='$lang' and id='20'";
				//echo $query.'<br>';
				$query = $class->query($query);
				$m = $class->fetch_array($query);
				$m['link_target'] = ($m['link_target']) ? ' target="'.$m['link_target'].'"' : '';
				?>
            	<img src="<?=_upldir_.'Image/'.$m['pic']?>" width="179" height="188" class="dr" />
                <a href="<?=$m['link']?>" <?=$m['link_target']?> class="abs_transparent_button">&raquo; <?=$m['title']?> &laquo;</a>
				<div class="private_cabinet_wrapper">
                	<img src="<?=_basedir_?>images/note.png" class="note" />
                	<h1><?=_personal_page_?></h1>
                    <?
					if ($_SESSION[$sid]['persons']['id'])
					{
						?>
                        <ul class="profile_links">
                        <li class="welcome"><?=_welcome_?> &nbsp;<b><?=$_SESSION[$sid]['persons']['login']?></b></li>
                        <?
						$my_links = array('account' => _account_, 'consultation' => _consultation_, 'reception' => _reception_, 'logout' => _logout_);
						foreach ($my_links as $key => $value)
						{
							$active = ($key != $menu) ? '' : ' class="active"';
							?><li><a href="<?=_basedir_.$lang.'/'.$key.'/'?>"<?=$active?>><?=$value?></a></li><?
						}
						?></ul><?
					}
					else
					{
						?>
						<form method="post" action="<?=_basedir_.$lang.'/account/'?>">
						<ul class="private_cabinet_log_in">
							<li><input type="text" name="person_login" value="<?=_enter_login_?>" /></li>
							<li><input type="password" name="person_pass" value="Password" /></li>
							<li class="button_1"><input name="enter_Submit" type="submit" value="<?=_enter_submit_?>" /><a href="<?=_basedir_.$lang?>/forgotpass/"><?=_forgotpass_?></a></li>
							<li class="button_2"><a href="<?=_basedir_.$lang?>/registration/1/" class="transparent_button">&raquo; <?=_registration_?> &laquo;</a></li>
						</ul>
						</form>
                        <?
					}
					?>
                </div>
                <div class="services_wrapper">
                	<h1><?=_services_?></h1>
                    <ul class="services_list">
                    <?
					$query = "select id, title from cms_departments where active=2 and lang='$lang' order by ordering";
					//echo $query.'<br>';
					$query = $class->query($query);
					while ($m = $class->fetch_array($query))
					{
						?><li><a href="<?=_basedir_.$lang.'/departments/'.$m['id'].'/'?>"><?=$m['title']?></a></li><?
					}
					?>
                    </ul>
                </div>
          </div>
        </div>
    </div>
    <div class="content_wrapper">
    	<div class="content_top_bg">
        	<div class="content_bottom_bg">
           	  <div class="content_left">
               	  <ul class="leftside_menu">
                  <?
					$query = "select id, title, subtitle, pic, link, link_target from cms_pages where active=2 and lang='$lang' and parent='12' order by ordering";
					//echo $query.'<br>';
					$query = $class->query($query);
					while ($m = $class->fetch_array($query))
					{
						$link = ($m['link']) ? $m['link'] : _basedir_.$lang.'/pages/'.$m['id'].'/';
						$m['link_target'] = ($m['link_target']) ? ' target="'.$m['link_target'].'"' : '';
						?><li><a href="<?=$link?>" <?=$m['link_target']?>><img src="<?=_upldir_.'Image/'.$m['pic']?>" class="icon" /><div><strong><?=$m['title']?></strong><em><?=$m['subtitle']?></em></div></a></li><?
					}
					?>
                  </ul>
              	</div>
            	
           	  	<div class="content_right">
                	<div class="content_min_height"></div>
                    <div class="content_inside">
                        <?
						include('inc_pages/'.$file);
						?>
					</div>

                    <div class="contacts_bottom_wrapper">
                    	<?
						$query = "select id, title, pic, about from cms_pages where active=2 and lang='$lang' and id='9'";
						//echo $query.'<br>';
						$query = $class->query($query);
						$m = $class->fetch_array($query);
						?>
                    	<div class="bottom_number"><img src="<?=_upldir_.'Image/'.$m['pic']?>" /></div>
                    	<div class="bottom_contacts"><p><strong><?=$m['title']?></strong></p><?=$m['about']?></div>
                    </div>
                    <div class="copyright">
                    	<p>Copyright &copy; 2010</p>
                        <p>Programming by <a href="http://www.dreamart.az" target="_blank">DreamArt</a></p>
                    </div>
              	</div>
                <div class="clear"></div>
            </div>
        </div>
    </div>
  <div class="clear"></div>
</div>
</body>
</html>

config.php

<?
if (!defined('_INCLUDED_')) exit();
//ə
define('_nlimit_', 5);
define('_plimit_', 5);
define('_dlimit_', 5);
define('_basedir_', '/');

define('_upldir_', '/upload/');
define('_upldir1_', '/home/atlasmed/public_html/upload/');
$connect = @mysql_pconnect('localhost', 'atlasmed_admin', 'd&e}EJ}f]wm,') or die('Could not connect to mysql');
@mysql_query("SET NAMES 'utf8'", $connect);
@mysql_select_db('atlasmed_cms') or die('Could not connect to db');
/*
define('_upldir_', '/atlasmed.az/upload/');
define('_upldir1_', 'D:\\myphp\atlasmed.az\upload\\');
$connect = @mysql_pconnect("localhost", "root", '12369874') or die("Could not connect to mysql");
@mysql_query("SET NAMES 'utf8'", $connect);
@mysql_select_db("atlasmed.az") or die("Could not connect to db");
*/
$langs = array('az', 'en', 'ru');
$lang = (in_array($_GET['lang'], $langs)) ? $_GET['lang'] : $_POST['lang'];
$lang = (in_array($lang, $langs)) ? $lang : $langs[0];
?>

what does mean

$_POST['lang'];

in config.php at the 22-nd row
i understand

$_GET['lang']

but i dont understand why

$_POST['lang']

used here
Thans in advance

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by azegurb
0

but i need 22 -nd line of config.php
there i dont understand why used $_POST;

0

$_POST is needed when the original form has method=post (which in this case it does). If the form has method=get, then you would need $_GET.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.