Example #1
0
function deleteData($db, $Id, &$i = 0)
{
    // to check that whether child exists
    $sql = sprintf('SELECT
				 		Id, slave, position, ownerEl 
					FROM ' . TREE_TABLE_PREFIX . '_elements
					WHERE 
						ownerEl = %d ', $Id);
    $row = NULL;
    $i++;
    echo $i;
    if ($result = $db->query($sql)) {
        while ($row = $db->fetchObject($result)) {
            // if element type is not slave,
            // there can be childs belonging to that master
            if ($row->slave == "0") {
                // recursive operation, to reach the deepest element
                deleteData($db, $row->Id, $i);
            }
        }
    }
    $i--;
    // only update the elements' position on the same level of our first element
    if ($i == 0) {
        $sql = sprintf('SELECT 
							position, ownerEl
						FROM ' . TREE_TABLE_PREFIX . '_elements
						WHERE
							Id = %d', $Id);
        if ($result = $db->query($sql)) {
            if ($row = $db->fetchObject($result)) {
                $sql = sprintf('UPDATE ' . TREE_TABLE_PREFIX . '_elements
								SET 
									position = position - 1
								WHERE 
									ownerEl = %d
									AND
									position > %d', $row->ownerEl, $row->position);
                $db->query($sql);
            }
        }
    }
    // start to delete it from bottom to top
    $sql = sprintf('DELETE FROM ' . TREE_TABLE_PREFIX . '_elements
	        		WHERE 
			        	ownerEl = %d 
			        	OR
			        	Id = %d ', $Id, $Id);
    if (!$db->query($sql)) {
        return false;
    }
    return true;
}
Example #2
0
    switch ($_POST[action]) {
        case 'save':
            // <<< SIMPAN DATA >>>
            if ($_POST[id] == 0) {
                // <<< SIMPAN DATA BARU >>>
                $elemen = array('kode', 'nama', 'id_golongan', 'id_satuan', 'barcode', 'harga_beli', 'persen_markup', 'stok');
                $pesan = addNew('barang', $elemen);
            } else {
                // <<< UDATE DATA LAMA >>>
                $elemen = array('kode', 'nama', 'id_golongan', 'id_satuan', 'barcode', 'harga_beli', 'persen_markup', 'stok');
                $pesan = updateOld('barang', $elemen, $_POST[id]);
            }
            break;
        case 'delete':
            // <<< HAPUS DATA >>>
            $pesan = deleteData('barang', $_POST[id]);
            break;
        case 'new':
            // <<< KOSONGKAN FORM >>>
            header("location: " . $_SERVER['PHP_SELF']);
            break;
    }
    // <<< ATUR ALERT >>>
    if (strlen($pesan) > 0) {
        $pesan = '<div class="box">' . $pesan . '</div>';
    }
    $tampil_baru = true;
} else {
    if (empty($_GET[id])) {
        $tampil_baru = true;
    }
<?php

include_once '../utiliti/koneksi.php';
include_once '../utiliti/crud_function.php';
// Ambil parameter
$id = isset($_GET['id']) ? $_GET['id'] : null;
$query = $conn->query("SELECT img FROM calon WHERE id_calon='{$id}'");
$fetch_data = $query->fetch_array();
$dir = "../img/{$fetch_data['img']}";
//hapus file foto
unlink($dir);
// eksekusiquery
$query_del = deleteData('calon', 'id_calon', $id, $conn);
$query_del;
if ($query_del) {
    ?>
		<script>
			alert("Data Berhasil di Hapus !!");
			location.href = "?page=master&ref=data_calon";
		</script>
		<?php 
}
<?php

include "connect.php";
if (isset($_GET["id"])) {
    $id = $_GET["id"];
}
$musteri = getData();
foreach ($musteri as $row) {
    $sil1 = $row["image_80_80"];
    $sil2 = $row["image_200_200"];
    $sil3 = $row["image_300_300"];
}
$musteri = deleteData($id);
if ($musteri) {
    unlink($sil1);
    unlink($sil2);
    unlink($sil3);
    header("location:index.php");
} else {
    echo "Silinemedi";
    header("location:index.php");
}
Example #5
0
            }
            $chP = $recId == $recPrnt ? 'checked' : '';
            $chC = $recId != $recPrnt ? 'checked' : '';
            if (isset($_POST['act']) && base64_decode(trim($_POST['act'])) == '1') {
                $val = 'CSC_DC_ID="' . $psId . '", CSC_DC_NAME="' . $psNm . '", CSC_DC_PARENT="' . $psPrnt . '"';
                $bOk = changeData($DBLink, $tbl, $val, $crt = 'CSC_DC_ID="' . $reqId . '"');
                if ($bOk) {
                    echo '<script>' . 'alert("Berhasil mengubah data ' . $reqId . '.");' . 'location.href="index.php";' . '</script>';
                } else {
                    echo '<script>' . 'alert("GAGAL mengubah  data ' . $reqId . '.");' . 'location.href="index.php";' . '</script>';
                }
            }
            break;
        case 'dl':
            $reqId = isset($_REQUEST['id']) ? base64_decode(trim($_REQUEST['id'])) : "";
            $bOk = deleteData($DBLink, $tbl, $crt = 'CSC_DC_ID="' . $reqId . '"');
            if ($bOk) {
                echo '<script>' . 'alert("Berhasil menghapus data ' . $reqId . '.");' . 'location.href="index.php";' . '</script>';
            } else {
                echo '<script>' . 'alert("GAGAL menghapus  data ' . $reqId . '.");' . 'location.href="index.php";' . '</script>';
            }
            break;
        default:
    }
}
/* -----------------------------------------------------------
 * query untuk menampilkan seluruh record
 * -----------------------------------------------------------
 */
$crtCari = '';
$reqTxtCari = '';
Example #6
0
}
echo "</ul>";
?>


