<?php include_once "konexioaAJAX.php"; include_once "sesioa.php"; ekintza("editatu", $dblink); $id = (int) $_GET['GALDERA_ID']; $galdera = $_GET['GALDERA']; $erantzuna = $_GET['ERANTZUNA']; $zailtasuna = $_GET['ZAILTASUNA']; $email = $_SESSION['login_email']; $sql = "UPDATE GALDERA SET GALDERA='{$galdera}', ERANTZUNA='{$erantzuna}', ZAILTASUNA={$zailtasuna} WHERE ID={$id} AND POSTA='{$email}'"; $result = $dblink->query($sql); if ($result) { echo '<h2>Aukeratutako galdera editatu da</h2>'; } else { echo '<h2>Id-a hutsik</h2>'; } require "deskonexioa.php"; ?>
<?php include "konexioa.php"; include_once "sesioa.php"; ekintza("", $dblink); $galdera = "SELECT * FROM GALDERA"; $ema = $dblink->query($galdera); echo '<table border=1><tr><th> GALDERA </th><th> ZAILTASUNA </th></tr>'; while ($row = $ema->fetch_array(MYSQLI_BOTH)) { echo '<tr><td>' . $row['GALDERA'] . '</td> <td>' . $row['ZAILTASUNA'] . '</td></tr>'; } echo '</table>'; include "deskonexioa.php";
<?php include_once "konexioaAJAX.php"; include_once "sesioa.php"; $email = $_SESSION['login_email']; //$eposta = $_GET['EPOSTA'] $pasahitza = $_GET['PASAHITZA']; ekintza("pasahitza aldatu", $dblink); $sql = "UPDATE ERABILTZAILEA SET PASAHITZA='{$pasahitza}' WHERE POSTA='{$email}' "; $result = $dblink->query($sql); if ($result) { echo "<h3 style='color:green'>Pasahitza aldatu da!</h3>"; } else { echo "<h3 style='color:red'>Erroreren bat egon da.</h3>"; } require "deskonexioa.php"; ?>
<?php include_once "konexioa.php"; include_once "sesioa.php"; $email = $_SESSION['login_email']; ekintza("txertatu", $dblink); $sql = "INSERT INTO GALDERA () VALUES('','{$galdera}','{$erantzuna}','{$zailtasuna}','{$email}')"; $result = $dblink->query($sql); if ($result) { $file = 'xml/galderak.xml'; $xml = simplexml_load_file($file); $assessmentItem = $xml->addChild('assessmentItem'); $assessmentItem->addAttribute('complexity', $zailtasuna); $assessmentItem->addAttribute('subject', 'Mikologia'); $itemBody = $assessmentItem->addChild('itemBody'); $correctResponse = $assessmentItem->addChild('correctResponse'); $itemBody->addChild('p', $galdera); $correctResponse->addChild('value', $erantzuna); //$assessmentItem->$itemBody; //$assessmentItem->$correctResponse; //$xml->$assessmentItem; $ondoTxertatuDa = file_put_contents($file, $xml->asXML()); if ($ondoTxertatuDa) { echo '<h2>XML-n ondo txertatu da</h2>'; } else { echo 'Arazo bat egonda txertaketan'; } echo '<h2>Zure galdera gehitu da</h2>'; } else { echo '<h2>Errore bat egon da zure galdera gehitzerakoan</h2>' . "<pre>{$dblink->error}</pre>"; }
<?php include "konexioaAJAX.php"; include_once "sesioa.php"; ekintza("review", $dblink); $galdera = "SELECT * FROM GALDERA"; $ema = $dblink->query($galdera); echo "<h2>Galderak ikusi</h2>"; echo "<table id='example' style='height:300px;font-size:1.3em;' cellspacing='0'><thead><tr><th> ID </th><th> GALDERA </th><th> ERANTZUNA </th><th> ZAILTASUNA </th></tr></thead>"; echo "<tbody>"; while ($row = $ema->fetch_array(MYSQLI_BOTH)) { echo '<tr><td>' . $row['ID'] . '</td> <td>' . $row['GALDERA'] . '</td> <td>' . $row['ERANTZUNA'] . '</td> <td>' . $row['ZAILTASUNA'] . '</td></tr>'; } echo "</tbody>"; echo '</table>'; include "deskonexioa.php";