| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <!DOCTYPE html>
- <html>
- <body background="http://static6.depositphotos.com/1024166/554/v/950/depositphotos_5540906-stock-illustration-seamless-background.jpg">
- <div style="border:1px solid black;background:rgba(3,170,248,0.7); border-radius:15px; padding:1%;margin:2%;">
- <h1>Practica 1 Cloud Computing</h1>
- <form action="index.php?insert=true" method="POST">
- <fieldset>
- <legend>Formulario de datos</legend>
- Nombre:<br>
- <input type="text" name="name" placeholder="Nombre"><br>
- E-mail:<br>
- <input type="text" name="email" placeholder="example@example.com"><br><br>
- <input type="submit" value="Enviar">
- </fieldset>
- </form>
- </div>
- <div style="border:1px solid black;background:rgba(3,170,248,0.7); border-radius:15px; padding:1%;margin:2%;">
- <h2>Elementos en la Base de datos</h2>
- <div class="elements">
- <ul>
- <?php
- $c = new MongoClient( "mongodb://hadoop.ugr.es:14037" );
- $db = $c->test->elements;
- if( isset($_GET['remove']) ){
- $db->remove( array('name' => $_GET['remove']) );
- }else if( isset($_GET['insert']) ){
- $db->insert( array('name' => $_POST['name'], 'email' => $_POST['email']) );
- }
- $cursor = $db->find();
- foreach ($cursor as $documento) {
- echo "<li> Nombre: " . $documento["name"] . " -- E-mail: " . $documento["email"] . " ---> <a href='index.php?remove=".$documento["name"]."'>Eliminar usuario</a></li>";
- }
- ?>
- </ul>
- </div>
- </div>
- </body>
- </html>
|