<?php 
require_once "functions.php";
if (!isset($_SESSION["logged_in_user_id"])) {
    header("Location: login.php");
}
// kas kustutame
// ?delete=vastav id mida kustutada on aadressireal
if (isset($_GET["delete"])) {
    echo "Kustutame id " . $_GET["delete"];
    //kaivitan funktsiooni, saadan kaasa id!
    deleteData($_GET["delete"]);
}
//salvestan andmebaasi uuendused
if (isset($_POST["save"])) {
    var_dump($_POST);
    updateData($_POST["register_id"], $_POST["name"], $_POST["address"], $_POST["phone_number"], $_POST["register_code"]);
}
$keywod = "";
//aadressireal on keyword
if (isset($_GET["keyword"])) {
    //otsin
    $keyword = $_GET["keyword"];
    $array_of_data = getData($keyword);
} else {
    //kusin koik andmed
    //kaivitan funktsiooni
Example #7
0
    switch ($_POST[action]) {
        case 'save':
            // <<< SIMPAN DATA >>>
            if ($_POST[id] == 0) {
                // <<< SIMPAN DATA BARU >>>
                $elemen = array('kode', 'nama', 'alamat', 'telepon', 'fax', 'kontak');
                $pesan = addNew('pelanggan', $elemen);
            } else {
                // <<< UDATE DATA LAMA >>>
                $elemen = array('kode', 'nama', 'alamat', 'telepon', 'fax', 'kontak');
                $pesan = updateOld('pelanggan', $elemen, $_POST[id]);
            }
            break;
        case 'delete':
            // <<< HAPUS DATA >>>
            $pesan = deleteData('pelanggan', $_POST[id]);
            break;
        case 'new':
            // <<< KOSONGKAN FORM >>>
            header("location: " . $_SERVER['PHP_SELF']);
            break;
    }
    // <<< ATUR ALERT >>>
    if (strlen($pesan) > 0) {
        $pesan = '<div class="box">' . $pesan . '</div>';
    }
    $tampil_baru = true;
} else {
    if (empty($_GET[id])) {
        $tampil_baru = true;
    }
<!-- 
<script type="text/javascript">


function delete(){

<?php 
deleteData($key->id);
?>




}


function add(){



<?php 
sentData();
?>

}


	$save=$_POST['btn'];
	$delete=$_POST['btn2'];
	echo $save.$delete;
<?php

include_once '../utiliti/koneksi.php';
include_once '../utiliti/crud_function.php';
// Ambil parameter
$id = isset($_GET['id']) ? $_GET['id'] : null;
// eksekusiquery
$query_del = deleteData('voter', 'id_pemilih', $id, $conn);
$query_del;
if ($query_del) {
    ?>
		<script>
			alert("Data Berhasil di Hapus !!");
			location.href = "?page=master&ref=data_pemilih";
		</script>
		<?php 
}
Example #10
0
								<button type="submit" name="silinecekVeri" value="<?php 
    echo $key->id;
    ?>
"  style="background-color:#212121;" class="commentYazilarim">
									Sil </button>
								<!--<a href="#" adminSent.php?$id=<?php 
    $key->id;
    ?>
 class="commentYazilarim">Sil</a>-->

						</div>
					</form>
				</div><br>
			
		<?php 
}
?>
		</div>
		
		<div id="bottom">
			<p class="info">Bu Web Sitesi Halil Barım Tarafından Yapılmıştır...</p>
		</div>
		
	</div>
