session_start();
$user_id = $_SESSION['id'];
$username = $_SESSION['usr'];
if(isset($_GET['logoff']))
{
$_SESSION = array();
session_destroy();
header("Location: index.php");
exit;
}
if($_SESSION['id']){
// header("Location: ./index.php");
// die();
//echo "session id exists
";
} else { // echo "no session id
";
header("Location: index.php");
exit;
}
//if(!$_SESSION[id]){
// header("Location: ./index.php");
// die();
//}
$db = mysqli_connect ("localhost", "pack", "watch3r");
mysqli_select_db ($db, "pack");
//$checker = mysqli_query("SELECT * FROM pack_engine LIMIT 1");
// while ($gather = mysqli_fetch_array($checker)) {
//$enginestatus = $gather["status"];
// }
// if($enginestatus == 'DOWN'){
// header("Location: ./index.php");
// die();
// }
// if(!$_SESSION[id]){
// header("Location: ./index.php");
// die();
// }
$videosystem = 0;
$query = mysqli_query($db,"SELECT * FROM pack_song WHERE status LIKE '%PHASE%' order by status");
while ($gather = mysqli_fetch_array($query )) {
$videosystem++;
}
$d = $_GET['d'];
$rb = $_GET['rb'];
$yt = $_GET['yt'];
$dyt = $_GET['dyt'];
$pri = $_GET['pri'];
$pyt = $_GET['pyt'];
//$user_id = $_GET['id'];
//$user_id = $_SESSION[id];
#### YOU HAVE TO ADD USER CHECKING TO THIS TO MAKE SURE THEY ONLY DELETE THEIR VIDEOS
?>
$stuff = mysqli_query($db,"SELECT * FROM pack_user where id = '$user_id'");
while ($ratch = mysqli_fetch_array($stuff)) {
$account_id = $ratch["id"];
$email = $ratch["email"];
$name = $ratch["usr"];
$password = $ratch["password"];
$df = $ratch["df"];
}
// pull all the info
$box = mysqli_query($db, "SELECT * FROM pack_user_extended where user_id = '$account_id'");
while ($rite = mysqli_fetch_array($box)) {
$extended_account_id = $rite["id"];
$logo = $rite["logo"];
$website = $rite["website"];
$facebook = $rite["facebook"];
$soundcloud = $rite["soundcloud"];
$youtube = $rite["youtube"];
$bandcamp = $rite["bandcamp"];
$twitter = $rite["twitter"];
$instagram = $rite["instagram"];
$snapchat = $rite["snapchat"];
$introflag = $rite["introflag"];
$status = $rite["status"];
$profile = $rite["profile"];
$photo = $rite["photo"];
$spotify = $rite["spotify"];
$cellphone = $rite["cellphone"];
$itunes = $rite["itunes"];
$mailinglist = $rite["mailinglist"];
$credits = $rite["credits"];
$coins = $rite["coins"];
}
$crack = mysqli_query($db, "SELECT * FROM pack_song where user_id = '$user_id' and process_flag = 2 ORDER BY creation_date DESC");
$number_of_videos = mysqli_num_rows($crack);
$total_views = 0;
$total_likes = 0;
$crack = mysqli_query($db, "SELECT * FROM pack_song where user_id = '$user_id' and process_flag = 2 ORDER BY creation_date DESC");
while ($turtle = mysqli_fetch_array($crack)) {
$old_video = $turtle["id"];
# now go into pack_song_views
$tabulate = mysqli_query($db, "SELECT * FROM pack_song_views where id = '$old_video'");
while ($pip = mysqli_fetch_array($tabulate)) {
$vs = $pip["views"];
$ls = $pip["likes"];
$total_views = $total_views + $vs;
$total_likes = $total_likes + $ls;
}
}
// need to pull views and likes!
?>