示例#1
2
<?php

include_once "dbinfo.inc.oop.php";
$pid = $_GET['pid'];
if ($pid == "") {
    header('Location: myprofile.php');
}
$repost = repost($pid);
if ($repost) {
    header('Location: myprofile.php?success');
} else {
    header('Location: myprofile.php?error');
}
示例#2
1
文件: repost.php 项目: khanhnnvn/OKMS
<?php

//Repost
require_once '../includes/functions.inc.php';
$uid = isset($_POST['uid']) ? $_POST['uid'] : '';
$cid = isset($_POST['cid']) ? $_POST['cid'] : '';
$week = isset($_POST['week']) ? $_POST['week'] : '';
$title = isset($_POST['title']) ? $_POST['title'] : '';
$url = isset($_POST['url']) ? $_POST['url'] : '';
$body = isset($_POST['body']) ? $_POST['body'] : '';
$answer = isset($_POST['answer']) ? $_POST['answer'] : '';
$repostid = isset($_POST['repostid']) ? $_POST['repostid'] : '';
repost($uid, $cid, $week, $title, $url, $body, $answer, $repostid);
header('location: ../?p=post');
示例#3
0
 $stmt1 = $conn->prepare($sql1);
 $stmt1->bindValue(':post_id', $post_id);
 try {
     $stmt1->execute();
 } catch (PDOException $e) {
     echo $e->getMessage();
 }
 $result = $stmt1->FetchAll(PDO::FETCH_ASSOC);
 //$id = postBy($post_id);
 //if($id == $users_id){
 //	$success = "0";
 //	$msg = "You cannot share your own post!";
 //}
 //else{
 if ($result) {
     $repost_id = repost($users_id1, $users_id2, $post_id, $action);
     if (!empty($repost_id)) {
         $success = "1";
         $msg = "post is shared successfully!";
         $data = $repost_id;
         $sql = "SELECT SN.users_id1, SN.users_id2, SN.share_id, P.id as pid, P.url, U.id as uid, U.name, CONCAT(  '{$path}', profile_pic ) AS profile_pic,  \n\t\t\t\t\t\t\tCASE \n\t\t\t\t\t\t\t\tWHEN DATEDIFF( NOW( ) , S.created_on ) !=0\n\t\t\t\t\t\t\t\tTHEN CONCAT( DATEDIFF( NOW( ) , S.created_on ) ,  'd ago' ) \n\t\t\t\t\t\t\t\tWHEN HOUR( TIMEDIFF( NOW( ) , S.created_on ) ) !=0\n\t\t\t\t\t\t\t\tTHEN CONCAT( HOUR( TIMEDIFF( NOW( ) , S.created_on ) ) ,  'h ago' ) \n\t\t\t\t\t\t\t\tWHEN MINUTE( TIMEDIFF( NOW( ) , S.created_on ) ) !=0\n\t\t\t\t\t\t\t\tTHEN CONCAT( MINUTE( TIMEDIFF( NOW( ) , S.created_on ) ) ,  'm ago' ) \n\t\t\t\t\t\t\t\tELSE CONCAT( SECOND( TIMEDIFF( NOW( ) , S.created_on ) ) ,  's ago' ) \n\t\t\t\t\t\t\tEND AS time_since\n\t\t\t\t\t\t\t\tFROM  `shared_noti` AS SN\n\t\t\t\t\t\t\t\tJOIN `share` AS S ON S.id = SN.share_id\n\t\t\t\t\t\t\t\tJOIN `post` AS P ON P.id=S.post_id\n\t\t\t\t\t\t\t\tJOIN `users` AS U ON U.id = SN.users_id2\n\t\t\t\t\t\t\t\tWHERE SN.share_id =:repost_id";
         $sth = $conn->prepare($sql);
         $sth->bindValue(":repost_id", $repost_id);
         try {
             $sth->execute();
         } catch (Exception $e) {
         }
         $result = $sth->fetchAll(PDO::FETCH_ASSOC);
         $sql2 = "SELECT SN.users_id1, SN.users_id2, SN.share_id, P.url, U.name, CONCAT(  '{$path}', profile_pic ) AS profile_pic, U.apn_id, \n\t\t\t\t\t\t\tCASE \n\t\t\t\t\t\t\t\tWHEN DATEDIFF( NOW( ) , S.created_on ) !=0\n\t\t\t\t\t\t\t\tTHEN CONCAT( DATEDIFF( NOW( ) , S.created_on ) ,  'd ago' ) \n\t\t\t\t\t\t\t\tWHEN HOUR( TIMEDIFF( NOW( ) , S.created_on ) ) !=0\n\t\t\t\t\t\t\t\tTHEN CONCAT( HOUR( TIMEDIFF( NOW( ) , S.created_on ) ) ,  'h ago' ) \n\t\t\t\t\t\t\t\tWHEN MINUTE( TIMEDIFF( NOW( ) , S.created_on ) ) !=0\n\t\t\t\t\t\t\t\tTHEN CONCAT( MINUTE( TIMEDIFF( NOW( ) , S.created_on ) ) ,  'm ago' ) \n\t\t\t\t\t\t\t\tELSE CONCAT( SECOND( TIMEDIFF( NOW( ) , S.created_on ) ) ,  's ago' ) \n\t\t\t\t\t\t\tEND AS time_since\n\t\t\t\t\t\t\t\tFROM  `shared_noti` AS SN\n\t\t\t\t\t\t\t\tJOIN `share` AS S ON S.id = SN.share_id\n\t\t\t\t\t\t\t\tJOIN `post` AS P ON P.id=S.post_id\n\t\t\t\t\t\t\t\tJOIN `users` AS U ON U.id = SN.users_id1\n\t\t\t\t\t\t\t\tWHERE SN.share_id =:repost_id";
         $sth2 = $conn->prepare($sql2);
         $sth2->bindValue(":repost_id", $repost_id);