From 051deceef8d07a8b664861f6f8c5ae6597e7e57d Mon Sep 17 00:00:00 2001 From: Piyush Sethia Date: Mon, 1 Oct 2018 13:37:03 +0530 Subject: [PATCH] Minor bug fix and indentation --- config.php | 2 +- feedadd.php | 28 ++++---- feedpage.php | 55 +++++++-------- index.php | 164 ++++++++++++++++++++++----------------------- main.css | 10 +-- pass.php | 186 +++++++++++++++++++++++++-------------------------- signup.php | 21 +++++- 7 files changed, 240 insertions(+), 226 deletions(-) diff --git a/config.php b/config.php index a574354..0c8b897 100644 --- a/config.php +++ b/config.php @@ -1,3 +1,3 @@ diff --git a/feedadd.php b/feedadd.php index 8144c39..a3af29f 100644 --- a/feedadd.php +++ b/feedadd.php @@ -2,20 +2,20 @@ session_start(); include("config.php"); if(isset($_SESSION["username"])){ -echo "hiii"; + echo "hiii"; //echo NOW(); -function test($data) { + function test($data) { $data = trim($data); - $data = stripslashes($data); - $data = htmlspecialchars($data); - return $data; -} + $data = stripslashes($data); + $data = htmlspecialchars($data); + return $data; + } -$t = date('Y-d-m H:i:s',time()); -echo "$t"; + $t = date('Y-d-m H:i:s',time()); + echo "$t"; //$query = "INSERT INTO time VALUES('$t')"; -$user = test ($_SESSION["username"]); -$po= test ($_POST["feed"]); + $user = test ($_SESSION["username"]); + $po= test ($_POST["feed"]); /*function test($data) { $data = trim($data); $data = stripslashes($data); @@ -35,8 +35,8 @@ function test($data) { while ($row=$res -> fetch_assoc()){ echo "feed: ".$row['comment']."
". $row['time']." ". $row['username']."

"; }} -header("location:./feedpage.php");} -else -echo "logged out"; -?> + header("location:./feedpage.php");} + else + echo "logged out"; + ?> diff --git a/feedpage.php b/feedpage.php index 6d0d0f6..6540bcb 100644 --- a/feedpage.php +++ b/feedpage.php @@ -3,42 +3,37 @@ ?> - - + + - - - - - - - - -
add comment
-
- - -
-

+ + + + + + + + +
add comment
+
+ + +
+

query($query2); - if($res->num_rows>0){ - while ($row=$res -> fetch_assoc()){ - echo "feed: ".$row['comment']."
". $row['time']." ". $row['username']."

"; - }} +$query2 ="select * from shivansh_feed"; +$res=$con->query($query2); +if($res->num_rows>0){ + while ($row=$res -> fetch_assoc()){ + echo "feed: ".$row['comment']."
". $row['time']." ". $row['username']."

"; + } +} ?> - - - - - - - + \ No newline at end of file diff --git a/index.php b/index.php index 23292f3..e925c8e 100644 --- a/index.php +++ b/index.php @@ -4,67 +4,67 @@ - -PEOPLE SEARCH - + + PEOPLE SEARCH + - + - -
-
-SIGN IN -
" name="validation" method="post" onsubmit="checking()"> - - - - - - - - - - - - - -
-Username: - - -
-Password: - - -
- -
-
- -
- -
-New To It ???? - -
-
- - - - - - - +
+
+ SIGN IN +
" name="validation" method="post" onsubmit="checking()"> + + + + + + + + + + + + + +
+ Username: + + +
+ Password: + + +
+ +
+
+ +
+ +
+ New To It ???? + +
+
+ + + + + + + connect_error; //} - echo "connected"; + echo "connected"; // if(isset($_POST['user'])){ - $sql = "SELECT username,password FROM shivansh_people"; + $sql = "SELECT username,password FROM shivansh_people"; - $usern = mysqli_real_escape_string($con, $_POST['user']); + $usern = mysqli_real_escape_string($con, $_POST['user']); // $usern = $_POST['user']; - $passw =md5($_POST['pass']); - if(isset($_SESSION["id"])){ + $passw =md5($_POST['pass']); + if(isset($_SESSION["id"])){ // if(!empty($_POST["remember"])||$_SESSION["remember"]) { - header("Location: profile.php");} - if(isset($_COOKIE["member"])) -{ - $query2 ="select * from shivansh_cookie"; - $res=$con->query($query2); - if($res->num_rows>0){ - while ($row=$res -> fetch_assoc()){ + header("Location: profile.php");} + if(isset($_COOKIE["member"])) + { + $query2 ="select * from shivansh_cookie"; + $res=$con->query($query2); + if($res->num_rows>0){ + while ($row=$res -> fetch_assoc()){ // echo "feed: ".$row['comment']."
". $row['time']." ". $row['username']."

"; - $_SESSION["id"]=$row['session']; - $_SESSION["username"]=$row['username']; - header("Location: profile.php"); - }} + $_SESSION["id"]=$row['session']; + $_SESSION["username"]=$row['username']; + header("Location: profile.php"); + }} -} + } /*if(!empty($_POST["remember"])) @@ -125,7 +125,7 @@ function checking(){ } - }*/ +}*/ echo $usern; $result=$con->query($sql); if($result->num_rows > 0) { @@ -133,12 +133,12 @@ function checking(){ while($row = $result->fetch_assoc()) { if($usern==$row["username"]&&$passw==$row["password"]) // echo ""; - { $_SESSION["id"] = session_id(); - $sess=$_SESSION["id"]; - $_SESSION["username"]=$usern; - $_SESSION["remember"]=$_POST["remember"]; + { $_SESSION["id"] = session_id(); + $sess=$_SESSION["id"]; + $_SESSION["username"]=$usern; + $_SESSION["remember"]=$_POST["remember"]; // echo "hello"; - if(isset($_POST["remember"])){ + if(isset($_POST["remember"])){ setcookie("member",$_SESSION["id"],time()+(10*365*24*60*60)); $query = "INSERT INTO shivansh_cookie(username,password,session)"; @@ -146,13 +146,13 @@ function checking(){ $reuslt1=$con->query($query); - } + } - echo ""; + echo ""; - } - // echo"
either username or password is incorrect"; } + // echo"
either username or password is incorrect"; +} } else { echo "0 results"; } diff --git a/main.css b/main.css index 5f9e13e..763771c 100644 --- a/main.css +++ b/main.css @@ -1,10 +1,10 @@ td { -margin:45%; + margin:45%; } fieldset { -margin-left:25%; -margin-right:25%; -height:25%; -padding:2%; + margin-left:25%; + margin-right:25%; + height:25%; + padding:2%; } diff --git a/pass.php b/pass.php index ecc202c..6b00476 100644 --- a/pass.php +++ b/pass.php @@ -5,124 +5,124 @@ - -PEOPLE SEARCH - + + PEOPLE SEARCH + - + - -
-
-SIGN IN -
" name="myform" method="post" onsubmit="checking()"> - - - - - - - - - - - - - - - - - - -
-Current Password - - -
-New Password: - - - - -
-Confirm Password: - - -
- -
-
- - -query($sql); -if($result->num_rows > 0) { + + query($sql); + if($result->num_rows > 0) { // output data of each row - while($row = $result->fetch_assoc()) { + while($row = $result->fetch_assoc()) { -if(strlen($_POST['pass'])>7){ + if(strlen($_POST['pass'])>7){ - if($ipass==$row["password"]) + if($ipass==$row["password"]) { - if($pass==$cpass) - { - $sql1="update shivansh_people set password= '".$pass."' where username = '".$_SESSION["username"]."';"; - $result1=$con->query($sql1); + if($pass==$cpass) + { + $sql1="update shivansh_people set password= '".$pass."' where username = '".$_SESSION["username"]."';"; + $result1=$con->query($sql1); - echo "updated pass word"; - header("location:./profile.php"); - } - - echo "wrong match"; + echo "updated pass word"; + header("location:./profile.php"); + } + + echo "wrong match"; } echo "dont mess with it"; - }echo "please enter new password of length more than 7"; - } - + }echo "please enter new password of length more than 7"; + } + }} -else + else -{ + { -echo "you are logged out"; + echo "you are logged out"; //echo "
"; -} + } -?> - + ?> + diff --git a/signup.php b/signup.php index 78cfde0..36017f0 100644 --- a/signup.php +++ b/signup.php @@ -143,7 +143,26 @@ function validate_form(){ var city = document.forms["myform"]["city"].value; - if(c>=2||d>=2||e>=2||f>=2||g>=2||h>=2||i>=2){ + if(c>=2||d>=2||e>=2 +