View file script/select.php

File size: 3.92Kb
<?php
/*-----------------------------------------------------------------------------------------
mcGalleryPRO
All code is © 2003 Marc Cagninacci.
No files may be redistributed in whole or significant part.
----------------- mcgalleryPRO IS NOT FREE SOFTWARE -------------------
You should have receive a file called license.txt in this package
--------------------------------------------------------------------------------------------*/

session_start();

include './admin/conf.inc.php';
include './shadow.php';
include './header_pop.php';

if ($l == 1)
{
 include 'passpop.php';
 echo '</body></html>';
 exit();
}

if ($r != '')
{
  if ($r == 'ok')
  {
  echo '<br><br><br><center><font size="2">'.$l_Perdu_ok.'</font></center>';
  echo '<br><p align="center"><a href="#" onclick="javascript:window.close()" class="lien1"><b>OK</b></a></p>';
  echo '</body></html>';
  exit();
  }
  elseif ($r == 'err')
  {
  echo '<center><br><font size="2">'.$l_Perdu_err.'</font></center>';
  }
}

if (isset($valid))
{
$connect= mysql_connect($host,$login,$pass);
mysql_select_db($base, $connect);

$query="SELECT level FROM mcgallery_members WHERE login ='$private_login' AND password='$private_pass'";
$result=mysql_query($query);

$ok = mysql_fetch_row($result);
 if ($ok[0] != '')
 {
 $level = $ok[0];
  $_SESSION['level'] = $level;
  $_SESSION['private_login'] = $private_login;
  $_SESSION['private_pass'] = $private_pass;
 }
}
 if (!empty($_SESSION['private_login']))
{
$private_login = $_SESSION['private_login'];

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

$query="SELECT id, file FROM mcgallery_select WHERE id = $id AND type='$t' AND login ='$private_login'";
$result=mysql_query($query);
 if (mysql_num_rows($result) > 0)
 {
  if ($t == 'P') { $message = $l_sel_p_no; }
  else  { $message = $l_sel_v_no; }
  echo '<br><br><br><p align="center"><font size="2">'.$message.'.</font></p>';
  echo '<p align="center"><font size="2"><a href="#" onclick="javascript:window.close()" class="lien1"><b>OK</b></a></font></p>';

 }
 else
 {
 	if ($t == 'P') $table = 'mcgallery_photo';
 	if ($t == 'V') $table = 'mcgallery_video';
 	if ($t == 'F') $table = 'mcgallery_flash';
 $query = "SELECT file FROM $table WHERE id = $id";
 $result = mysql_query($query);
 $row = mysql_fetch_row($result);
  $query="INSERT INTO mcgallery_select VALUES ($id, '$private_login', '$row[0]', '$t')";
  mysql_query($query);
  if ($t == 'P') { $message = $l_sel_p_ok; }
  else  { $message = $l_sel_v_ok; }
  echo '<br><br><br><p align="center"><font size="2">'.$message.'.</font></p>';
  echo '<p align="center"><a href="#" onclick="javascript:window.close()" class="lien1"><b>OK</b></a></p>';

 }
}
else
{
   echo '<br><form method="post" name="form" action="select.php">';
   echo '<table border="0" cellspacing="1" cellpadding="2" width="200" align="center">';
   echo '<tr><td class="td0" align="center"><font size="2">'.$l_Restricted.'</font></td></tr>';
   echo '<tr><td class="td2" align="right"><font size="2">'.$l_Login.'</font>&nbsp;<input type="text" name ="private_login" size="10">&nbsp;</td></tr>';
   echo '<tr><td class="td2" align="right"><font size="2">'.$l_Pass.'</font>&nbsp;<input type="password" name ="private_pass" size="10">&nbsp;</td></tr>';
   echo '<tr><td class="td2" align="center"><font size="1"><a href="select.php?l=1" class="lien1">'.$l_Perdu.' ?</a></font></td></tr>';
   echo '<tr><td class="td1" align="center"><input type="submit" value="OK" name="valid">';
   echo '<input type="hidden" name="id" value="'.$id.'"><input type="hidden" name="t" value="'.$t.'"></td></tr>';
   echo '</table></form>';
   echo '<p align="center"><font size="1">'.$l_sel_restrict.' <a href="mailto:'.$email_admin.'" class="lien1"><b>'.$l_contact.'</b></a>.</font></p>';
}
?>
<script language="JavaScript">
<!--
document.form.private_login.focus()
// -->
</script>
</body>
</html>