Esempio n. 1
0
function DeleteAll(array $obj)
{
    $res = true;
    foreach ($obj as $item) {
        $table = GetTabelByModel($item);
        $res &= Delete($table, $item);
    }
    return $res;
}
Esempio n. 2
0
function Delete($directory)
{
    foreach (glob("{$directory}/*") as $file) {
        if (is_dir($file)) {
            Delete($file);
        } else {
            unlink($file);
        }
    }
    rmdir($directory);
}
Esempio n. 3
0
function Delete($path)
{
    if (is_dir($path) === true) {
        $files = array_diff(scandir($path), array('.', '..'));
        foreach ($files as $file) {
            Delete(realpath($path) . '/' . $file);
        }
        return rmdir($path);
    } else {
        if (is_file($path) === true) {
            return unlink($path);
        }
    }
    return false;
}
Esempio n. 4
0
function DeleteUser($config, $id)
{
    $rows = array();
    switch ($config['adapter']) {
        case 'Mysql':
            include '../modules/Application/src/Application/Model/Mysql/Execute.php';
            include '../modules/Application/src/Application/Model/Mysql/Connect.php';
            $link = Connect($config['slave']);
            $query = "DELETE FROM user WHERE iduser=" . $id;
            $rows = Execute($link, $query);
            break;
        case 'Txt':
            include '../modules/Application/src/Application/Model/Txt/Delete.php';
            $rows = Delete($id, $config['userfilename']);
            break;
    }
    return $rows;
}
Esempio n. 5
0
function DeleteUser($config, $id)
{
    switch ($config['adapter']) {
        case 'Mysql':
            include "../modules/Application/src/Application/Model/Mysql/Connect.php";
            include "../modules/Application/src/Application/Model/Mysql/Execute.php";
            $master = $config['dbmaster'];
            $slave = $config['dbslave'];
            $link = Connect($master);
            $query = "DELETE FROM user WHERE iduser='******'";
            $data = Execute($query, $link);
            break;
        case 'Txt':
            include "../modules/Application/src/Application/Model/Txt/Delete.php";
            $data = Delete($config['filename'], $id);
            break;
    }
    return $data;
}
if (isset($_POST['submit']) == 'Submit') {
    $data = array('category_id' => 0, 'user_id' => $_SESSION['id'], 'category_name' => mysql_real_escape_string($_POST['category']), 'status' => 1, 'date' => date('Y-m-d'));
    //dbRowInsert('video_category', $data);
    $output = InsertPDO('video_category', $data);
} else {
    ?>
	<form method="post" name="myform" onSubmit="return validform();">
	<label for="email"><span>Category Name: </span><input type="text" name="category" value="" /></label>
	<label><span></span><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Cancel" /></label>
	</form>
	<?php 
}
?>
	<?php 
