Просмотр файла script/wap/wap3.php

Размер файла: 1.65Kb
<?php
include 'wapconf.inc.php';
if ( $w != md5($admin_login.$admin_pass) )
{
header ('Location:index.php');
}

header("Content-Type: text/vnd.wap.wml"); 
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">";;
echo "<wml><card title=\"mcGalleryPRO\">";
echo "<do type=\"prev\" label=\"back\"><prev/></do>"; 

$connect= mysql_connect($host,$login,$pass);
mysql_select_db($base, $connect);

if ($act == 'voir')
{
$query = "SELECT text FROM mcgallery_comment WHERE id = $id";
$row = mysql_fetch_array(mysql_query($query));
echo '<p>';
echo stripslashes($row['text']).'<br/>';
echo '------------<br/>';
echo '<a href="wap3.php?w='.$w.'&amp;id='.$id.'&amp;act=valid">'.$l_valid_ok.'</a><br/>';
echo '<a href="wap3.php?w='.$w.'&amp;id='.$id.'&amp;act=delete">'.$l_Suppr.'</a>';
echo '</p>';
}

elseif ($act == 'valid')
{
$query = "UPDATE mcgallery_comment SET valid = 'Y' WHERE id = $id";
mysql_query($query);
echo '<p align="center"><br/>';
echo '<strong>OK</strong>';
echo '</p>';
}

elseif ($act == 'delete')
{
$query = "DELETE FROM mcgallery_comment WHERE id = $id";
mysql_query($query);
echo '<p align="center"><br/>';
echo '<strong>OK</strong>';
echo '</p>';
}

else
{
echo '<p>';
$query = "SELECT id, author FROM mcgallery_comment WHERE valid = 'N' ORDER BY author";
$res = mysql_query($query);
echo '<strong>'.$l_Auteur.':</strong><br/>';
  while ($row = mysql_fetch_array($res))
  {
  echo '<a href="wap3.php?w='.$w.'&amp;id='.$row['id'].'&amp;act=voir">'.stripslashes($row['author']).'</a><br/>';
  }
echo '</p>';
}
echo '</card></wml>';
?>