include("/dpn/data/apache/se170441.deckpoint.net/html/admin/godb.php");
//include auth header
// getting variables
extract($_GET,EXTR_OVERWRITE);
//include("/dpn/data/apache/se170441.deckpoint.net/html/stats4site.php");
//Verifications to protect us of sql injections
if(isset($pid)) {
$pid = addslashes($pid);
if(!is_numeric($pid)) {
// Not numeric
header ("Location: error.php");
}
else {
if(!is_int(intval($pid))) {
// Not int
header ("Location: error.php");
}
else {
if($pid<=0) {
// the value is <=0
header ("Location: error.php");
}
}
}
// we will check if the given pid is equal to an existing page id
// if not, we just open the error page
$q="SELECT id FROM pages";
$result=mysql_query($q,$db);
while($myrow=mysql_fetch_array($result)) {
$thepid=$myrow["id"];
if($thepid==$pid) {
$pidexist = 1;
}
}
if($pidexist!=1) {
header ("Location: error.php");
}
}
else {
// we set the page id of the home that is the page with menuid equal to 1
$q="SELECT id FROM pages WHERE menuid=1";
$result=mysql_query($q,$db);
while($myrow=mysql_fetch_array($result)) {
$pid=$myrow["id"];
}
}
// if $pid is not set for a strange raison, we open the error page
if(!isset($pid)) {
header ("Location: error.php");
}
// Now we are going to get the id of the activated version of the page in the pages history, if the page is activated
$q="SELECT id FROM phistory WHERE pid='$pid' AND active=1";
$result=mysql_query($q,$db);
while($myrow=mysql_fetch_array($result)) {
$phid=$myrow["id"];
}
// if not in the table --> error
if(!isset($phid)) {
header ("Location: error.php");
}
// Somme functions
// Get number of levels of subnodes of a given node
function getNbrOfSubnodes($aNodeId,$db) {
$q1="SELECT id FROM menus WHERE subof='$aNodeId'";
$result1=mysql_query($q1,$db);
while($myrow1=mysql_fetch_array($result1)) {
$anId = $myrow1["id"];
$q2="SELECT id FROM menus WHERE subof='$anId'";
$result2=mysql_query($q2,$db);
while($myrow2=mysql_fetch_array($result2)) {
$anId2 = $myrow2["id"];
}
}
$result=0;
if(isset($anId)) {
$result++;
}
if(isset($anId2)) {
$result++;
}
return $result;
}
// Function to get the top Id
function getTopMID($mid,$subof,$db) {
$result=0;
while($subof!=0) {
$qd="SELECT * FROM menus WHERE id=$subof";
$resultd=mysql_query($qd,$db);
while ($myrowd=mysql_fetch_array($resultd)) {
$subof=$myrowd["subof"];
$mid=$myrowd["id"];
}
}
$result = $mid;
return $result;
}
//Function that says if a node is subof an another one
function isSubOf($mid1,$mid2,$db) {
$result=0;
$qd="SELECT count(*) FROM menus WHERE id=$mid1 AND subof=$mid2";
$resultd=mysql_query($qd,$db);
while ($myrowd=mysql_fetch_array($resultd)) {
$a=$myrowd[0];
}
if($a>0) {
$result=1;
}
// if not directly subof
$qd2="SELECT subof FROM menus WHERE id=$mid1";
$resultd2=mysql_query($qd2,$db);
while ($myrowd2=mysql_fetch_array($resultd2)) {
$sub2=$myrowd2["subof"];
}
$qd3="SELECT subof FROM menus WHERE id=$sub2";
$resultd3=mysql_query($qd3,$db);
while ($myrowd3=mysql_fetch_array($resultd3)) {
$sub3=$myrowd3["subof"];
}
if($sub3==$mid2) {
$result=1;
}
return $result;
}
// Function to know how many subnodes a node have
function getSubnodesNumber($aNodeId,$db) {
$number = 0;
$q1="SELECT id FROM menus WHERE subof='$aNodeId'";
$result1=mysql_query($q1,$db);
while($myrow1=mysql_fetch_array($result1)) {
$number++;
$anId = $myrow1["id"];
$q2="SELECT id FROM menus WHERE subof='$anId'";
$result2=mysql_query($q2,$db);
while($myrow2=mysql_fetch_array($result2)) {
$number++;
$anId2 = $myrow2["id"];
}
}
return $number;
}
//breadcrumb
$q="SELECT menuid FROM pages WHERE id=$pid";
$result=mysql_query($q,$db);
if ($myrow=mysql_fetch_array($result))
{
$m0=$myrow["menuid"];
}
$a=$m0;
$am='';
$me='';
while ($a!=0)
{
if ($am!='') $am.='%&&ç';
if ($me!='') $me.='%&&ç';
$q="SELECT title,subof FROM menus WHERE id=$a ORDER BY ord";
$result=mysql_query($q,$db);
$myrow=mysql_fetch_array($result);
$a=$myrow["subof"];
$am.=$myrow["title"];
if(!$pt) $pt=$myrow["title"];
$me.=$a;
}
$aam = explode("%&&ç", $am);
$ame = explode("%&&ç", $me);
$aam = array_reverse($aam);
$ame = array_reverse($ame);
?>
" />
if($theHomeId==$pid) {
?>
OnAir - Inflight Internet and mobile telephony on Boeing and Airbus aircraft
}
else {
?>
OnAir -
// Setting the title of the page
$q="SELECT title FROM menus WHERE id=$m0";
$result=mysql_query($q,$db);
$myrow=mysql_fetch_array($result);
echo $myrow["title"];
$theTitleOfThePageForStats = $myrow["title"];
?>
" />
} // end if theHomeID=pid
?>
">
http://www.onair.aero/index.php?pid=35
if($pid!=18) { ?>
} else { ?>
} ?>
$q="SELECT menus.title AS title,menus.id AS id FROM menus,phistory WHERE subof = 7777777 AND menus.id=phistory.menuid AND phistory.active=1 ORDER BY ord";
$result=mysql_query($q,$db);
$a=1;
$theIdOfPage=0;
while ($myrow=mysql_fetch_array($result))
{
if ($a==1)
{
$a=0;
}
else { echo (" "); }
$title=$myrow["title"];
$lpid=$myrow["id"];
$mid=$myrow["id"];
// we have to get the id of the page associated to the menuid
$q2="SELECT id FROM pages WHERE menuid='$lpid'";
$result2=mysql_query($q2,$db);
while ($myrow2=mysql_fetch_array($result2)) {
$theIdOfPage = $myrow2["id"];
}
// if the menu have an attached page, we make a link
if($theIdOfPage!=0) {
if($theIdOfPage=="42") {
$text = "$title";
echo $text;
//echo "$title";
}
// if not, we just display the title without making a link
else {
echo "$title";
}
$theIdOfPage=0;
}
?>