Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php
$con = new mysqli("192.168.121.187","first_year","first_year","first_year_db");
$con = new mysqli("192.168.121.187","first_year","first_year","first_year_db");
?>
28 changes: 14 additions & 14 deletions feedadd.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -35,8 +35,8 @@ function test($data) {
while ($row=$res -> fetch_assoc()){
echo "feed: ".$row['comment']."<br>". $row['time']." ". $row['username']."<br><br>";
}}
header("location:./feedpage.php");}
else
echo "logged out";
?>
header("location:./feedpage.php");}
else
echo "logged out";
?>

55 changes: 25 additions & 30 deletions feedpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,37 @@
?>
<html>
<head>
<title>
</title>
<title>
</title>
</head>
<body>
<table>
<tr>
<td>add comment </td>
</tr>
<tr>
<td>
<form action=" feedadd.php" method="post">
<input type="text" placeholder="enter text here....." name="feed" >
<input type="submit" value="submit">
</td>
</tr>
</form>
</table>
<br> <hr>
<table>
<tr>
<td>add comment </td>
</tr>
<tr>
<td>
<form action=" feedadd.php" method="post">
<input type="text" placeholder="enter text here....." name="feed" >
<input type="submit" value="submit">
</td>
</tr>
</form>
</table>
<br> <hr>
</body>
<?php
if(!isset($_SESSION["username"])){
echo "you are logged out";
echo "you are logged out";

}
include("config.php");
$query2 ="select * from shivansh_feed";
$res=$con->query($query2);
if($res->num_rows>0){
while ($row=$res -> fetch_assoc()){
echo "feed: ".$row['comment']."<br>". $row['time']." ". $row['username']."<br><br>";
}}
$query2 ="select * from shivansh_feed";
$res=$con->query($query2);
if($res->num_rows>0){
while ($row=$res -> fetch_assoc()){
echo "feed: ".$row['comment']."<br>". $row['time']." ". $row['username']."<br><br>";
}
}
?>
</html>






</html>
164 changes: 82 additions & 82 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,67 +4,67 @@
<!DOCTYPE html>
<html>
<head>
<title>
PEOPLE SEARCH
</title>
<title>
PEOPLE SEARCH
</title>

<link href="main.css" rel="stylesheet" type="text/css">
<link href="main.css" rel="stylesheet" type="text/css">


</head>
<body>
<img style="margin-left:40%" src="./images/index.jpeg" width="220px" height="220px">
<br>
<fieldset>
<legend>SIGN IN </legend>
<form action="<?php echo $_SERVER["PHP_SELF"];?>" name="validation" method="post" onsubmit="checking()">
<table>
<tr>
<td>
Username:
</td>
<td>
<input type="text" placeholder="username" name="user" required >
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" placeholder="password" name="pass" required>
</td>
</tr>
<tr>
<td>
<input type="submit" value="login" onsubmit="checking()">
</td>

</tr>
</table>
<div><input type="checkbox" name="remember" id="remember">
</form>
<br>

<form action="signup.php">
New To It ????
<input type="submit" value="SignUp">
</form>
</fieldset>
<script type="text/javascript">
var maqli("192.168.121.187","first_year","first_year","first_year_db");
l = /^[^@]+@[^@.]+\.[a-z]+$/i;
function checking(){
alert("want to remember it");}
</script>





<?php
<img style="margin-left:40%" src="./images/index.jpeg" width="220px" height="220px">
<br>
<fieldset>
<legend>SIGN IN </legend>
<form action="<?php echo $_SERVER["PHP_SELF"];?>" name="validation" method="post" onsubmit="checking()">
<table>
<tr>
<td>
Username:
</td>
<td>
<input type="text" placeholder="username" name="user" required >
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" placeholder="password" name="pass" required>
</td>
</tr>
<tr>
<td>
<input type="submit" value="login" onsubmit="checking()">
</td>

</tr>
</table>
<div><input type="checkbox" name="remember" id="remember">
</form>
<br>

<form action="signup.php">
New To It ????
<input type="submit" value="SignUp">
</form>
</fieldset>
<script type="text/javascript">
var maqli("192.168.121.187","first_year","first_year","first_year_db");
l = /^[^@]+@[^@.]+\.[a-z]+$/i;
function checking(){
alert("want to remember it");}
</script>





<?php
// session_start();
include("config.php");
include("config.php");
// session_start();
// $con =new mysqli("192.168.121.187","first_year","first_year","first_year_db");

Expand All @@ -73,36 +73,36 @@ function checking(){
//{
//echo "Failed to connect to MySQL: " . $con->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']."<br>". $row['time']." ". $row['username']."<br><br>";
$_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"]))
Expand All @@ -125,34 +125,34 @@ function checking(){

}

}*/
}*/
echo $usern;
$result=$con->query($sql);
if($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
if($usern==$row["username"]&&$passw==$row["password"])
// echo "<script> window.location.assign('profile.php'); </script>";
{ $_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)";
$query .= " VALUES ('$usern', '$passw','$sess' )";


$reuslt1=$con->query($query);
}
}

echo "<script> window.location.assign('profile.php'); </script>";
echo "<script> window.location.assign('profile.php'); </script>";

}
// echo"<br> either username or password is incorrect";
}
// echo"<br> either username or password is incorrect";
}
} else {
echo "0 results";
}
Expand Down
10 changes: 5 additions & 5 deletions main.css
Original file line number Diff line number Diff line change
@@ -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%;
}
Loading