<?php session_start(); include "config.php"; include "private_functions.php"; include "functions.php"; if (!isset($_SESSION['auth']) || $_SESSION['auth'] == 0) { header('Location: ' . $home . 'login.php'); } if (isset($_POST['message'])) { $dbh = db_connect($MY_HOST, $MY_DB_PORT, $MY_DB, $DB_USER, $DB_PW); $res = post_post($dbh, $_POST['title'], $_POST['message'], $_SESSION['user']); if ($res['status'] == 0) { $err_msg = "<h4 style='text-align:center;'>Error posting message</h4>"; } } ?> <html> <head> <title>Postly</title> <?php html_output_head(); ?> </head> <body> <div class="container"> <?php html_nav('timeline', $_SESSION['user']); ?> <div class="row" style='border-bottom: 1px solid #ccc;'> <?php
<?php session_start(); include "../config.php"; include "../functions.php"; include "../private_functions.php"; error_log("flit is:" . $_GET['flit'] . ", coorx is:" . $_GET['coorx'] . ", coory is:" . $_GET['coory']); if (isset($_SESSION['auth']) && $_SESSION['auth'] == 1 && isset($_GET['flit']) && isset($_GET['coorx']) && isset($_GET['coory'])) { $dbh = db_connect($MY_HOST, $MY_DB_PORT, $MY_DB, $DB_USER, $DB_PW); $message = $_GET['flit']; $hashtags = array(); $num_ht = preg_match_all("/#([^\\s]+)\\s/", $message . ' ', $hashtags); $res = post_post($dbh, $_GET['title'], $_GET['flit'], $_GET['coorx'], $_GET['coory'], $_SESSION['user']); if ($res['status'] == 1) { $pid = $res['pID']; error_log("In tests matches are:"); for ($i = 0; $i < count($hashtags[0]); $i++) { error_log($hashtags[1][$i]); attach_hashtag($dbh, $pid, $hashtags[1][$i]); } } close_db_connection($dbh); echo json_encode($res); } else { echo json_encode(array("status" => -1)); }
include "private_functions.php"; include "functions.php"; if (!isset($_SESSION['auth']) || $_SESSION['auth'] == 0) { header('Location: ' . $home . 'login.php'); } if (isset($_POST['message'])) { $dbh = db_connect($MY_HOST, $MY_DB_PORT, $MY_DB, $DB_USER, $DB_PW); $title = $_POST['title']; $coorX = $_POST['coorX']; $coorY = $_POST['coorY']; $message = $_POST['message']; $message2 = $message . ' '; $hashtags = array(); $num_ht = preg_match_all("/#([^\\s]+)\\s/", $message2, $hashtags); error_log($_SESSION['user'] . " posted:(" . $message . ") at location:(" . strval($coorX) . "," . strval($coorY) . ") with " . strval($num_ht) . " hashtags"); $res = post_post($dbh, $title, $message, $coorX, $coorY, $_SESSION['user']); if ($res['status'] == 0) { $err_msg = "<h4 style='text-align:center;'>Error posting message</h4>"; } else { $pid = $res['pID']; error_log("Matches are:"); for ($i = 0; $i < count($hashtags[0]); $i++) { error_log($hashtags[1][$i]); attach_hashtag($dbh, $pid, $hashtags[1][$i]); } } } ?> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>