if (!empty($_GET['delete'])) {
    Delete('video_category', 'category_id', $_GET['delete']);
    header('Location: video-category.php');
}
$query = "SELECT category_id, category_name, date, status FROM video_category WHERE user_id=:user_id";
$res = $dbh->prepare($query);
$res->bindValue(':user_id', $_SESSION['id'], PDO::PARAM_INT);
$res->execute();
$sn = 1;
?>
	<table border="1" width="100%">
	<tr><th>S.N.</th><th>Name</th><th>Date</th><th>Status</th><th>Edit</th><th>Delete</th></tr>
	<?php 
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
    echo "<tr><td>{$sn}</td><td class='cat-name'>" . $row['category_name'] . "</td><td>" . $row['date'] . "</td><td>" . $row['status'] . "</td><td><a href=\"#\" rel=\"" . $row['category_id'] . "\" class=\"edit\">edit</p></td><td><a onclick=\"return confirm('Are you sure you want to delete?')\" href=\"video-category.php?delete=" . $row['category_id'] . "\">Delete</a></td></tr>";
    $sn++;
}
Esempio n. 7
0
 function execute($param, $post)
 {
     if (count($param) > 0 && $param[0] == "act") {
         $obj = json_decode($post["json"]);
         $group = GetSingleByCondition(DRINKERCYCLE_TABLE, array("Name" => $obj->Name));
         if ($group instanceof DrinkerCycle) {
             if ($obj->Action == "exists") {
                 $groupRela = GetSingleByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $group->Id));
                 return ReturnBoolean($groupRela != null);
             } else {
                 if ($obj->Action == "add") {
                     $drinker = GetSingleByCondition(DRINKER_TABLE, array("Guid" => $obj->Guid));
                     if ($drinker instanceof Drinker) {
                         $presGroupRelation = GetSingleByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $group->Id, "DrinkerId" => $drinker->Id));
                         if ($presGroupRelation == null) {
                             $groupRela = GetSingleByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $group->Id));
                             $newRela = new DrinkerCyclesDrinkersRelation();
                             $newRela->DrinkerId = $drinker->Id;
                             $newRela->DrinkerCycleId = $group->Id;
                             $newRela->IsAuthenticated = $groupRela == null;
                             return ReturnBoolean(Insert(DRINKERCYCLESDRINKERSRELATION_TABLE, $newRela));
                         }
                         return ReturnBoolean(true);
                     } else {
                         return ReturnNotFound($obj->Guid, "Drinker");
                     }
                 } else {
                     if ($obj->Action == "remove") {
                         $drinker = GetSingleByCondition(DRINKER_TABLE, array("Guid" => $obj->Guid));
                         if ($drinker instanceof Drinker) {
                             $groupRela = GetSingleByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $group->Id, "DrinkerId" => $drinker->Id));
                             if ($groupRela instanceof DrinkerCyclesDrinkersRelation) {
                                 return ReturnBoolean(DeleteById(DRINKERCYCLESDRINKERSRELATION_TABLE, $groupRela->Id));
                             } else {
                                 return RelationNotFound($group->Id, $drinker->Id, DRINKERCYCLESDRINKERSRELATION_TABLE);
                             }
                         } else {
                             return ReturnNotFound($obj->Guid, DRINKER_TABLE);
                         }
                     } else {
                         if ($obj->Action == "authenticate" || $obj->Action == "deauthenticate") {
                             $newVal = true;
                             if ($obj->Action == "deauthenticate") {
                                 $newVal = false;
                             }
                             $drinker = GetSingleByCondition(DRINKER_TABLE, array("Guid" => $obj->Guid));
                             if ($drinker instanceof Drinker) {
                                 $groupRela = GetSingleByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $group->Id, "DrinkerId" => $drinker->Id));
                                 if ($groupRela instanceof DrinkerCyclesDrinkersRelation) {
                                     //can change others status
                                     if ($groupRela->IsAuthenticated) {
                                         $otherDrinker = GetSingleByCondition(DRINKER_TABLE, array("Guid" => $obj->AuthGuid));
                                         if ($otherDrinker instanceof Drinker) {
                                             $otherGroupRela = GetSingleByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $group->Id, "DrinkerId" => $otherDrinker->Id));
                                             if ($otherGroupRela instanceof DrinkerCyclesDrinkersRelation) {
                                                 $otherGroupRela->IsAuthenticated = $newVal;
                                                 return ReturnBoolean(Update(DRINKERCYCLESDRINKERSRELATION_TABLE, $otherGroupRela));
                                             } else {
                                                 return RelationNotFound($group->Id, $otherDrinker->Id, DRINKERCYCLESDRINKERSRELATION_TABLE);
                                             }
                                         } else {
                                             return ReturnNotFound($obj->AuthGuid, "Drinker");
                                         }
                                     } else {
                                         //not authenticated
                                         return ReturnBoolean(false);
                                     }
                                 } else {
                                     return RelationNotFound($group->Id, $drinker->Id, DRINKERCYCLESDRINKERSRELATION_TABLE);
                                 }
                             } else {
                                 return ReturnNotFound($obj->Guid, "Drinker");
                             }
                         } else {
                             if ($obj->Action == "removeforeign") {
                                 $drinker = GetSingleByCondition(DRINKER_TABLE, array("Guid" => $obj->Guid));
                                 if ($drinker instanceof Drinker) {
                                     $groupRela = GetSingleByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $group->Id, "DrinkerId" => $drinker->Id));
                                     if ($groupRela instanceof DrinkerCyclesDrinkersRelation) {
                                         //can change others status
                                         if ($groupRela->IsAuthenticated) {
                                             $otherDrinker = GetSingleByCondition(DRINKER_TABLE, array("Guid" => $obj->AuthGuid));
                                             if ($otherDrinker instanceof Drinker) {
                                                 $otherGroupRela = GetSingleByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $group->Id, "DrinkerId" => $otherDrinker->Id));
                                                 if ($otherGroupRela instanceof DrinkerCyclesDrinkersRelation) {
                                                     return ReturnBoolean(Delete(DRINKERCYCLESDRINKERSRELATION_TABLE, $otherGroupRela));
                                                 } else {
                                                     return RelationNotFound($group->Id, $otherDrinker->Id, DRINKERCYCLESDRINKERSRELATION_TABLE);
                                                 }
                                             } else {
                                                 return ReturnNotFound($obj->AuthGuid, "Drinker");
                                             }
                                         } else {
                                             //not authenticated
                                             return ReturnBoolean(false);
                                         }
                                     } else {
                                         return RelationNotFound($group->Id, $drinker->Id, DRINKERCYCLESDRINKERSRELATION_TABLE);
                                     }
                                 } else {
                                     return ReturnNotFound($obj->Guid, "Drinker");
                                 }
                             } else {
                                 return ReturnError(LINK_INVALID);
                             }
                         }
                     }
                 }
             }
         }
         if ($obj->Action == "exists") {
             return ReturnBoolean(false);
         } else {
             if ($obj->Action == "add") {
                 $newGroup = new DrinkerCycle();
                 $newGroup->Name = $obj->Name;
                 $newGroup->Guid = GenerateGuid();
                 if (Insert(DRINKERCYCLE_TABLE, $newGroup)) {
                     return $this->execute($param, $post);
                 } else {
                     return ReturnCrudError($newGroup, "add");
                 }
             } else {
                 return ReturnNotFound($obj->Guid, DRINKERCYCLE_TABLE);
             }
         }
     } else {
         if (ValidateGuid($param[0])) {
             //construct model puh
             $drinker = GetByGuid("Drinker", $param[0]);
             if ($drinker != null && $drinker instanceof Drinker) {
                 $relations = GetAllByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerId" => $drinker->Id));
                 $cyclesEnt = array();
                 $cycles = array();
                 $authCycles = array();
                 foreach ($relations as $relation) {
                     if ($relation instanceof DrinkerCyclesDrinkersRelation) {
                         $cycle = GetById(DRINKERCYCLE_TABLE, $relation->DrinkerCycleId);
                         if ($cycle instanceof DrinkerCycle) {
                             if ($relation->IsAuthenticated) {
                                 $cycl = new DrinkerCycleEntity($cycle);
                                 $cycl->IsAuthenticated = true;
                                 $authCycles[] = $cycle;
                                 $cyclesEnt[] = $cycl;
                             } else {
                                 $cycles[] = $cycle;
                                 $cycl = new DrinkerCycleEntity($cycle);
                                 $cycl->IsAuthenticated = false;
                                 $cyclesEnt[] = $cycl;
                             }
                         }
                     }
                 }
                 $drinkers = array();
                 foreach ($authCycles as $cycle) {
                     $userRelations = GetAllByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerCycleId" => $cycle->Id));
                     foreach ($userRelations as $userRelation) {
                         if ($userRelation instanceof DrinkerCyclesDrinkersRelation) {
                             //exclude self
                             if ($drinker->Id != $userRelation->DrinkerId) {
                                 if (!isset($drinkers[$userRelation->DrinkerId])) {
                                     $user = GetById(DRINKER_TABLE, $userRelation->DrinkerId);
                                     if ($user instanceof Drinker) {
                                         $drinkers[$userRelation->DrinkerId] = new DrinkerEntity($user);
                                     }
                                 }
                                 if ($drinkers[$userRelation->DrinkerId] instanceof DrinkerEntity) {
                                     if ($userRelation->IsAuthenticated) {
                                         $drinkers[$userRelation->DrinkerId]->AuthDrinkerCycles[] = $cycle->Guid;
                                     } else {
                                         $drinkers[$userRelation->DrinkerId]->NonAuthDrinkerCycles[] = $cycle->Guid;
                                     }
                                 }
                             }
                         }
                     }
                 }
                 $coll = new DrinkerCycleResponse();
                 $coll->DrinkerCycles = $cyclesEnt;
                 foreach ($drinkers as $drinker) {
                     $coll->Drinkers[] = $drinker;
                 }
                 return json_encode($coll);
             } else {
                 return ReturnNotFound($param[0], "Drinker");
             }
         } else {
             return ReturnError(LINK_INVALID);
         }
     }
 }