</body>
</html>
<?php 
if ($_POST) {
    deleteData($_POST['silinecekVeri']);
    header("Refresh:0");
}
Example #11
0
    switch ($_POST[action]) {
        case 'save':
            // <<< SIMPAN DATA >>>
            if ($_POST[id] == 0) {
                // <<< SIMPAN DATA BARU >>>
                $elemen = array('kode', 'nama', 'alamat', 'telepon', 'fax', 'kontak');
                $pesan = addNew('pemasok', $elemen);
            } else {
                // <<< UDATE DATA LAMA >>>
                $elemen = array('kode', 'nama', 'alamat', 'telepon', 'fax', 'kontak');
                $pesan = updateOld('pemasok', $elemen, $_POST[id]);
            }
            break;
        case 'delete':
            // <<< HAPUS DATA >>>
            $pesan = deleteData('pemasok', $_POST[id]);
            break;
        case 'new':
            // <<< KOSONGKAN FORM >>>
            header("location: " . $_SERVER['PHP_SELF']);
            break;
    }
    // <<< ATUR ALERT >>>
    if (strlen($pesan) > 0) {
        $pesan = '<div class="box">' . $pesan . '</div>';
    }
    $tampil_baru = true;
} else {
    if (empty($_GET[id])) {
        $tampil_baru = true;
    }
Example #12
0
            } else {
                // <<< UDATE DATA LAMA >>>
                if (empty($_POST[password])) {
                    // <<< UDATE TANPA PASSWORD >>>
                    $elemen = array('username', 'nama_lengkap', 'id_status');
                    $pesan = updateOld('pengguna', $elemen, $_POST[id]);
                } else {
                    // <<< UDATE DENGAN PASSWORD >>>
                    $elemen = array('username', 'password', 'nama_lengkap', 'id_status');
                    $pesan = updateOld('pengguna', $elemen, $_POST[id]);
                }
            }
            break;
        case 'delete':
            // <<< HAPUS DATA >>>
            $pesan = deleteData('pengguna', $_POST[id]);
            break;
        case 'new':
            // <<< KOSONGKAN FORM >>>
            header("location: " . $_SERVER['PHP_SELF']);
            break;
    }
    // <<< ATUR ALERT >>>
    if (strlen($pesan) > 0) {
        $pesan = '<div class="box">' . $pesan . '</div>';
    }
    $tampil_baru = true;
} else {
    if (empty($_GET[id])) {
        $tampil_baru = true;
    }
<?php

$id = filter_input(INPUT_GET, 'id');
$deleteResult = deleteData($id);
if ($deleteResult !== true) {
    echo "<h3> Data did not delete!</h3>";
}
header("Location: index.php");
Example #14
0
function deleteGridDataQOFiles($fMemberId)
{
    $key = $_POST['key'];
    $arr = $_POST['deleteKeys'];
    $count = 0;
    $selectedRows = json_decode(stripslashes($arr));
    //decode the data from json format
    //should validate and clean data prior to posting to the database
    foreach ($selectedRows as $row_id) {
        $id = (int) $row_id;
        $fileName = getPluginFileById($id);
        if (deleteData('`qo_files`', '`' . $key . '` = ' . $id)) {
            $count++;
            $auditState = 'SUCCESS';
        } else {
            $auditState = 'FAILURE';
        }
        writeAudit($fMemberId, $auditState, 'Delete plugin file (' . $fileName . ')');
    }
    if ($count) {
        //only checks if the last record was deleted, others may have failed
        /* If using ScriptTagProxy:  In order for the browser to process the returned
           data, the server must wrap te data object with a call to a callback function,
           the name of which is passed as a parameter by the ScriptTagProxy. (default = "stcCallback1001")
           If using HttpProxy no callback reference is to be specified*/
        $cb = isset($_GET['callback']) ? $_GET['callback'] : '';
        $response = array('success' => $count, 'del_count' => $count);
        $json_response = json_encode($response);
        return $cb . $json_response;
    } else {
        return '{failure: true}';
    }
}
Example #15
0
    switch ($_POST[action]) {
        case 'save':
            // <<< SIMPAN DATA >>>
            if ($_POST[id] == 0) {
                // <<< SIMPAN DATA BARU >>>
                $elemen = array('kode', 'nama', 'keterangan');
                $pesan = addNew('golongan', $elemen);
            } else {
                // <<< UDATE DATA LAMA >>>
                $elemen = array('kode', 'nama', 'keterangan');
                $pesan = updateOld('golongan', $elemen, $_POST[id]);
            }
            break;
        case 'delete':
            // <<< HAPUS DATA >>>
            $pesan = deleteData('golongan', $_POST[id]);
            break;
        case 'new':
            // <<< KOSONGKAN FORM >>>
            header("location: " . $_SERVER['PHP_SELF']);
            break;
    }
    // <<< ATUR ALERT >>>
    if (strlen($pesan) > 0) {
        $pesan = '<div class="box">' . $pesan . '</div>';
    }
    $tampil_baru = true;
} else {
    if (empty($_GET[id])) {
        $tampil_baru = true;
    }
     $company_profile_data['logo_url'] = $company_profile->logoUrl;
     $company_profile_data['company_id'] = $company_profile->id;
     $company_profile_data['name'] = remove_spacial_1(remove_spacial(clean_insert($company_profile->name)));
     $company_profile_data['website'] = $company_profile->websiteUrl;
     $address = doImplode($company_profile->locations->values);
     $location = implode(",", $address);
     $company_profile_data['address'] = remove_spacial_1(remove_spacial(clean_insert($location)));
     $company_profile_data['followers'] = $company_profile->numFollowers;
     # GET SINGLE COMPANY DATA [END]
     $company_profile_datas[] = $company_profile_data;
     # COLLECT ALL COMPANY DATA
 }
 $where = array('project_id' => $project_id, 'user_auto_id' => $user_auto_id);
 if (getRowCount('tbl_linkedin_search_company_data', $where) > 0) {
     # DELETE COMPANY DATA FOR SAME USER
     deleteData('tbl_linkedin_search_company_data', $where);
 }
 $el = array();
 foreach ($company_profile_datas as &$el) {
     $el['project_id'] = $project_id;
     $el['search_opt'] = '';
     //$search_opt
     $el['user_auto_id'] = $user_auto_id;
     $el['updated_date'] = date('Y-m-d H:i:s');
 }
 if (is_multidimention_array($company_profile_datas)) {
     foreach ($company_profile_datas as $row) {
         # ADD NEW KEYWORD SEARCH DATA [COMPANY PROFILE]
         addData('tbl_linkedin_search_company_data', $row);
     }
 }
