https://www.icyphoenix.com/viewtopic.php?f=4&t=6372&p=50523#p50523
-----------------------------------
AndyGpy
Sat 30 Oct, 2010 22:09

Re: CMS - Standard Pages In CMS
-----------------------------------
Right Guys,

excuse the NOOOB !!

Right i have a webpage called alertz2.php

[code linenumbers=false]if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(IP_ROOT_PATH . 'common.' . PHP_EXT);
include_once(IP_ROOT_PATH . 'includes/functions_groups.' . PHP_EXT);
include(IP_ROOT_PATH . '/alerts/alertsconfig.'.PHP_EXT);
$cms_page_id = 'scotalertz';
$cms_page_nav = (!empty($cms_config_layouts[$cms_page_id]['page_nav']) ? true : false);
$cms_global_blocks = (!empty($cms_config_layouts[$cms_page_id]['global_blocks']) ? true : false);
$cms_auth_level = (isset($cms_config_layouts[$cms_page_id]['view']) ? $cms_config_layouts[$cms_page_id]['view'] : AUTH_ALL);
check_page_auth($cms_page_id, $cms_auth_level);

// standard session management
$userdata = session_pagestart($user_ip);

if ((!$userdata['session_logged_in']) ) 

   {
        redirect(append_sid(LOGIN_MG . '?redirect=alerts.' . PHP_EXT));
	
   }

else

   {
		init_userprefs($userdata);
		// set page title
		$page_title = "Scotbird alerts - Members only area !! ";

		// standard page header
		include(IP_ROOT_PATH . 'includes/page_header.'.PHP_EXT);
		
		// Connect to the database 
		
		$start = ( isset($_GET['start']) ) ? intval($_GET['start']) : 0;
		$start = ($start < 0) ? 0 : $start;
		


		$db = new sql_db($alerts_mysql_host,$alerts_mysql_username,$alerts_mysql_password,$alerts_mysql_db,false);

    	if(!$db) 
		{
        		die("Database Connection Failed:- Please Contact Site Admin" . mysql_error());
    	}

		// assign template
		$template->set_filenames(array('body' => 'alertz.tpl'));	
		
			$tbl = $userdata[username];
			$sql = "SELECT COUNT(*) AS num FROM alerts";
			$result = $db->sql_query($sql);
			$row = $db->sql_fetchrow($result);
			$number = $row['num'];
	
			$lt = strlen(date("d"));	
			if ($lt != 2)
			{	
				if (date("d") == "1")
				{ 
					$datestr1 = '0' .((date("d")+'30').'/'.date("m")-'1');
					$datestr2 = date("d/m");
				}
				else
				{
					$datestr1 = '0' .((date("d")- 1).'/'.(string)date("m"));
					$datestr2 = (date("d/m"));
	
				}
			}
			else
			{
				$datestr1 =  ((date("d")- 1 ).'/'.(string)date("m"));
				$datestr2 = (date("d/m"));
			}
	 
			$sql = "SELECT DISTINCT region FROM alerts ";
			$result = $db->sql_query($sql);
	  
			if (!($result = $db->sql_query($sql)))
			{
  			 
				die("Database Query Failed" . mysql_error());
			} 

		// This is where you would add a new VARS Array if you intend to use your own custom VARS.
		
		
		while ($row = $db->sql_fetchrow($result))
			{
   				$region_filter_options .= '<option value="' . $row['region'] . '">' . $row['region'] . '</option>';
			}
			
		$sql = "SELECT DISTINCT species FROM alerts ";
	
	   	$result = $db->sql_query($sql);
	  
		if (!($result = $db->sql_query($sql)))
		{
			die("Database Query Failed" . mysql_error());
		} 

		// This is where you would add a new VARS Array if you intend to use your own custom VARS.
		
		
		while ($row = $db->sql_fetchrow($result))
		{
				$species_filter_options .= '<option value="' . $row['species'] . '">' . $row['species'] . '</option>';
		}

		$sql2 = "SELECT * FROM alerts WHERE region = '".$MyFormListVariable."'" ;
	
	   	$result2 = $db->sql_query($sql2);
	  
		if (!($result2 = $db->sql_query($sql2)))
		{
			die("Database Query Failed" . mysql_error());
		} 

$i   = 1;

		while ( $row2 = $db->sql_fetchrow($result2) )
		
		{
			$template->assign_block_vars('alerts', array( 'POS' => $i ,
			   		'REGION' => $row2['region'],
					'SPECIES' => str_replace("%", "'",$row2['species']),
					'DATE' => $row2['Date'],
					'TIME' =>  $row2['time'],
					'COMMENTS' => str_replace("'", "%",$row2['comments']),
					)
				);
			$i++;
		}
		
		
		$template->assign_vars(array(
		'USERNAME' => htmlspecialchars($userdata[username]),
		'REGION_FILTER' => $region_filter_options,
		'SPECIES_FILTER' => $species_filter_options,
				)
			);


		// An attempt at pagenating the results	
		$sql = "SELECT count(*) AS total FROM alerts";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Error geeting total list', '', __LINE__, __FILE__, $sql);
		}
		if ( $total = $db->sql_fetchrow($result) )
		{
			$total_species = $total['total'];
			$pagination = generate_pagination('alerts.' . PHP_EXT . '?mode=' . $mode . '&order=' . $sort_order, $total_species , 50, $start) . ' ';
		}
		$db->sql_freeresult($result);

		$template->assign_vars(array(
			'PAGINATION' => $pagination,
			'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / 50 ) + 1 ), ceil( $total_species  / 50 )),
			'L_GOTO_PAGE' => $lang['Goto_page']
				)
			);

			
		// Build the page
		$template->pparse('body');

		// standard page footer
		include(IP_ROOT_PATH . 'includes/page_tail.'.PHP_EXT);

   }
?>

[/code]


I have done the standard page Link

 [img]http://www.icyphoenix.com/files/images/5799/scotalertz1.jpg[/img] 

I have set it as shown in picture below

 [img]http://www.icyphoenix.com/files/images/5799/scotalertz2.jpg[/img] 

When i click on the Preview in the standard page view i get

"Hacking Attempt" warning and nothing else,

Can someone assist me please.

Regards


