Speed up development with full-stack environments for every branch.

Learn More

Chat [Php, MySQL an CSS]

Forked from mini chat.

83 Runs 124 Views 55 Copies

Basic PHP Hello World Example

Saved

Saved

AndresR123 1

AndresR123
published 9 months ago

    <?php 
    include('includes/connection.php');
    ?>
    <!DOCTYPE HTML>
    <HTML>
    <head>
    <meta charset="utf-8" />
    <title>Blog: Mini-facebook</title>
    <link href="css/style.css" rel="stylesheet"/>
    <link rel="icon" href="writer.ico" type="image/x-icon" />
    </head>
    <body>
    
      <div id="main">
      <img src="facebook.png"/><p>
       <h1> Mini-facebook</h1>
       </p>
       <hr>
       <h2> Poste à commenter: </h2>
       <form action="index.php" method="post">
      <table>
       <tr>
     <td> Name:</td> <td><input placeholder="Votre nom.." type="text" name="by" required/><td>
      </tr>
      
      <tr>
     <td> Commentaire:</td> <td> <textarea required placeholder="Votre commentaire.." rows=2 cols=20 id=post name=poste></textarea></td>
      </tr>
      
       <tr>
       <td></td>
       <td><input type=submit name=submit value=valider /></td>
       </tr>
       
       </table>
       </form>
       <hr>
       <h3>Les derniéres commentaires:</h3>
       
       <p > 
       <?php
       if(isset($_POST['by']) && isset($_POST['poste']))
       {
    $sql = 'INSERT INTO tweet VALUES( "id" , "'.$_POST['by'].'" , "'.$_POST['poste'].' " )';
       mysql_query($sql)or die('ERREUR SQL\!'.$sql.'<br> '.mysql_error());
       } 
    //hjvfhj
    
    $sql = 'SELECT * FROM tweet ORDER BY `id` DESC  ';
       $rqt = mysql_query($sql);
       while($data = mysql_fetch_array($rqt))
       {
       echo '<strong>ID:</strong>   '.$data['id'].'<br/>';
       echo $data['poste'].'<br><strong> Par: </strong>'.$data['by'].'<table colapse=colapse><tr><td>';
       echo "<form action=modifier.php method=post><input type=submit value=modifier /></form></td><td> ";
       echo "<form action=index.php method=post><input type=submit  name=supprimer value=supprimer /></form></td></tr></table>";
       
         if(isset($_POST['supprimer'])) 
        {
       
       $sql='DELETE FROM tweet WHERE `by` = "'.$data['by'].'" ';
       mysql_query($sql)or die('ERREUR SQL\!'.$sql.'<br> '.mysql_error());
       }
       
        echo "<hr>";
       }
       
       mysql_free_result ($rqt);
       mysql_close();
    ?>
       </p>
       
       
      </div>
    
    
    </body>
    </HTML>
    
    Please login/signup to get access to the terminal.

    Your session has timed out.

    Dismiss (the page may not function properly).