Location: PHPKode > projects > WSN Guest > wsn-guest/admin/advanced.php
<?php

require 'adminstart.php';

if ($thismember->isadmin())
{
if ($filled)
{
   if ($type=='getfield')
   {
    if (!$template) $template = new template("../$templatesdir/blank.tpl");
    $getem = $db->select($field, $table, 'id>0', 'ORDER BY id ASC', '');
    $num = $db->numrows($getem);
    for ($count=0; $count<$num; $count++)
    {
	$row = $db->row($getem);
	$theemail = $row[0];
  	if ($theemail != '')
	{
	  $template->text .= $theemail . $sep;
	}
    }
   $template->text .= '<p align=center>[ <a href=advanced.php>Back</a> ]</p>';
   }
   else if ($type == 'resetfields')
   {
    $settings->update('resetdelay');
    $settings->update('resetscript');
    if (!$template) $template = new template("../$templatesdir/redirect.tpl");
    $template->replace('{MESSAGE}', 'The timed action has been set.');
    $template->replace('{DESTINATION}', 'advanced.php');
   }
   else if ($type == 'setlinks')
   {
    if ($condition == 'contains') $doit = $db->update('linkstable', $field, $fieldvalue, "$searchfield LIKE '%$searchvalue%'");
    else $doit = $db->update('linkstable', $field, $fieldvalue, "$searchfield $condition $searchvalue");
    if (!$template) $template = new template("../$templatesdir/redirect.tpl");
    $template->replace('{MESSAGE}', 'The entries have been updated.');
    $template->replace('{DESTINATION}', 'advanced.php');
   }
   else if ($type == 'setcoms')
   {
    if ($condition == 'contains') $doit = $db->update('commentstable', $field, $fieldvalue, "$searchfield LIKE '%$searchvalue%'");
    else $doit = $db->update('commentstable', $field, $fieldvalue, "$searchfield $condition '$searchvalue'");
    if (!$template) $template = new template("../$templatesdir/redirect.tpl");
    $template->replace('{MESSAGE}', 'The comments have been updated.');
    $template->replace('{DESTINATION}', 'advanced.php');
   }
   else if ($type == 'setmems')
   {
    if ($condition == 'contains') $doit = $db->update('memberstable', $field, $fieldvalue, "$searchfield LIKE '%$searchvalue%'");
    else $doit = $db->update('memberstable', $field, $fieldvalue, "$searchfield $condition '$searchvalue'");
    if (!$template) $template = new template("../$templatesdir/redirect.tpl");
    $template->replace('{MESSAGE}', 'The members have been updated.');
    $template->replace('{DESTINATION}', 'advanced.php');
   }   
   else if ($type == 'changepassword')
   {
    if ($newpassconfirm == $newpass)
	{
	 $newpassword = md5($newpass);
	 $settings->password = $newpassword;
	 $settings->update('password');
	 if (!$template) $template = new template("../$templatesdir/redirect.tpl");
     $template->replace('{MESSAGE}', 'Your password has been changed.');
     $template->replace('{DESTINATION}', 'index.php?action=logout');
     setcookie('admin', md5($newpass), time()+1000000);
	}
	else
	{
     if (!$template) $template = new template("../$templatesdir/redirect.tpl");
     $template->replace('{MESSAGE}', 'You typed different passwords in each box, so your password has not been changed.');
     $template->replace('{DESTINATION}', 'advanced.php');
	}
   }
  else if ($type == 'dophp')
  {
if (!$demomode)
{
   $test = OutputPhpDocument($phptext);
   if (!$template) $template = new template("../$templatesdir/redirect.tpl");
   $template->replace('{MESSAGE}', 'Your PHP code has been executed.');
   $template->replace('{DESTINATION}', 'advanced.php');
}
 }
  else if ($type == 'sql')
  {
   if (!$demomode)
   {
    $filetitle = $_FILES['filetitle']['tmp_name'];
    if ($filetitle != '')
    {
     $sql = fileread($filetitle);
     $docreation = processsql($sql);
     if (!$template) $template = new template("../$templatesdir/redirect.tpl");
     $template->replace('{MESSAGE}', 'The SQL from the file has been executed.');
     $template->replace('{DESTINATION}', 'advanced.php');	
    }
    else
    {
     $sqltext = encodesql($sqltext);
     $test = processsql($sqltext);
     if (!$template) $template = new template("../$templatesdir/redirect.tpl");
     $template->replace('{MESSAGE}', 'MySQL returned this result (if nothing, it worked): ' . $test);
     $template->replace('{DESTINATION}', 'advanced.php');
    }
   }
  }
 }
 else
 {
  if (!$template) $template = new template("../$templatesdir/admin/advanced.tpl");
  $template->replace('{TEMPLATESDIR}', $templatesdir);
  $resetfieldsmenu = fieldselector('linkfields', $settings->resetfields);
  $template->replace('{RESETFIELDSMENU}', $resetfieldsmenu);  
  $template->replace('{RESETDELAY}', $settings->resetdelay);
  $template->replace('{RESETSCRIPT}', $settings->resetscript);
 }
} 

require 'adminend.php';  


?>
Return current item: WSN Guest