Posts

Showing posts from February, 2024

login

  <?php     require "functions.php" ;     if ( $_SERVER [ 'REQUEST_METHOD' ] == "POST" )     {                 $email = addslashes ( $_POST [ 'email' ]);         $password = addslashes ( $_POST [ 'password' ]);         $query = "select * from users where email = ' $email ' && password = ' $password ' limit 1" ;         $result = mysqli_query ( $con , $query );         if ( mysqli_num_rows ( $result ) > 0 ){             $row = mysqli_fetch_assoc ( $result );             $_SESSION [ 'info' ] = $row ;             header ( "Location: profile.php" );             die ;         } else {             $error = "wrong email or password" ;     ...

index

  <?php     require "functions.php" ;     check_login (); ? > <! DOCTYPE html > < html > < head >     < title > my website </ title > </ head > < body >     <?php require_once "header.php" ; ? >                 < div style = " max-width: 600px;margin: auto;" >                     < h3 style = " text-align: center;" > Timeline </ h3 >                     <?php                                                 $query = "select * from posts order by id desc limit 10" ;                         $result = mysqli_query ( $con , $query );     ...

header

      < style >         * {             padding : 0px ;             margin : 0px ;             box-sizing : border-box ;         }         a {             text-decoration : none ;         }         body {             background-color : #f7f7eb ;             font-family : tahoma ;         }         header div {             padding : 20px ;         }         header a {             color : white ;         }         header {             background-color : #766ecc ;       ...

profile.php

  <?php     require "functions.php" ;     check_login ();     if ( $_SERVER [ 'REQUEST_METHOD' ] == "POST" && ! empty ( $_POST [ 'action' ]) && $_POST [ 'action' ] == 'post_delete' )     {         //delete your post         $id = $_GET [ 'id' ] ?? 0 ;         $user_id = $_SESSION [ 'info' ][ 'id' ];         $query = "select * from posts where id = ' $id ' && user_id = ' $user_id ' limit 1" ;         $result = mysqli_query ( $con , $query );         if ( mysqli_num_rows ( $result ) > 0 ){             $row = mysqli_fetch_assoc ( $result );             if ( file_exists ( $row [ 'image' ])){                 unlink ( $row [ 'image' ]);             }     ...