コード例 #1
1
ファイル: items.php プロジェクト: avallete/PHPool
            }
        }
    }
    header('Location: admin.php');
}
function add_database($db)
{
    if ($fd = fopen('../private/bde.csv', 'a+')) {
        foreach ($_POST as &$value) {
            $value = htmlspecialchars($value);
        }
        if (!isset($db[$_POST['id']]) && flock($fd, LOCK_EX | LOCK_NB)) {
            fputcsv($fd, create_dbo($_POST['location'], $_POST['name'], $_POST['categories'], $_POST['price'], $_POST['description'], $_POST['id']), ';');
            flock($fd, LOCK_UN);
        } else {
            $new = create_dbo($_POST['location'], $_POST['name'], $_POST['categories'], $_POST['price'], $_POST['description'], $_POST['id']);
            modify_item($db, $new, $_POST['id']);
        }
        fclose($fd);
    }
    header('Location: admin.php');
}
if (isset($_POST['submit'])) {
    if ($_POST['submit'] == 'add_db') {
        add_database(get_database());
    } else {
        if ($_POST['submit'] == 'del_db') {
            del_id(get_database(), $_POST['id']);
        }
    }
}
コード例 #2
0
<div class="result collection">
<?php 
echo $_POST["dbname"];
if ($dbname = $_POST['dbname']) {
    if (isset($_GET['confirm'])) {
        if (add_database($connection, $dbname)) {
            echo "<h5>La base " . $dbname . " a bien été créée</h5>";
            echo "<p> Redirection ... </p>";
            ?>
                <meta http-equiv="refresh" content="2; url=index.php"/>
                <div class="preloader-wrapper active">
                     <div class="spinner-layer spinner-red-only">
                        <div class="circle-clipper left">
                         <div class="circle"></div>
                </div><div class="gap-patch">
                 <div class="circle"></div>
                </div><div class="circle-clipper right">
                <div class="circle"></div>
                </div>
                </div>
                </div>
                    <?php 
        } else {
            echo "<h5>La base de données existe déjà!</h5>";
            echo "<p>Redirection ... </p>";
            ?>
                <meta http-equiv="refresh" content="2; url=index.php?action=new-bdd"/>
                <div class="preloader-wrapper active">
                        <div class="spinner-layer spinner-red-only">
                        <div class="circle-clipper left">
                        <div class="circle"></div>
コード例 #3
0
ファイル: index.php プロジェクト: Procxl/libraries
     }
 }
 if ($use_cmmmsrv == 'y') {
     $a = socket_read($socket, 250, PHP_NORMAL_READ);
     //echo "the socket says: $a<br />\n";
     $pos = strpos($a, "READY");
     if ($pos === false) {
         echo "<!-- could not connect to cmmmsrv - reverting to checkmol/matchmol --!>\n";
         $use_cmmmsrv = "n";
     }
 }
 $dbtypecode = "SD";
 if ($dbtype == 2) {
     $dbtypecode = "RD";
 }
 $new_db = add_database($newname, $dbtypecode, $dbdescription, $dbaccess, $dbdigits, $dbsubdirdigits, $dbtrustedIP, $dbflags);
 if ($use_cmmmsrv == 'y') {
     socket_write($socket, '#### bye');
     socket_close($socket);
 }
 if ($new_db > 0) {
     // now duplicate all data fields in moldatatable/rxndatatable
     if ($dbtype == 1) {
         $srctable = $prefix . "db" . $db_id . "_" . $moldatasuffix;
         $dsttable = $prefix . "db" . $new_db . "_" . $moldatasuffix;
         $id_id = "mol_id";
         $id_name = "mol_id";
         $prevcol = "auto_mol_fw";
     } elseif ($dbtype == 2) {
         $srctable = $prefix . "db" . $db_id . "_" . $rxndatasuffix;
         $dsttable = $prefix . "db" . $new_db . "_" . $rxndatasuffix;