Esempio n. 8
0
    $location = $_GET["location"];
} else {
    $location = $_POST["location"];
}
/* check the action */
if ($action == "addform") {
    AddForm("", $name, $description, $location);
}
if ($action == "add") {
    Add($name, $description, $location);
} elseif ($action == "editform") {
    EditForm("", $id);
} elseif ($action == "edit") {
    Edit($id, $name, $description, $location);
} elseif ($action == "delete") {
    Delete($id);
} elseif ($action == "" || $action == "list") {
    DisplayList();
}
/* ----------------------------------------------- */
/* --------- DisplayList ------------------------- */
/* ----------------------------------------------- */
function DisplayList()
{
    ?>
		<style>
			.header { font-weight: bold; color: darkblue; border-top: 2px solid gray; border-bottom: 1px solid gray;}
		</style>
		<table><tr><td><img src="images/back16.png"></td><td><a href="index.php" class="link">Back</a> to Calendar</td></tr></table><br>
		<br>
		<table width="100%">
Esempio n. 9
0
            header("Location: /UserController.php");
        } else {
            // Formulario relleno con los datos
            $id = $_GET['id'];
            $_GET['filename'] = 'user.txt';
            include "../modules/Application/views/user/update.phtml";
        }
        break;
    case 'select':
        // Leer el archivo de texto en un string
        $users = file_get_contents('user.txt');
        // convertir el string en array separando por saltos de linea
        $users = explode("\n", $users);
        include "../modules/Application/views/user/select.phtml";
        break;
    case 'delete':
        if ($_POST) {
            if ($_POST['submit'] == 'si') {
                include "../modules/Application/src/Application/Model/Txt/Delete.php";
                Delete($_POST['id'], 'user.txt');
            }
            // Saltar a select
            header("Location: /UserController.php");
        } else {
            // Formulario de si/no para user id
            $id = $_GET['id'];
            $name = $_GET['id'];
            include "../modules/Application/views/user/delete.phtml";
        }
        break;
}
Esempio n. 10
0
/* check the action */
if ($action == "addform") {
    DisplayForm("", "", "", $username, $calendarid, $projectid, $details, $title, $startdatetime, $enddatetime, $isalldayevent, $istimerequest, $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate);
}
if ($action == "add") {
    Add("add", "", "", $username, $calendarid, $projectid, $details, $title, $startdatetime, $enddatetime, $isalldayevent, $istimerequest, $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate, 0);
} elseif ($action == "editform") {
    DisplayForm($id, "", "", "", "", "", "", "", "", "", "", "", $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate);
} elseif ($action == "edit") {
    Add("update", $id, $groupid, $username, $calendarid, $projectid, $details, $title, $startdatetime, $enddatetime, $isalldayevent, $istimerequest, $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate, 0);
} elseif ($action == "editall") {
    Add("update", $id, $groupid, $username, $calendarid, $projectid, $details, $title, $startdatetime, $enddatetime, $isalldayevent, $istimerequest, $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate, 1);
} elseif ($action == "delete") {
    Delete($id, $currentcal, 0);
} elseif ($action == "deleteall") {
    Delete($groupid, $currentcal, 1);
} elseif ($action == "cancel") {
    Cancel($id, $currentcal, $cancelreason, $notifyusers, 0);
} elseif ($action == "cancelall") {
    Cancel($groupid, $currentcal, $cancelreason, $notifyusers, 1);
} elseif ($action == "" || $action == "list") {
    //DisplayList();
    echo "Nothing to do";
}
/* ----------------------------------------------- */
/* --------- Add --------------------------------- */
/* ----------------------------------------------- */
function Add($method, $id, $groupid, $username, $calendarid, $projectid, $details, $title, $startdatetime, $enddatetime, $isalldayevent, $istimerequest, $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate, $editall)
{
    /* check if any form elements are bad, if so redisplay the addform */
    if ($title == "") {
<?php
if(isset($_GET["verbose"])){ini_set('html_errors',0);ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string','');ini_set('error_append_string','');}
	include_once('ressources/class.templates.inc');
	include_once('ressources/class.users.menus.inc');
	include_once('ressources/class.mysql.inc');
	include_once('ressources/class.squid.acls.inc');
	include_once('ressources/class.squid.inc');
	
	$users=new usersMenus();
	if(!$users->AsDansGuardianAdministrator){die();}	
	if(isset($_GET["events"])){popup_list();exit;}
	if(isset($_GET["popup"])){popup();exit;}
	if(isset($_POST["delete"])){Delete();exit;}
	if(isset($_GET["add-www-js"])){add_www_js();exit;}
	if(isset($_GET["add-nocache-js"])){add_nocache_js();exit;}
	
	
	
	if(isset($_GET["add-nocache-popup"])){add_nocache_popup();exit;}
	if(isset($_GET["add-white-popup"])){add_white_popup();exit;}
	if(isset($_GET["add-white-tab"])){add_white_tab();exit;}
	
	if(isset($_GET["add-black-js"])){add_black_js();exit;}
	if(isset($_GET["add-black-popup"])){add_black_popup();exit;}
	if(isset($_POST["blacklist"])){add_black_save();exit;}
	if(isset($_POST["whitelist"])){add_white_save();exit;}
	if(isset($_POST["nocache"])){add_nocache_save();exit;}
	if(isset($_POST["whitelist-single"])){add_white_single();exit;}
	
	
	js();
Esempio n. 12
0
    $page = mysql_escape_string($_GET['page']);
}
if ($page) {
    $start = ($page - 1) * $limit;
} else {
    $start = 0;
}
$cat_qry = "SELECT * FROM tbl_news_category ORDER BY tbl_news_category.cid LIMIT {$start}, {$limit}";
$cat_result = mysql_query($cat_qry);
if (isset($_GET['cat_id'])) {
    $img_res = mysql_query('SELECT * FROM tbl_news_category WHERE cid=\'' . $_GET['cat_id'] . '\'');
    $img_row = mysql_fetch_assoc($img_res);
    if ($img_row['category_image'] != "") {
        unlink('upload/category/' . $img_row['category_image']);
    }
    Delete('tbl_news_category', 'cid=' . $_GET['cat_id'] . '');
    $_SESSION['msg'] = "7";
    header("Location:category");
    exit;
}
//Active and Deactive status
if (isset($_GET['status_deactive_id'])) {
    $data = array('status' => '0');
    $edit_list = Update('tbl_news_category', $data, "WHERE cid = '" . $_GET['status_deactive_id'] . "'");
    $_SESSION['msg'] = "9";
    header("Location:category");
    exit;
}
if (isset($_GET['status_active_id'])) {
    $data = array('status' => '1');
    $edit_list = Update('tbl_news_category', $data, "WHERE cid = '" . $_GET['status_active_id'] . "'");
Esempio n. 13
0
        } else {
            // Formulario relleno con los datos
            $id = $router['params']['id'];
            $_GET['filename'] = $userfilename;
            include "../modules/Application/views/user/update.phtml";
        }
        break;
    case 'index':
    case 'select':
        // Leer el archivo de texto en un string
        $users = file_get_contents($userfilename);
        // convertir el string en array separando por saltos de linea
        $users = explode("\n", $users);
        include "../modules/Application/views/user/select.phtml";
        break;
    case 'delete':
        if ($_POST) {
            if ($_POST['submit'] == 'si') {
                include "../modules/Application/src/Application/Model/Txt/Delete.php";
                Delete($_POST['id'], $userfilename);
            }
            // Saltar a select
            header("Location: /user/select");
        } else {
            // Formulario de si/no para user id
            $id = $router['params']['id'];
            $name = $router['params']['id'];
            include "../modules/Application/views/user/delete.phtml";
        }
        break;
}
Esempio n. 14
0
 function execute($param, $post)
 {
     if (count($param) > 0) {
         if ($param[0] == "act") {
             $obj = json_decode($post["json"]);
             $user = GetByGuid("Drinker", $obj->Guid);
             if ($obj->Action == "exists") {
                 return ReturnBoolean($user != null);
             } else {
                 if ($obj->Action == "update") {
                     if ($user instanceof Drinker) {
                         $user->Name = $obj->UserInformations->Name;
                         $user->Color = $obj->UserInformations->Color;
                         return ReturnBoolean(Update(DRINKER_TABLE, $user));
                     } else {
                         $user = new Drinker();
                         $user->Name = $obj->UserInformations->Name;
                         $user->Color = $obj->UserInformations->Color;
                         $user->Guid = $obj->Guid;
                         return ReturnBoolean(Insert(DRINKER_TABLE, $user));
                     }
                 } else {
                     if ($obj->Action == "remove") {
                         if ($user instanceof Drinker) {
                             //remove all DrinkerCycleRelations
                             $relations = GetAllByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerId" => $user->Id));
                             if (DeleteAll($relations)) {
                                 return ReturnBoolean(Delete(DRINKER_TABLE, $user));
                             } else {
                                 return ReturnCrudError($relations, "DeleteAll");
                             }
                         } else {
                             return ReturnNotFound($obj->Guid, "Drinker");
                         }
                     }
                 }
             }
         } else {
             if (ValidateGuid($param[0])) {
                 $user = GetByGuid("Drinker", $param[0]);
                 if ($user instanceof Drinker) {
                     $drinker = new DrinkerEntity($user);
                     $relations = GetAllByCondition(DRINKERCYCLESDRINKERSRELATION_TABLE, array("DrinkerId" => $drinker->Id));
                     foreach ($relations as $relation) {
                         if ($relation instanceof DrinkerCyclesDrinkersRelation) {
                             $cycle = GetById(DRINKER_TABLE, $relation->DrinkerCycleId);
                             if ($cycle instanceof DrinkerCycle) {
                                 if ($relation->IsAuthenticated) {
                                     $drinker->AuthDrinkerCycles[] = $cycle->Guid;
                                 } else {
                                     $drinker->NonAuthDrinkerCycles[] = $cycle->Guid;
                                 }
                             }
                         }
                     }
                     $resp = new DrinkerResponse();
                     $resp->Drinker = $drinker;
                     return json_encode($resp);
                 } else {
                     return ReturnNotFound($param[0], "Drinker");
                 }
             }
         }
     }
     return ReturnError(LINK_INVALID);
 }
<?php

require 'logic/CoreLogic.php';
if (!isset($_GET['id'])) {
    header("Location:index.php");
}
$id = "";
$id = $_GET['id'];
loginChek($link);
if (isset($_POST['id'])) {
    Delete($link);
} else {
    $pagecontent = getSingleRecord($link);
}
require 'templates/header.php';
require 'templates/remove.php';
require 'templates/footer.php';
Esempio n. 16
0
if (!isset($_SESSION)) {
    session_start();
}
$result = -1;
//khong co truy van
include_once '../include/functions.php';
include_once '../objects/danhmuc.php';
include_once '../objects/danhmuccon.php';
include_once '../objects/taikhoan.php';
include_once '../objects/tailieu.php';
include_once '../objects/binhluan.php';
include_once '../objects/yeuthich.php';
if (isset($_SESSION['taikhoan'])) {
    $tk = unserialize($_SESSION['taikhoan']);
    if ($tk->Admin == 1) {
        if (isset($_GET['t']) && isset($_GET['id'])) {
            $r = Delete($_GET['t'], $_GET['id']);
            if ($r > 0) {
                $result = 1;
            } else {
                $result = 0;
            }
            //khong thanh cong
        }
    } else {
        $result = -2;
        //khong co quyen admin
    }
}
echo $result;
Esempio n. 17
0
        WHERE 
            u.ID = l.USER_ID 
            AND 
            k.ID = l.KIND_ID 
            AND 
            p.ID = l.PAY_METHOD_ID
            AND
            l.DEL_FLG = 0;
        ';
// PDOを使用しSQL送信
$stmt = $pdo->query($sql);
// 合計の定義
$sum = 0;
// 配列の定義
$array = array();
echo "<table border='1'><th>決済ID</th><th>ユーザ</th><th>種類</th><th>決済方法</th><th>価格</th><th>購入日時</th><th>削除</th>";
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
    echo "<tr><td>", $row['ID'], "</td>", "<td>", $row['USER'], "</td>", "<td>", $row['KIND'], "</td>", "<td>", $row['PAY_METHOD'], "</td>", "<td>", $row['PRICE'], "</td>", "<td>", $row['PAY_DATE'], "</td>", "<td><form action='../../php/'><input type='submit' name='" . $row['ID'] . "' value='" . $row['ID'] . "'></form></td></tr>";
    // 配列にIDを入れていく
    $array[] = $row['ID'];
}
include "../../php/common/pay_regist_delete.php";
$sum += $row['PRICE'];
echo '</table>';
echo "合計金額", $sum, "<br>";
echo "1人頭金額", round($sum / 2);
if (isset($POST['59'])) {
    include "";
    $sum = Delete();
    echo 'ボタンがおされた';
}
Esempio n. 18
0
        xoops_cp_header();
        include 'functions.php';
        DP_ShowNav();
        echo "<table width='60%' align='center' cellspacing='1' class='outer'>\n\t\t\t\t<tr><td align='center' class='even'>\n\t\t\t\t<form name='frmDel' method='post' action='os.php'>\n\t\t\t\t<br><br>" . _AM_RMDP_CONFIRM . "<br><br>\n\t\t\t\t<input type='submit' name='sbt' value='" . _AM_RMDP_DELETE . "'>\n\t\t\t\t<input type='button' value='" . _AM_RMDP_CANCEL . "' name='cancel' onClick='history.go(-1);'>\n\t\t\t\t<input type='hidden' name='op' value='del'>\n\t\t\t\t<input type='hidden' name='ido' value='{$ido}'>\n\t\t\t\t<input type='hidden' name='ok' value='1'>\n\t\t\t\t</td></tr></table>";
        xoops_cp_footer();
    }
}
/**
 * Que accion tomar
 */
