From 71021eb632e1429274a66cf4344e107b9c5fb0d5 Mon Sep 17 00:00:00 2001 From: www-data Date: Tue, 2 Dec 2014 15:50:30 +0100 Subject: [PATCH] New version of webapp. --- LogicPlayerDB.sql | 138 +++++++++++++++++++++ logintesi.sql | 195 ------------------------------ public_html/admin.html | 17 +++ public_html/dbData.php | 25 ++++ public_html/elimina_esercizio.php | 34 ++++++ public_html/esForUsr.php | 55 +++++++++ public_html/esercizi/demorgan.xml | 27 +++++ public_html/utenti.php | 32 +++++ 8 files changed, 328 insertions(+), 195 deletions(-) create mode 100755 LogicPlayerDB.sql delete mode 100644 logintesi.sql create mode 100755 public_html/admin.html create mode 100755 public_html/dbData.php create mode 100755 public_html/elimina_esercizio.php create mode 100755 public_html/esForUsr.php create mode 100644 public_html/esercizi/demorgan.xml create mode 100755 public_html/utenti.php diff --git a/LogicPlayerDB.sql b/LogicPlayerDB.sql new file mode 100755 index 0000000..2672874 --- /dev/null +++ b/LogicPlayerDB.sql @@ -0,0 +1,138 @@ +-- phpMyAdmin SQL Dump +-- version 4.0.10deb1 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Generato il: Dic 02, 2014 alle 12:20 +-- Versione del server: 5.5.38-0ubuntu0.14.04.1 +-- Versione PHP: 5.5.9-1ubuntu4.4 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Database: `LogicPlayDB` +-- + +-- -------------------------------------------------------- + +-- +-- Struttura della tabella `confMail` +-- + +CREATE TABLE IF NOT EXISTS `confMail` ( + `user` varchar(50) COLLATE utf8_bin NOT NULL, + `pass` varchar(15) COLLATE utf8_bin NOT NULL, + `random` varchar(30) COLLATE utf8_bin NOT NULL, + `time` double NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +-- -------------------------------------------------------- + +-- +-- Struttura della tabella `connessi` +-- + +CREATE TABLE IF NOT EXISTS `connessi` ( + `user` varchar(50) COLLATE utf8_bin NOT NULL, + `tempKey` varchar(20) COLLATE utf8_bin NOT NULL, + `time` double NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +-- +-- Dump dei dati per la tabella `connessi` +-- + +INSERT INTO `connessi` (`user`, `tempKey`, `time`) VALUES +('danilo.berardinelli@studio.unibo.it', '45294043102528907', 1417517716080); + +-- -------------------------------------------------------- + +-- +-- Struttura della tabella `esercizi` +-- + +CREATE TABLE IF NOT EXISTS `esercizi` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `esercizio` varchar(20) COLLATE utf8_bin NOT NULL, + `user` varchar(50) COLLATE utf8_bin NOT NULL, + `voto` int(11) NOT NULL, + `time` double NOT NULL, + UNIQUE KEY `id` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=23 ; + +-- +-- Dump dei dati per la tabella `esercizi` +-- + +INSERT INTO `esercizi` (`id`, `esercizio`, `user`, `voto`, `time`) VALUES +(1, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 30, 1417456540103), +(2, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 30, 1417456540103), +(3, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 12, 1417475171336), +(4, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 12, 1417475171336), +(5, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 22, 1417505292977), +(6, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 22, 1417505292977), +(7, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 23, 1417508355262), +(8, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 23, 1417508355262), +(9, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 23, 1417508355262), +(10, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 23, 1417508355262), +(11, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 23, 1417508355262), +(12, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 24, 1417508929848), +(13, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 24, 1417508929848), +(14, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 24, 1417508929848), +(15, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 24, 1417508929848), +(16, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 24, 1417508929848), +(17, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 15, 1417510157929), +(18, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 15, 1417510157929), +(19, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 15, 1417510157929), +(20, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 15, 1417510157929), +(21, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 15, 1417510157929), +(22, 'risolvibile.xml', 'danilo.berardinelli@studio.unibo.it', 25, 1417515589796); + +-- -------------------------------------------------------- + +-- +-- Struttura della tabella `utenti` +-- + +CREATE TABLE IF NOT EXISTS `utenti` ( + `user` varchar(50) COLLATE utf8_bin NOT NULL, + `pass` varchar(15) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL, + UNIQUE KEY `user` (`user`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +-- +-- Dump dei dati per la tabella `utenti` +-- + +INSERT INTO `utenti` (`user`, `pass`) VALUES +('danilo.berardinelli@studio.unibo.it', '123stella'); + +-- -------------------------------------------------------- + +-- +-- Struttura della tabella `webAdmin` +-- + +CREATE TABLE IF NOT EXISTS `webAdmin` ( + `user` varchar(30) COLLATE utf8_bin NOT NULL, + `pass` varchar(30) COLLATE utf8_bin NOT NULL, + UNIQUE KEY `username` (`user`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +-- +-- Dump dei dati per la tabella `webAdmin` +-- + +INSERT INTO `webAdmin` (`user`, `pass`) VALUES +('danilo.berardinelli', '123stella'); + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/logintesi.sql b/logintesi.sql deleted file mode 100644 index ec57f9c..0000000 --- a/logintesi.sql +++ /dev/null @@ -1,195 +0,0 @@ --- phpMyAdmin SQL Dump --- version 4.0.10deb1 --- http://www.phpmyadmin.net --- --- Host: localhost --- Generato il: Nov 14, 2014 alle 16:45 --- Versione del server: 5.5.38-0ubuntu0.14.04.1 --- Versione PHP: 5.5.9-1ubuntu4.4 - -USE logintesi; - -SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -SET time_zone = "+00:00"; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; - --- --- Database: `logintesi` --- - --- -------------------------------------------------------- - --- --- Struttura della tabella `admin` --- - -CREATE TABLE IF NOT EXISTS `admin` ( - `username` varchar(30) COLLATE utf8_bin NOT NULL, - `password` varchar(30) COLLATE utf8_bin NOT NULL, - UNIQUE KEY `username` (`username`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - --- --- Dump dei dati per la tabella `admin` --- - -INSERT INTO `admin` (`username`, `password`) VALUES -('danilo.berardinelli', '123stella'); - --- -------------------------------------------------------- - --- --- Struttura della tabella `aggprova` --- - -CREATE TABLE IF NOT EXISTS `aggprova` ( - `chiave` varchar(50) COLLATE utf8_bin NOT NULL, - `time` double NOT NULL, - `checks` int(11) NOT NULL, - PRIMARY KEY (`chiave`), - UNIQUE KEY `key` (`chiave`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - --- --- Dump dei dati per la tabella `aggprova` --- - -INSERT INTO `aggprova` (`chiave`, `time`, `checks`) VALUES -('10157426982320510', 1415145803639, 1), -('10244937857444543', 1415284664538, 1), -('10308106918353456', 1415243065790, 1), -('10385651273134167', 1415289922479, 1), -('10414239987472834', 1415285560312, 1), -('1097785784725414', 1415284853312, 1), -('10983265112121106', 1415242393295, 1), -('1286713061377424', 1415036978051, 1), -('1408285479764558', 1415278883075, 1), -('1490801371315190', 1415285333816, 1), -('1741331087669285', 1415811578318, 1), -('18516070104459806', 1415276863684, 1), -('2217380018747176', 1415145507080, 1), -('2260502250327125', 1415284745047, 1), -('2473377684156933', 1415284628252, 1), -('2504043195911198', 1415285115955, 1), -('2686774762838581', 1415278911038, 1), -('2744239278608085', 1415036291300, 1), -('2956509786688513', 1415271435934, 1), -('2961042458190883', 1415277033282, 1), -('3109253928772677', 1415284540445, 1), -('3311335330604631', 1415237862686, 1), -('3486758220086141', 1415242975878, 1), -('3571361357113219', 1415285156048, 1), -('4091389111256716', 1415025754182, 1), -('42848425102166715', 1415242068918, 1), -('4457124515989723', 1415811050681, 1), -('4577865146663611', 1415285170075, 1), -('4796791993070257', 1415288554998, 1), -('5005653368852396', 1415285312682, 1), -('5226217037177487', 1415145721770, 1), -('5308112899337743', 1415037335958, 1), -('5362524692721963', 1415811381242, 1), -('5382075363462279', 1415272904986, 1), -('5650512812480934', 1415271249954, 1), -('5735648814288922', 1415036889526, 1), -('62029084106069252', 1415241839377, 1), -('6712150141518271', 1415285510994, 1), -('6786243849285602', 1415811389915, 1), -('6992436366972266', 1415242705239, 1), -('7106071695334106', 1415811170493, 1), -('7158700078303143', 1415284726466, 1), -('7307203380313108', 1415819825863, 1), -('75372031101482498', 1415284519581, 1), -('7703030541673651', 1415272914342, 1), -('8065501483698608', 1415819808393, 1), -('8468895456378674', 1415241733824, 1), -('8760904545449404', 1415285230458, 1), -('8838732364680254', 1415271877269, 1), -('9576830372163956', 1415283251776, 1); - --- -------------------------------------------------------- - --- --- Struttura della tabella `confmail` --- - -CREATE TABLE IF NOT EXISTS `confmail` ( - `user` varchar(50) COLLATE utf8_bin NOT NULL, - `pass` varchar(50) COLLATE utf8_bin NOT NULL, - `hash` varchar(50) COLLATE utf8_bin NOT NULL, - `time` double DEFAULT NULL, - UNIQUE KEY `user` (`user`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - --- -------------------------------------------------------- - --- --- Struttura della tabella `connessi` --- - -CREATE TABLE IF NOT EXISTS `connessi` ( - `user` varchar(50) COLLATE utf8_bin NOT NULL, - `tempkey` varchar(50) COLLATE utf8_bin NOT NULL, - `thread` tinyint(1) NOT NULL, - `time` double NOT NULL, - UNIQUE KEY `tempkey` (`tempkey`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - --- --- Dump dei dati per la tabella `connessi` --- - -INSERT INTO `connessi` (`user`, `tempkey`, `thread`, `time`) VALUES -('danilo.berardinelli@studio.unibo.it', '2545550210880139', 0, 1415975986391); - --- -------------------------------------------------------- - --- --- Struttura della tabella `esercizi` --- - -CREATE TABLE IF NOT EXISTS `esercizi` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `esercizio` varchar(20) COLLATE utf8_bin NOT NULL, - `utente` varchar(50) COLLATE utf8_bin NOT NULL, - `click` int(11) NOT NULL, - `time` double NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=4 ; - --- --- Dump dei dati per la tabella `esercizi` --- - -INSERT INTO `esercizi` (`id`, `esercizio`, `utente`, `click`, `time`) VALUES -(1, 'tautologia.xml', 'danilo.berardinelli@studio.unibo.it', 1, 1415923860705), -(2, 'tautologia.xml', 'danilo.berardinelli@studio.unibo.it', 1, 1415975624027), -(3, 'tautologia.xml', 'danilo.berardinelli@studio.unibo.it', 3, 1415975983857); - --- -------------------------------------------------------- - --- --- Struttura della tabella `utenti` --- - -CREATE TABLE IF NOT EXISTS `utenti` ( - `user` varchar(50) COLLATE utf8_bin NOT NULL, - `pass` varchar(15) COLLATE utf8_bin NOT NULL, - UNIQUE KEY `user` (`user`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - --- --- Dump dei dati per la tabella `utenti` --- - -INSERT INTO `utenti` (`user`, `pass`) VALUES -('danilo.berardinelli@studio.unibo.it', '123stella'); - -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/public_html/admin.html b/public_html/admin.html new file mode 100755 index 0000000..a3c68e6 --- /dev/null +++ b/public_html/admin.html @@ -0,0 +1,17 @@ + + + + + + + + + +

Benvenuto nella pagina di amministazione

+
+

+

+ +
+ + diff --git a/public_html/dbData.php b/public_html/dbData.php new file mode 100755 index 0000000..61bbc02 --- /dev/null +++ b/public_html/dbData.php @@ -0,0 +1,25 @@ + "localhost", + 'dbName' => "LogicPlayerDB", + 'dbAdmin' => "root", + 'dbPassword' => "csc@CerCo!", + //nomi delle tabelle (di fianco sono elencati i nomi delle colonne) + 'tbConfermaMail' => "confMail",//user,pass,random,time + 'tbConnessi' => "connessi",//user,tempKey,time + 'tbUtenti' => "utenti",//user,pass + 'tbEsercizi' => "esercizi",//id,esercizio,user,voto,time + 'tbWebAdmin' => "webAdmin", + //nomi delle colonne (non tutte le tabelle hanno tutte le colonne) + 'clUser' => "user", + 'clPass' => "pass", + 'clRandom' => "random", + 'clTime' => "time", + 'clTempKey' => "tempKey", + 'clId' => "id", + 'clEsercizio' => "esercizio", + 'clVoto' => "voto", + //variabili globali + 'listaEsercizi' => "/projects/logicplayer/server/com/company/esercizi.xml", + 'locationEsercizi' => "/esercizi/")) +?> diff --git a/public_html/elimina_esercizio.php b/public_html/elimina_esercizio.php new file mode 100755 index 0000000..f8756ff --- /dev/null +++ b/public_html/elimina_esercizio.php @@ -0,0 +1,34 @@ +"error"); + $ris=json_encode($arr); + echo $ris; + die; + } + if($result->id>0) + $str="DELETE FROM ".$DATA['tbEsercizi']." WHERE ".$DATA['clId']."=".$result->id.";"; + else if($result->id<0) + { + $str="DELETE FROM ".$DATA['tbEsercizi']." WHERE ".$DATA['clUser']."='".$result->utente."';"; + $str=mysqli_query($con,$str); + $str="DELETE FROM ".$DATA['tbConnessi']." WHERE ".$DATA['clUser']."='".$result->utente."';"; + $str=mysqli_query($con,$str); + $str="DELETE FROM ".$DATA['tbUtenti']." WHERE ".$DATA['clUser']."='".$result->utente."';"; + } + else + { + $str="DELETE FROM ".$DATA['tbEercizi']." WHERE ".$DATA['clEsercizio']."='".$result->esercizio."';"; + unlink("/var/www/html/esercizi/".$result->esercizio); + } + $str=mysqli_query($con,$str); + $arr= array('result'=>"ok"); + $ris=json_encode($arr); + echo $ris; +?> + diff --git a/public_html/esForUsr.php b/public_html/esForUsr.php new file mode 100755 index 0000000..9c5ab12 --- /dev/null +++ b/public_html/esForUsr.php @@ -0,0 +1,55 @@ +"errore nella connessione al database"); + $ris=json_encode($arr); + echo $ris; + die; + } + if($result->name=='all') + $str="SELECT * FROM ".$DATA['tbEsercizi'].";"; + else + $str="SELECT * FROM ".$DATA['tbEsercizi']." WHERE ".$DATA['clUser']."='".$result->name."' ORDER BY esercizio;"; + $str=mysqli_query($con,$str); + if (!$str) + { + $arr= array('result'=>"nessun elemento presente"); + $ris=json_encode($arr); + echo $ris; + die; + } + $esercizi; + $risp=mysqli_fetch_array($str); + $risultati; + $esercizio['esercizio']=$risp[$DATA['clEsercizio']]; + do + { + if($esercizio['esercizio']==$risp[$DATA['clEsercizio']]) + { + //aggiungo utenti e click ell'es corrente + $risultati[]=array('id'=>$risp[$DATA['clId']],'utente'=>$risp[$DATA['clUser']],'click'=>$risp[$DATA['clVoto']]); + } + else + { + //reimposto i campi per un nuovo esercizio + $esercizio['risultati']=$risultati; + $esercizi[]=$esercizio; + unset($esercizio); + unset($risultati); + $esercizio['esercizio']=$risp[$DATA['clEsercizio']]; + $risultati[]=array('id'=>$risp[$DATA['clId']],'utente'=>$risp[$DATA['clUser']],'click'=>$risp[$DATA['clVoto']]); + } + }while($risp=mysqli_fetch_array($str)); + $esercizio['risultati']=$risultati; + $esercizi[]=$esercizio; + $ex=array('esercizi'=>$esercizi); + unset($esercizio); + unset($risultati); + $return_json=__json_encode($ex); + echo $return_json; +?> diff --git a/public_html/esercizi/demorgan.xml b/public_html/esercizi/demorgan.xml new file mode 100644 index 0000000..68c079b --- /dev/null +++ b/public_html/esercizi/demorgan.xml @@ -0,0 +1,27 @@ + + + + + + + A + B + + + + + A + + + B + + + + + + + 13 + 60 + 5 + + diff --git a/public_html/utenti.php b/public_html/utenti.php new file mode 100755 index 0000000..6395f8d --- /dev/null +++ b/public_html/utenti.php @@ -0,0 +1,32 @@ +"errore nella connessione al database"); + $ris=json_encode($arr); + echo $ris; + die; + } + $str="SELECT * FROM ".$DATA['tbUtenti'].";"; + $str=mysqli_query($con,$str); + if (!$str) + { + $arr= array('result'=>"nessun elemento presente"); + $ris=json_encode($arr); + echo $ris; + die; + } + $utenti; + while($risp=mysqli_fetch_array($str)) + { + $utenti[]=$risp[$DATA['clUser']]; + } + $ex=array('utenti'=>$utenti); + $return_json=__json_encode($ex); + echo $return_json; +?> + -- 2.39.2