<meta charset="utf-8">

<?php 
include "dataBase.php";
$id = $_GET['id'];
deleteData($id);
header("refresh:2;url=index.php");
die('İşleminiz Gerçekleştiriliyor lütfen İşleminiz bekleyiniz.');
                         viewData("");
                     } else {
                         if ($action == "addData") {
                             manageData("add");
                         } else {
                             if ($action == "addData_submit") {
                                 manageData_submit("add");
                             } else {
                                 if ($action == "editData") {
                                     manageData("edit");
                                 } else {
                                     if ($action == "editData_submit") {
                                         manageData_submit("edit");
                                     } else {
                                         if ($action == "deleteData") {
                                             deleteData();
                                         } else {
                                             if ($action == "utils") {
                                                 utils();
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #19
0
        $sources = getSources();
        $rows = count($sources);
        $draw = 1;
        $json = array("draw" => $draw, "recordsTotal" => $rows, "recordsFiltered" => $rows, "data" => $sources);
        echo json_encode($json);
        break;
        //+++++++++++++++++++++++++++++++++++Sourcen für Datatable laden+++++++++++++++++++++++++++++++++++++++
        //+++++++++++++++++++++++++++++++++++Sourcen updaten++++++++++++++++++++++++++++++++++++++++++++++++++
    //+++++++++++++++++++++++++++++++++++Sourcen für Datatable laden+++++++++++++++++++++++++++++++++++++++
    //+++++++++++++++++++++++++++++++++++Sourcen updaten++++++++++++++++++++++++++++++++++++++++++++++++++
    case 'updateSource':
        global $mysqli;
        $sourceId = $_GET['sourceId'];
        $source_array = array("sources_name" => $_POST['source_name'], "sources_url" => $_POST['source_url'], "sources_status" => $_POST['source_status']);
        $where = "sources_id = " . $sourceId;
        updateData("sources", $source_array, $where);
        header('Location: /nurrap/admin/sources.php');
        break;
        //+++++++++++++++++++++++++++++++++++Sourcen updaten++++++++++++++++++++++++++++++++++++++++++++++++++
        //+++++++++++++++++++++++++++++++++++Sourcen löschen++++++++++++++++++++++++++++++++++++++++++++++++++
    //+++++++++++++++++++++++++++++++++++Sourcen updaten++++++++++++++++++++++++++++++++++++++++++++++++++
    //+++++++++++++++++++++++++++++++++++Sourcen löschen++++++++++++++++++++++++++++++++++++++++++++++++++
    case 'deleteSource':
        global $mysqli;
        $sourceId = $_GET['sourceId'];
        $where = "sources_id = " . $sourceId;
        deleteData("sources", $where);
        header('Location: /nurrap/admin/sources.php');
        break;
        //+++++++++++++++++++++++++++++++++++Sourcen löschen++++++++++++++++++++++++++++++++++++++++++++++++++
}