echo 'MySQL Error: ' . mysql_error();
        exit;
    }
    echo 'Successfully inserted the following entries into table!<br>';
    echo 'firstname = ' . $_POST['fname'] . '<br>';
    echo 'lastname = ' . $_POST['lname'] . '<br>';
    echo 'email = ' . $_POST['email'] . '<br>';
    echo 'gender = ' . $_POST['gender'] . '<br>';
    echo 'city = ' . $_POST['city'] . '<br>';
    echo 'state = ' . $_POST['state'] . '<br>';
    echo 'zip = ' . $_POST['zip'] . '<br>';
    echo 'phonenumber = ' . $_POST['phone'] . '<br>';
    echo 'dateofbirth = ' . $_POST['dob'] . '<br>';
    echo 'profilepic? = ' . $_POST['pp'] . '<br>';
    echo 'country = ' . $_POST['country'] . '<br>';
    echo 'zip = ' . $_POST['zip'] . '<br>';
}
if (isset($_GET['submit'])) {
    viewTable();
} else {
    insertIntoTable();
}
?>
<form method = "GET">
<p>Enter First name </p> 
<input type = "text" name = "firstname" id = "firstname">
<input type = "submit" name = "submit" value = "CLICKINGTHING">
</form>


</html>
<?php

$json = json_decode(file_get_contents('php://input'));
$nickname = $json->userid;
$score = $json->score;
$query = insertIntoTable($nickname, $score);
if ($query != false) {
    echo "<p>Your High Score: " . $query . "</p>";
}
echo getTop10();
function insertIntoTable($userid, $currentScore)
{
    require 'connect.php';
    $sql = "SELECT highestscore FROM HighestScore\n\t\tWHERE nickname = '" . $userid . "'";
    $result = $connect->query($sql);
    $hscore = $currentScore;
    if ($result->num_rows == 0) {
        $sql = "INSERT INTO HighestScore(nickname, highestscore)\n\t\t\tVALUES('" . $userid . "', " . $currentScore . ")";
        if ($connect->query($sql) == TRUE) {
            return $hscore;
        } else {
            return false;
        }
    }
    if ($result->num_rows == 1) {
        $hscore = $result->fetch_assoc()["highestscore"];
        if ($hscore > $currentScore) {
            return $hscore;
        }
        $hscore = $currentScore;
        $sql = "UPDATE HighestScore\n\t\t\tSET highestscore = " . $currentScore . " WHERE nickname = '" . $userid . "'";
Example #3
0
<h2>Insert data into database</h2>
<form method = 'POST' action='index.php' onsubmit="clearSelect">
	<label>Name</label>
	<input type="text" name="Name" id="nameInp">
	<br>
	<label>Phone Number</label>
	<input type="text" name="phoneNumber" id="phoneNum">
	<br>
	<input type="submit" value="Insert">
</form>
</body>
</html>
<?php 
if (isset($_POST['Name']) && isset($_POST['phoneNumber'])) {
    require 'insert.php';
    $status = insertIntoTable($_POST['Name'], $_POST['phoneNumber']);
    $statusObj = json_encode($status);
    ?>
		<script type="text/javascript">
		alert(<?php 
    echo $statusObj;
    ?>
);
		</script>
	<?php 
}
if (isset($_GET['ID'])) {
    require 'select.php';
    $result = selectFromTable($_GET['ID']);
    if ($result == false) {
        ?>
Example #4
0
     insertIntoTable("INSERT INTO mm_categs_sesizari SET sesizare_id = " . $_ID . ", categ_id = " . intval($selected_categs[$i]) . " ");
 }
 //endfor $selected_categs
 //insert $linkuri_sursa
 deleteFieldWhere('mm_sesizari_linkuri', 'sesizare_id', $_ID);
 for ($i = 0; $i < count($linkuri_sursa); $i++) {
     if (strlen(trim($linkuri_sursa[$i]))) {
         insertIntoTable("INSERT INTO mm_sesizari_linkuri SET sesizare_id = " . $_ID . ", link_sursa = '" . $linkuri_sursa[$i] . "' ");
     }
 }
 //endfor $linkuri_sursa
 //insert $embed_sursa
 deleteFieldWhere('mm_sesizari_embeds', 'sesizare_id', $_ID);
 for ($i = 0; $i < count($embed_sursa); $i++) {
     if (strlen(trim($embed_sursa[$i]))) {
         insertIntoTable("INSERT INTO mm_sesizari_embeds SET sesizare_id = " . $_ID . ", embed_sursa = '" . $embed_sursa[$i] . "' ");
     }
 }
 //endfor $embed_sursa
 //////////////////////////////////////////////////////////////////////////////////////////////////////////
 $insertLog = "INSERT INTO log SET " . "data = NOW(), " . "obs = 'ADAUGARE SESIZARE - DUPA AUTENTIFICARE', " . "ip = '" . get_ip_address() . "', " . "query = '" . mysql_real_escape_string($insertSesizareStr) . "' " . "";
 if (!mysql_query($insertLog, $configArray['dbcnx'])) {
     $insertErr = 1;
     echo $insertLog . ' &nbsp; eroare la adaugare 2';
 } else {
     echo '';
 }
 if (!$insertErr) {
     echo '<br />Adaugarea fost facuta cu succes!<br /><br />';
 }
 redirect('sesizari.php?msg=5');
Example #5
0
if ($submitOK && $configArray['rightWrite']) {
    $updateUserANCS = "UPDATE conturi_admin SET " . "nume = '" . mysql_escape_string($nume) . "', " . "prenume = '" . mysql_escape_string($prenume) . "', " . "email = '" . mysql_escape_string($email) . "', " . "parola = '" . mysql_escape_string($parola) . "', " . "cont_tip = '" . mysql_escape_string($cont_tip) . "' " . "WHERE id = " . $_ID . "";
    //echo $updateUserANCS; exit();
    if (!mysql_query($updateUserANCS, $configArray['dbcnx'])) {
        echo 'eroare la update 1';
    } else {
        echo '';
    }
    $accesModules = getQueryInArray("SELECT * FROM mm_cont_modul cm WHERE cm.id_cont = " . intval($_ID) . " ORDER BY id_modul ASC");
    for ($i = 0; $i < count($modules); $i++) {
        eval("\$" . "cur_r = \$" . "r_" . $modules[$i]['module_id'] . ";");
        eval("\$" . "cur_w = \$" . "w_" . $modules[$i]['module_id'] . ";");
        if (checkArrayValue($accesModules, 'id_modul', $modules[$i]['module_id'])) {
            updateTable("UPDATE mm_cont_modul SET r = " . intval($cur_r) . ", w = " . intval($cur_w) . " WHERE id_cont = " . intval($_ID) . " AND id_modul = " . intval($modules[$i]['module_id']) . "");
        } else {
            insertIntoTable("INSERT INTO mm_cont_modul SET r = " . intval($cur_r) . ", w = " . intval($cur_w) . ", id_cont = " . intval($_ID) . ", id_modul = " . intval($modules[$i]['module_id']) . "");
        }
    }
    //endfor
    $insertLog = "INSERT INTO log SET " . "data = NOW(), " . "obs = 'ACTUALIZARE CONT - DUPA AUTENTIFICARE', " . "ip = '" . get_ip_address() . "', " . "query = '" . mysql_real_escape_string($updateUserANCS) . "' " . "";
    if (!mysql_query($insertLog, $configArray['dbcnx'])) {
        echo $insertLog . ' &nbsp; eroare la adaugare 2';
    } else {
        echo '';
    }
    redirect('conturi_edit.php?id=' . intval($_ID) . '&msg=5');
} else {
    ?>
                                    <form method="post" id="detaliiForm" name="detaliiForm" enctype="multipart/form-data" action="<?php 
    echo $_SERVER['REQUEST_URI'];
    ?>
Example #6
0
        for ($i = 0; $i < count($linkuri_sursa); $i++) {
            if (strlen($linkuri_sursa[$i])) {
                insertIntoTable("INSERT INTO mm_sesizari_linkuri SET sesizare_id = :sesizare_id, link_sursa = :link_sursa ", array("sesizare_id" => $sesizareId, "link_sursa" => $linkuri_sursa[$i]));
            }
        }
        //endfor $linkuri_sursa
        //insert $embed_sursa
        for ($i = 0; $i < count($embed_sursa); $i++) {
            if (strlen($embed_sursa[$i])) {
                insertIntoTable("INSERT INTO mm_sesizari_embeds SET sesizare_id = :sesizare_id, embed_sursa = :embed_sursa ", array("sesizare_id" => $sesizareId, "embed_sursa" => $embed_sursa[$i]));
            }
        }
        //endfor $embed_sursa
        //insert $selected_categs
        for ($i = 0; $i < count($selected_categs); $i++) {
            insertIntoTable("INSERT INTO mm_categs_sesizari SET sesizare_id = :sesizare_id, categ_id = :categ_id ", array("sesizare_id" => $sesizareId, "categ_id" => intval($selected_categs[$i])));
        }
        //endfor $selected_categs
        //send sezisare to validation
        sendSesizareToApprover($sesizareId);
        //succes: go to Place Signature Boxes
        redirect(add_querystring_var($_SERVER['REQUEST_URI'], 'm', '101'));
    }
} else {
    //not submited
    $sendAllSubmitOK = 0;
    $data_ora = date("Y-m-d H:00");
    $selected_categs = array();
}
$config['currentMenuSection'] = 'adauga';
pageHeader();
Example #7
0
    }
}
// endif post submit
if ($submitOK && $configArray['rightWrite']) {
    $updateAlertaStr = "UPDATE alerte SET " . "alerta_nume = '" . mysql_escape_string($alerta_nume) . "', " . "alerta_email = '" . mysql_escape_string($alerta_email) . "', " . "modified_at = '" . date("Y-m-d H:i:s") . "' " . "WHERE alerta_id = " . $_ID . "";
    //echo $updateAlertaStr;
    $insertErr = 0;
    if (!mysql_query($updateAlertaStr, $configArray['dbcnx'])) {
        $insertErr = 1;
        echo ' eroare la update 1: [' . mysql_error() . ']';
    } else {
    }
    //insert $selected_categs
    deleteFieldWhere('mm_categs_alerte', 'alerta_id', $_ID);
    for ($i = 0; $i < count($selected_categs); $i++) {
        insertIntoTable("INSERT INTO mm_categs_alerte SET alerta_id = " . $_ID . ", categ_id = " . intval($selected_categs[$i]) . " ");
    }
    //endfor $selected_categs
    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    $insertLog = "INSERT INTO log SET " . "data = NOW(), " . "obs = 'ACTUALIZARE SESIZARE - DUPA AUTENTIFICARE', " . "ip = '" . get_ip_address() . "', " . "query = '" . mysql_real_escape_string($updateAlertaStr) . "' " . "";
    if (!mysql_query($insertLog, $configArray['dbcnx'])) {
        $insertErr = 1;
        echo $insertLog . ' &nbsp; eroare la adaugare 2';
    } else {
        echo '';
    }
    if (!$insertErr) {
        echo '<br />Modificarea fost facuta cu succes!<br /><br />';
    }
    redirect('alerte_edit.php?id=' . intval($_ID) . '&msg=5');
} else {
Example #8
0
    //Process Insert Data
    if ($addAlertaSubmitOK) {
        //check if mail exists => overwrite categs
        $_USER_CHECK = getQueryInArray("SELECT alerta_id FROM alerte WHERE alerta_email = :alerta_email LIMIT 1", array('alerta_email' => $email));
        if (count($_USER_CHECK)) {
            $alertaId = $_USER_CHECK[0]['alerta_id'];
            //delete old alerte categories (new ones will overwrite)
            deleteFromTable("DELETE FROM mm_categs_alerte WHERE alerta_id = :alerta_id ", array("alerta_id" => $alertaId));
        } else {
            //Insert Alerta
            insertIntoTable("INSERT INTO alerte SET \n\t\t\t\t\t\t\t\t alerta_nume = :alerta_nume, \n\t\t\t\t\t\t\t\t alerta_email = :alerta_email,\n\t\t\t\t\t\t\t\t alerta_added_at = :alerta_added_at\n\t\t\t\t\t\t\t\t ", array("alerta_nume" => $nume, "alerta_email" => $email, "alerta_added_at" => date("Y-m-d H:i:s")));
            $alertaId = $config['dbConnection']->lastInsertId();
        }
        //insert $selected_categs in alerte
        for ($i = 0; $i < count($selected_categs); $i++) {
            insertIntoTable("INSERT INTO mm_categs_alerte SET alerta_id = :alerta_id, categ_id = :categ_id ", array("alerta_id" => $alertaId, "categ_id" => intval($selected_categs[$i])));
        }
        //endfor $selected_categs
        //succes: refresh and message
        redirect(add_querystring_var($_SERVER['REQUEST_URI'], 'm', '106'));
    }
} else {
    //not submited
    $addAlertaSubmitOK = 0;
    $selected_categs = array();
}
$config['currentMenuSection'] = 'alerte';
pageHeader();
?>