Ejemplo n.º 1
0
function BlokNPM()
{
    $BlokNPM = $_REQUEST['BlokNPM'];
    $KeteranganBlok = $_REQUEST['KeteranganBlok'];
    $s = "update khs set Blok='Y', KeteranganBlok='{$KeteranganBlok}'\r\n    where TahunID='{$_SESSION['tahun']}'\r\n      and MhswID='{$BlokNPM}' ";
    $r = _query($s);
    $jml = _affected_rows($r) + 0;
    if ($jml <= 0) {
        echo ErrorMsg("Gagal Blok", "Mahasiswa dgn NPM: <font size=+1>{$BlokNPM}</font> tidak dapat diblok.<br />\r\n    Mungkin tidak terdaftar di semester <font size=+1>{$_SESSION['tahun']}</font>");
    }
}
function fnProses()
{
    $tablesArray = array('alumni', 'bayarmhsw', 'bipot', 'bipotmhsw', 'dosen', 'fakultas', 'gradeipk', 'honordosen', 'jadwal', 'jenismk', 'kampus', 'karyawan', 'khs', 'konsentrasi', 'krs', 'maxsks', 'mhsw', 'mk', 'mkpaket', 'nilai', 'pejabat', 'pmb', 'pmbformjual', 'pmbformulir', 'pmbformsyarat', 'pmbgrade', 'pmbperiod', 'pmbsyarat', 'pmbweb', 'praktekkerja', 'presenter', 'prodi', 'prodiusm', 'program', 'rekening', 'ruang', 'statusmhsw', 'sumberinfo', 'ta', 'tabimbingan', 'tahun', 'wawancara', 'wawancarausm', 'wisuda', 'wisudawan');
    foreach ($tablesArray as $table) {
        $s1 = "update {$table} set KodeID='" . KodeID . "'";
        $r1 = _query($s1);
        $jml = _affected_rows($r1);
        echo "<li>Table {$table}, diproses: {$jml}</li>";
    }
    echo "</ol>";
    echo "<font size=+1>Selesai.</font>";
}
Ejemplo n.º 3
0
function prckhs()
{
    $prodi = $_SESSION['prodi'];
    $_SESSION['PRC-POS-' . $prodi]++;
    $pos = $_SESSION['PRC-POS-' . $prodi];
    $max = $_SESSION['PRC-Max-' . $prodi];
    $MhswID = $_SESSION['PRC-MhswID-' . $prodi . $pos];
    $ProgramID = $_SESSION['PRC-ProgramID-' . $prodi . $pos];
    $ProdiID = $_SESSION['PRC-ProdiID-' . $prodi . $pos];
    $persen = $max == 0 ? 0 : number_format($pos / $max * 100);
    if (!empty($MhswID)) {
        echo "<p>Processing: <b>{$MhswID}</b></p>\r\n    <p>Position: <b>{$pos}/{$max}</b> &raquo; <font size=+2>{$persen} %</font></p>";
        // Buat KHS
        $s = "select TahunID, sum(SKS) as TotalSKS, count(*) as JumlahMK \r\n      from krs \r\n      where MhswID='{$MhswID}' and StatusKRSID='A'\r\n      group by TahunID";
        $r = _query($s);
        $n = 0;
        while ($w = _fetch_array($r)) {
            $n++;
            $ada = GetaField('khs', "MhswID='{$MhswID}' and TahunID", $w['TahunID'], "KHSID");
            $TotalSKS = $w['TotalSKS'] + 0;
            $JumlahMK = $w['JumlahMK'] + 0;
            $StatusMhswID = $JumlahMK > 0 ? 'A' : 'P';
            if (empty($ada)) {
                $s0 = "insert into khs\r\n          (TahunID, KodeID, ProgramID, ProdiID, MhswID, Sesi,\r\n          StatusMhswID, JumlahMK, TotalSKS,\r\n          LoginBuat, TanggalBuat)\r\n          values\r\n          ('{$w['TahunID']}', 'UKRIDA', '{$ProgramID}', '{$ProdiID}', '{$MhswID}', {$n},\r\n          '{$StatusMhswID}', {$JumlahMK}, {$TotalSKS},\r\n          'BATCH PROCESSING', now())";
                $r0 = _query($s0);
                $ada['KHSID'] = GetLastID();
                $str = "<font size=+1>DIBUAT <font size=+1>{$n}</font></font>";
            } else {
                $s0 = "update khs set Sesi={$n}, StatusMhswID='{$StatusMhswID}' where KHSID={$ada}";
                $r0 = _query($s0);
                $str = "<font color=red>Updated <font size=+1>{$n}</font></font>";
            }
            // Perbaiki KRS
            $skrs = "update krs set KHSID={$ada['KHSID']} where MhswID='{$MhswID}' and TahunID='{$w['TahunID']}' and KHSID=0";
            $rkrs = _query($skrs);
            $jkrs = _affected_rows($rkrs);
            echo "{$w['TahunID']} &raquo; {$str} &raquo; {$jkrs}<br />";
            // Jika Semester 1, maka buat data keuangan dummy:
            //if ($n == 1) BuatKeuDummy($MhswID, $w['TahunID']);
        }
    }
    if ($pos < $max) {
        echo "<script type='text/javascript'>window.onload=setTimeout('window.location.reload()', 2);</script>";
    } else {
        echo "<hr><p>Proses Selesai</p>";
    }
    $_SESSION['ADPOS']++;
}
Ejemplo n.º 4
0
function ProsesKHSID()
{
    //
    // Hilangkan filter ProdiID='' jika ingin semua data!!!
    //
    $s = "select KHSID, MhswID\r\n    from khs\r\n    where TahunID='{$_SESSION['tahun']}'\r\n      and ProdiID in ('10', '11')\r\n    order by MhswID";
    $r = _query($s);
    echo "<p>Berikut adalah daftar mhsw yg diset.</p>";
    echo "<ol>";
    while ($w = _fetch_array($r)) {
        $s1 = "update _krs \r\n      set KHSID='{$w['KHSID']}' \r\n      where TahunID='{$_SESSION['tahun']}' \r\n        and KHSID=0\r\n        and MhswID='{$w['MhswID']}' ";
        $r1 = _query($s1);
        $kena = _affected_rows($r1);
        echo "<li>{$w['MhswID']} &raquo; {$kena}</li>";
    }
    echo "</ol>";
}
Ejemplo n.º 5
0
function ProsesKHSID()
{
    //
    // *** Hilangkan INSTR(...) jika semua data!!!
    //
    $prodi = '10';
    $s = "select JadwalID, MKID, MKKode, NamaKelas, SKS, ProdiID, ProgramID\r\n    from jadwal\r\n    where TahunID='{$_SESSION['tahun']}' and JenisJadwalID='K'\r\n      and INSTR(ProgramID, '.REG.') > 0\r\n      and INSTR(ProdiID, '.{$prodi}.') > 0\r\n    order by HariID";
    $r = _query($s);
    echo "<p>Berikut adalah daftar mhsw yg diset.</p>";
    echo "<ol>";
    while ($w = _fetch_array($r)) {
        //, MKID='$w[MKID]', SKS='$w[SKS]'
        $prodi = TRIM($w['ProdiID'], '.');
        $s1 = "update krs \r\n      set JadwalID='{$w['JadwalID']}'  \r\n      where TahunID='{$_SESSION['tahun']}' \r\n        and MKKode='{$w['MKKode']}'\r\n        and Catatan='{$w['NamaKelas']}'\r\n        and JadwalID=0\r\n        and LEFT(MhswID, 2) ='{$prodi}'\r\n      ";
        //echo "<pre>$s1</pre>";
        $r1 = _query($s1);
        $kena = _affected_rows($r1);
        echo "<li>{$w['JadwalID']} &raquo; {$kena}</li>";
    }
    echo "</ol>";
}
function FixMKID()
{
    $_SESSION["FIX-POS"]++;
    $pos = $_SESSION["FIX-POS"];
    $max = $_SESSION["FIX-MAX"];
    $_sks_mk = ", SKS={$w['SKS']}";
    $MKID = $_SESSION["FIX-MKID-{$pos}"];
    $MKKode = $_SESSION["FIX-MKKode-{$pos}"];
    $SKS = $_SESSION["FIX-SKS-{$pos}"];
    // HARAP DIPERHATIKAN TABEL YG AKAN DIUPDATE: _KRS ATAU KRS?
    $s2 = "update krs set MKID='{$MKID}', SKS='{$SKS}'\r\n      where MKKode='{$MKKode}' and MKID=0";
    $r2 = _query($s2);
    $_jml = _affected_rows($r2);
    $persen = $max > 0 ? $pos / $max * 100 : 0;
    $_persen = number_format($persen, 2);
    echo "<h1>{$_persen}</h1> \r\n    <p>{$s2}</p>\r\n    <p>Efektif: <font size=+1>{$_jml}</font></p>";
    if ($pos < $max) {
        echo "<script type='text/javascript'>window.onload=setTimeout('window.location.reload()', 0);</script>";
    } else {
        echo "<hr><p>Proses Selesai</p>";
    }
}
Ejemplo n.º 7
0
        $_clean['sex'] = _check_sex($_POST['sex']);
        $_clean['face'] = _check_face($_POST['face']);
        $_clean['email'] = _check_email($_POST['email'], 5, 40);
        $_clean['qq'] = _check_qq($_POST['qq']);
        $_clean['url'] = _check_url($_POST['url'], 40);
        $_clean['switch'] = $_POST['switch'];
        $_clean['autograph'] = _check_autograph($_POST['autograph'], 200);
        //修改资料
        if (empty($_clean['password'])) {
            _query("update tg_user set \n\t\t\t\t\t\t\t\t\t\t\ttg_sex='{$_clean['sex']}',\n\t\t\t\t\t\t\t\t\t\t\ttg_face='{$_clean['face']}',\n\t\t\t\t\t\t\t\t\t\t\ttg_email='{$_clean['email']}',\n\t\t\t\t\t\t\t\t\t\t\ttg_qq='{$_clean['qq']}',\n\t\t\t\t\t\t\t\t\t\t\ttg_url='{$_clean['url']}',\n\t\t\t\t\t\t\t\t\t\t\ttg_switch='{$_clean['switch']}',\n\t\t\t\t\t\t\t\t\t\t\ttg_autograph='{$_clean['autograph']}'\n\t\t\t\t\t\t\t\t\t\twhere\n\t\t\t\t\t\t\t\t\t\t\ttg_username='******'username']}'\n\t\t\t\t\t\t\t\t\t\t");
        } else {
            _query("update tg_user set \n\t\t\t\t\t\t\t\t\t\t\ttg_password='******'password']}',\n\t\t\t\t\t\t\t\t\t\t\ttg_sex='{$_clean['sex']}',\n\t\t\t\t\t\t\t\t\t\t\ttg_face='{$_clean['face']}',\n\t\t\t\t\t\t\t\t\t\t\ttg_email='{$_clean['email']}',\n\t\t\t\t\t\t\t\t\t\t\ttg_qq='{$_clean['qq']}',\n\t\t\t\t\t\t\t\t\t\t\ttg_url='{$_clean['url']}',\n\t\t\t\t\t\t\t\t\t\t\ttg_switch='{$_clean['switch']}',\n\t\t\t\t\t\t\t\t\t\t\ttg_autograph='{$_clean['autograph']}'\n\t\t\t\t\t\t\t\t\t\twhere\n\t\t\t\t\t\t\t\t\t\t\ttg_username='******'username']}'\n\t\t\t\t\t\t\t\t\t\t");
        }
    }
    //判断是否修改成功
    if (_affected_rows() == 1) {
        //关闭
        _close();
        //_session_destroy();
        //跳转
        _location('恭喜你,修改成功', 'member.php');
    } else {
        _close();
        //_session_destroy();
        _location('很遗憾,没有任何数据被修改', 'member_modify.php');
    }
}
//是否正常登陆
if (isset($_COOKIE['username'])) {
    //获取数据
    $_rows = _fetch_array("select tg_switch,tg_autograph,tg_username,tg_sex,tg_face,tg_email,tg_url,tg_qq from tg_user where tg_username='******'username']}'");
Ejemplo n.º 8
0
<?php

require_once "Articulus.php";
HTML("menu");
$u = newObject("categoria");
setNavVars(array("ID", "cat_id"));
$u->searchResults = $u->select("cat_id<2");
$filas = _affected_rows();
if ($filas > 0) {
    listList($u, array(), "index");
} else {
    echo "No hay ninguna categoría disponible";
}
Ejemplo n.º 9
0
function mailExist($email = '', $ID = 1)
{
    global $prefix;
    $q = "SELECT ID FROM {$prefix}_" . $this->name . " WHERE email='{$email}' AND ID <> {$ID}";
    $bdres = _query($q);
    $this->nRes = _affected_rows();
    if ($this->nRes > 0) {
        return True;
    } else {
        return False;
    }
}
Ejemplo n.º 10
0
 function get_selected_options($field)
 {
     global $prefix;
     $xref = array();
     $selected = array();
     $xref = explode(":", $this->properties_type[$field]);
     $table_name = $this->name . "_" . $xref[1];
     $field2 = $this->name . "_id";
     $field3 = $xref[1] . "_id";
     $q = "SELECT `{$field3}` FROM `{$prefix}_" . $table_name . "` WHERE `{$field2}`={$this->ID}";
     $bdres = _query($q);
     $af_rows = _affected_rows();
     if ($af_rows) {
         for ($i = 0; $i < $af_rows; $i++) {
             $rawres = _fetch_array($bdres);
             $selected[$rawres[$field3]] = "";
         }
     }
     return $selected;
 }
Ejemplo n.º 11
0
function showQuery($views, $title = '')
{
    $q = newObject("queryb");
    $vquery = "SELECT * FROM {$views}";
    $bdres = _query($vquery);
    for ($i = 0, $rows_affected = _affected_rows(); $i < $rows_affected; $i++) {
        $rawres = _fetch_array($bdres);
        foreach ($rawres as $kres => $vres) {
            $formated[md5($kres)] = $vres;
        }
        $All[] = $formated;
        $MetaDataAll[] = $rawres;
    }
    if (!is_array($All) || sizeof($All) < 1) {
        die("No hay resultados");
    }
    $ckeys = array_keys($All[0]);
    $titles = array_keys($MetaDataAll[0]);
    if (empty($title)) {
        $TITLE = '<h3 align="center">' . $views . ' (' . sizeof($All) . ')</h3>';
    } else {
        $TITLE = '<h3 align="center">' . $title . ' (' . sizeof($All) . ')</h3>';
    }
    $magic_template = '
		<!--HEAD-->
		' . $TITLE . '
	<table width="95%" cellspacing="0" border="1" cellpadding="1" align="center" bgcolor="#CECECE" style="border:solid 1px gray">
	<tr>
		
		';
    foreach ($titles as $row) {
        $row = explode("|", $row);
        $magic_template .= "\n\t\t\t<th>{$row[0]}</th>\n\t\t\t";
        unset($row[0]);
        $metadata[] = implode("|", $row);
    }
    $magic_template .= '		
	</tr>
	<!--SET-->
	<tr>
	';
    //print_r($keys);
    $j = 0;
    $magic = array();
    foreach ($MetaDataAll[0] as $row => $data) {
        $type = explode(":", $metadata[$j]);
        if ($type[0] == "date") {
            $cell = "<!-- A:{$ckeys[$j]} -->";
        } else {
            if ($type[0] == "datex") {
                $cell = "<!-- R:{$ckeys[$j]} -->";
            } else {
                if ($type[0] == "money") {
                    $cell = "<!-- S:{$ckeys[$j]} -->";
                } else {
                    if ($type[0] == "time") {
                        $cell = "<!-- T:{$ckeys[$j]} -->";
                    } else {
                        if ($type[0] == "ref") {
                            $randomkey = md5(time() . $ckeys[$j]);
                            $magic["{$randomkey}"] = "xxref#{$type[1]}@{$row}@" . trim($type[2]);
                            $cell = "<!-- D:{$randomkey} -->";
                        } else {
                            $cell = "<!-- D:{$ckeys[$j]} -->";
                        }
                    }
                }
            }
        }
        $magic_template .= "\n\t\t\t<td bgcolor=\"white\">{$cell}</td>\n\t\t\t";
        $j++;
    }
    $magic_template .= '		
	</tr>
	<!--END-->
	</table>';
    $q->searchResults = $All;
    listList($q, $magic, $magic_template);
}
Ejemplo n.º 12
0
function PeriksaJawaban($nmj)
{
    global $_lf, $_JawabanUSM1, $_JawabanUSM2;
    /*
    // Ambil 1 baris jawaban
    $hnd = fopen($nmj, 'r');
    $jwb = fread($hnd, filesize($nmj));
    fclose($hnd);
    $_jwb = explode($_lf, $jwb);
    $jwb = substr($_jwb[0], $_JawabanUSM1, $_JawabanUSM1+$_JawabanUSM2);
    // Tampilkan jawaban
    $pjg = strlen($jwb);
    $jml = $pjg - substr_count($jwb, '*');
    echo "Jumlah jawaban: $jml<hr size=1 color=silver>";
    */
    // Baca stuktur jawaban: jumlah jawaban utk masing2 jenis test
    $StruJwbnTest = StrukturJawabanTest();
    // Masalah header
    $DetTest = SemuaTestUSM();
    $HeaderDetTest = BuatHeaderDetTest($DetTest);
    $_arrJwbn = arrJawaban($DetTest);
    // Periksa ujian peserta
    $s = "select puf.*, p.ProdiID\r\n    from pmbusmfile puf\r\n    left outer join pmb p on puf.PMBID=p.PMBID\r\n    order by puf.PMBID";
    $r = _query($s);
    $c = 'class=ul';
    $n = 0;
    $vld = 0;
    $tot = _num_rows($r);
    echo "<p><table class=box cellspacing=1 cellpadding=4>";
    echo "<tr><th class=ttl>#</th>\r\n    <th class=ttl>PMBID</th>\r\n    <th class=ttl>Jawaban</th>\r\n    <th class=ttl>Jenis</th><th class=ttl>Benar</th>\r\n    <th class=ttl>Nilai</th>\r\n    <th class=ttl>Upload</th>\r\n    {$HeaderDetTest}</tr>";
    while ($w = _fetch_array($r)) {
        // struktur yg jawaban
        $prd = empty($w['ProdiID']) ? 'ERR' : $w['ProdiID'];
        $arrJwbn = array();
        if (!empty($w['ProdiID'])) {
            $_stru = $StruJwbnTest[$w['ProdiID']];
            // pisahkan tiap test
            $stru = explode(',', $_stru);
            $pos1 = 0;
            $nil1 = 0;
            $nil2 = '';
            $jwbn = GetFields('pmbusmkey', 'KodeTest', $w['KodeTest'], '*');
            $jwb = $jwbn['Jawaban'];
            $pjg = strlen($jwb);
            $jml = $pjg - substr_count($jwb, '*');
            for ($i1 = 0; $i1 < sizeof($stru); $i1++) {
                $_testusm = explode(':', $stru[$i1]);
                $_kodetest = $_testusm[0];
                $_jmltest = $_testusm[1];
                for ($n1 = $pos1; $n1 < $pos1 + $_jmltest; $n1++) {
                    if ($w['Jawaban'][$n1] != '*') {
                        $nil1 += $w['Jawaban'][$n1] == $jwb[$n1] ? 1 : 0;
                    }
                }
                $pos1 = $n1;
                $nil2 .= "{$_kodetest}:{$nil1}.";
                $key = array_search($_kodetest, $_arrJwbn);
                $arrJwbn[$key] = $nil1;
                // reset
                $nil1 = 0;
            }
            $nil2 = ".{$nil2}";
            $prd .= "> {$nil2}";
        }
        $n++;
        $benar = 0;
        for ($i = 0; $i < $pjg; $i++) {
            if ($w['Jawaban'][$i] != '*' && $jwb[$i] != ' ') {
                $benar += $w['Jawaban'][$i] == $jwb[$i] ? 1 : 0;
            }
        }
        if ($jml == 0) {
            $nilai = 0;
            $_nilai = 0;
        } else {
            $nilai = $benar;
            $_nilai = number_format($nilai, 2);
        }
        // parse tahap 2
        $detail = '';
        for ($i = 0; $i < sizeof($_arrJwbn); $i++) {
            $detail .= "<td class=ul align=right>{$arrJwbn[$i]}</td>";
        }
        // Update nilai
        $s1 = "update pmbusmfile set Benar={$benar}, Nilai='{$_nilai}' where PMBID='{$w['PMBID']}'";
        $r1 = _query($s1);
        // update tabel PMB
        $s2 = "update pmb set NilaiUjian='{$_nilai}', DetailNilai='{$nil2}' where PMBID='{$w['PMBID']}'";
        $r2 = _query($s2);
        $ok = _affected_rows();
        $vld += $ok;
        $c = $ok > 0 ? "class=ul" : "class=nac";
        echo "<tr><td {$c}>{$n}</td>\r\n      <td {$c}>{$w['PMBID']}</td>\r\n      <td {$c}>{$prd}</td>\r\n      <td {$c}>{$w['KodeTest']}</td>\r\n      <td {$c} align=right>{$benar}</td>\r\n      <td {$c} align=right>{$_nilai}%</td>\r\n      <td {$c}>{$ok}</td>\r\n      {$detail}\r\n      <td {$c}>{$jwb}</td>\r\n      </tr>";
    }
    echo "</table></p>";
    echo "<p><table class=box cellspacing=1 cellpadding=4>\r\n  <tr><td class=ul>Jumlah total hasil scan:</td><td class=ul align=right>{$tot}</td></tr>\r\n  <tr><td class=ul>Jumlah yang diupload:</td><td class=ul align=right>{$vld}</td></tr>\r\n  </table></p>";
}
Ejemplo n.º 13
0
} else {
    /* Borramos bufferes */
    if ($print_mode == "yes" || $export_mode == "yes") {
        while (ob_end_clean()) {
        }
    }
    ob_start();
    $q = newObject("queryb", $u->query_id);
    if (strpos($q->queryb, "SELECT * FROM View") === 0) {
        // Es un query de una vista
        require_once "Lib/lib_autoquery.php";
        showQuery(str_replace("SELECT * FROM", "", $q->queryb), $u->reportname);
    } else {
        $res = _query(ereg_replace("AS '([a-zA-z\\|:0-9 ]*)'", "", $q->queryb));
        $bulk = array();
        for ($i = 0, $rows_affected = _affected_rows(); $i < $rows_affected; $i++) {
            $rawres = _fetch_array($res);
            //$p=array_slice($rawres,1);
            $bulk[] = $rawres;
        }
        if (!is_array($bulk) || sizeof($bulk) < 1) {
            die("No hay resultados");
        }
        $q->searchResults = $bulk;
        $res = _query($q->queryb);
        $rawres = _fetch_array($res);
        $titles = array_keys($rawres);
        $magic_template = '
		<!--HEAD-->
		<h3 align="center">' . $u->reportname . '(' . sizeof($bulk) . ')</h3>
	<table width="95%" cellspacing="0" border="1" cellpadding="1" align="center" bgcolor="#CECECE" style="border:solid 1px gray">
<?php

// Fix MKID di Prasyarat
// Author: E. Setio Dewo
include_once "sisfokampus.php";
HeaderSisfoKampus("Fix MKID di Prasyarat");
$s = "select MKID, MKKode\r\n  from mk\r\n  order by MKID";
$r = _query($s);
echo "<ol>";
while ($w = _fetch_array($r)) {
    $s1a = "update mkpra set MKKode='{$w['MKKode']}'\r\n    where MKID={$w['MKID']}\r\n      and MKKode='' ";
    $s1 = "update mkpra set MKPra='{$w['MKKode']}'\r\n    where PraID={$w['MKID']}\r\n      and MKPra='' ";
    $r1 = _query($s1a);
    $jml = _affected_rows($r1);
    echo "<li>{$w['MKID']}: {$w['MKKode']}: {$jml}</li>";
}
echo "</ol>";
Ejemplo n.º 15
0
                }
            } else {
                _alert_back('Illegal access');
            }
        } else {
            _alert_back('This message does not exist');
        }
    }
}
if (isset($_GET['id'])) {
    $_rows = _fetch_array("SELECT \n\t\t\t\t\t\t\t\ttg_id,tg_state,tg_fromuser,tg_content,tg_date\n\t\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\t\ttg_message \n\t\t  \t\t\t\t   WHERE \n\t\t\t\t\t\t\t\ttg_id='{$_GET['id']}' \n\t\t\t\t\t\t   LIMIT 1\n\t\t\t\t\t\t  ");
    if ($_rows) {
        //check whether a message is readed
        if (empty($_rows['tg_state'])) {
            _query("UPDATE \n\t\t\t\t\t\ttg_message \n\t\t\t\t\t  SET \n\t\t\t\t\t\ttg_state=1 \n\t\t\t\t\tWHERE \n\t\t\t\t\t\ttg_id='{$_GET['id']}' \n\t\t\t\t\tLIMIT 1\n\t\t         ");
            if (!_affected_rows()) {
                _alert_back('Abnormal');
            }
        }
        $_html = array();
        $_html['id'] = $_rows['tg_id'];
        $_html['fromuser'] = $_rows['tg_fromuser'];
        $_html['content'] = $_rows['tg_content'];
        $_html['date'] = $_rows['tg_date'];
        $_html = _html($_html);
    } else {
        _alert_back('This message does not exist!');
    }
} else {
    _alert_back('Illegal access');
}
Ejemplo n.º 16
0
define('SCRIPT', 'member_flower');
//引入公共文件
require dirname(__FILE__) . '/includes/common.inc.php';
//判断是否登录
if (!isset($_COOKIE['username'])) {
    _alert_back('请先登录!');
}
//批删除花朵
if ($_GET['action'] == 'delete' && isset($_POST['ids'])) {
    $_clean = array();
    $_clean['ids'] = _mysql_string(implode(',', $_POST['ids']));
    //为了防止cookies伪造,还要比对一下唯一标识符uniqid()
    if (!!($_rows = _fetch_array("SELECT\n                                    tg_uniqid\n                                FROM\n                                    tg_user\n                                WHERE\n                                    tg_username='******'username']}'\n                                LIMIT\n                                    1"))) {
        _uniqid($_rows['tg_uniqid'], $_COOKIE['uniqid']);
        _query("DELETE FROM\n\t               tg_flower\n\t           WHERE\n\t               tg_id\n\t           IN\n\t               ({$_clean['ids']})");
        if (_affected_rows()) {
            _close();
            _location('花朵删除成功', 'member_flower.php');
        } else {
            _close();
            _alert_back('花朵删除失败');
        }
    } else {
        _alert_back('非法登录');
    }
}
//分页模块
global $_pagesize, $_pagenum;
_page("SELECT tg_id FROM tg_flower WHERE tg_touser='******'username']}'", 15);
//第一个参数获取总条数,第二个参数,指定每页多少条
$_result = _query("SELECT\n                    tg_id,tg_fromuser,tg_flower,tg_content,tg_date\n                FROM\n                    tg_flower\n                WHERE\n                    tg_touser='******'username']}'\n                ORDER BY\n                    tg_date DESC\n                LIMIT\n                        {$_pagenum},{$_pagesize}\n                 ");
<?php

require_once "System.php";
HTML("action_header");
if (_query("create table coreg2_tran_test (a int, b int) type = InnoDB")) {
    echo _("tabla InnodDB creada :: ");
} else {
    die(_("Error creando tabla InnodDB"));
}
_query("begin") or die(_("begin"));
_query("insert into coreg2_tran_test (a,b) values (1,2)") or die(_("insert into coreg2_tran_test (a,b) values (1,2)"));
echo _("Columnas insertadas " . _affected_rows()) . " :: ";
_query("select * from coreg2_tran_test") or die(_("Error select * from coreg2_tran_test"));
_query("rollback") or die(_("rollback"));
_query("select * from coreg2_tran_test") or die(_("Error select * from coreg2_tran_test"));
_query("DROP table coreg2_tran_test ") or die(_("asesinato frustrado"));
echo " [OK]";
?>