rough code
This commit is contained in:
@@ -1,14 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
background-color: #3B5998;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<h2><font color="white">Heres Where you find other stupid people</h2>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
55
var/www/findFriend.php
Normal file
55
var/www/findFriend.php
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
require 'common.php';
|
||||||
|
require 'loginRequired.php';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<title>friendbook Find Friend</title>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="styling.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!--#include virtual="header.html" -->
|
||||||
|
<!--#include virtual="topNavBar.html" -->
|
||||||
|
<?php
|
||||||
|
try{
|
||||||
|
echo '<pre>';
|
||||||
|
echo "Find Friends:\n\n";
|
||||||
|
$sql_select = "SELECT count(username)";
|
||||||
|
$sql_from = "FROM contacts";
|
||||||
|
$sql_where = "WHERE username = input";
|
||||||
|
$sql_statement = $sql_select." ".$sql_from." ".$sql_where.;
|
||||||
|
if(($db_connection->query($sql_statement) as $row) == 0)
|
||||||
|
//username doesn't exist
|
||||||
|
|
||||||
|
$sql_select = "SELECT count(username)";
|
||||||
|
$sql_from = "FROM friendList";
|
||||||
|
$sql_where = "WHERE username = input and friend = ".$_SESSION["loggedInUser"].;
|
||||||
|
$sql_statement = $sql_select." ".$sql_from." ".$sql_where.;
|
||||||
|
if(($db_connection->query($sql_statement) as $row) == 0)
|
||||||
|
{
|
||||||
|
$sql_statement = "UPDATE friendList SET confirm = true WHERE username = input and friend = ".$_SESSION["loggedInUser"].;
|
||||||
|
$db_connection->query($sql_statement);
|
||||||
|
$sql_statement = "INSERT INTO friendList VALUES (".$_SESSION["loggedInUser"].", input, true)";
|
||||||
|
$db_connection->query($sql_statement);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql_statement = "INSERT INTO friendList VALUES (".$_SESSION["loggedInUser"].", input, false)";
|
||||||
|
$db_connection->query($sql_statement);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</pre>';
|
||||||
|
}catch(PDOException $e){
|
||||||
|
echo "PDOException: ".$e->getMessage().PHP_EOL;
|
||||||
|
}catch(Exception $e){
|
||||||
|
echo "Exception: ".$e->getMessage().PHP_EOL;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php
|
||||||
|
$db_connection = null;
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user