$op = $_GET['op'];
if ($op <= 0) {
    $op = $_POST['op'];
}
switch ($op) {
    case 'save':
        Save();
        break;
    case 'mod':
        Modify();
        break;
    case 'savemod':
        SaveMod();
        break;
    case 'del':
        Delete();
        break;
    default:
        Main();
        break;
}
Esempio n. 19
0
}
if ($page) {
    $start = ($page - 1) * $limit;
} else {
    $start = 0;
}
$news_qry = "SELECT * FROM tbl_news ORDER BY tbl_news.nid LIMIT {$start}, {$limit}";
$news_result = mysql_query($news_qry);
if (isset($_GET['news_id'])) {
    $img_res = mysql_query('SELECT * FROM tbl_news WHERE nid=\'' . $_GET['news_id'] . '\'');
    $img_row = mysql_fetch_assoc($img_res);
    if ($img_row['news_image'] != "") {
        unlink('upload/' . $img_row['news_image']);
        unlink('upload/thumbs/' . $img_row['news_image']);
    }
    Delete('tbl_news', 'nid=' . $_GET['news_id'] . '');
    $_SESSION['msg'] = "12";
    header("Location:news");
    exit;
}
//Active and Deactive status
if (isset($_GET['status_deactive_id'])) {
    $data = array('news_status' => '0');
    $edit_status = Update('tbl_news', $data, "WHERE nid = '" . $_GET['status_deactive_id'] . "'");
    $_SESSION['msg'] = "14";
    header("Location:news");
    exit;
}
if (isset($_GET['status_active_id'])) {
    $data = array('news_status' => '1');
    $edit_status = Update('tbl_news', $data, "WHERE nid = '" . $_GET['status_active_id'] . "'");