예제 #1
0
<?php

include_once "common.php";
if (LoggedIn() === true) {
    $ownerid = GetUserIdByName(GetUserName());
    ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>3pm - Home</title>
<script type="text/javascript">
function CallParentSetTrackToPlay( divObj ) {
	var trackKey = divObj.getAttribute( 'data-keycode' );
	var trackId = divObj.getAttribute( 'data-trackid' );
	var trackTitle = divObj.getAttribute( 'data-title' );
	var trackArtist = divObj.getAttribute( 'data-artist' );
	var trackAlbum = divObj.getAttribute( 'data-album' );
	parent.SetTrackToPlay( trackKey, trackTitle, trackArtist, trackAlbum, trackId );
}
function ClearSelection() {
    if(document.selection && document.selection.empty) {
        document.selection.empty();
    } else if(window.getSelection) {
        var sel = window.getSelection();
        sel.removeAllRanges();
    }
}
document.onclick = parent.CloseUserMenu;
</script>
<link type="text/css" rel="stylesheet" href="style.css">
예제 #2
0
<?php

include_once "common.php";
if (LoggedIn() === true) {
    $userid = GetUserIdByName($_SESSION['user']);
    if (isset($_POST['submit'])) {
        // If submitted....
        $playlistname = mysql_real_escape_string(stripslashes($_POST['playlistname']));
        $numberofsongs = (int) mysql_real_escape_string(stripslashes($_POST['playlistname']));
        if ($_POST['playlistselect'] == "-1") {
            // If -1, then INSERT.
            $sql = "INSERT INTO `playlists` ( `userId`, `createDate`, `updateDate`, `name`, `adds` ) " . "VALUES ( {$userId}, NOW(), NOW(), '{$playlistname}', 0 ); ";
            mysql_query($sql);
            // Get the newly inserted playlist id.
            $sql = "SELECT id FROM `playlists` WHERE `userid` = {$userId} AND `name` = '{$playlistname}'; ";
            $result = mysql_query($sql);
            while ($row = mysql_fetch_array($result)) {
                $playlistid = $row['id'];
                break;
            }
            // Insert all song IDs into the 'playlistitems' table.
            for ($i = 0; $i < $numberofsongs; $i++) {
                $songid = mysql_real_escape_string(stripslashes($_POST['songid' . $i]));
                if ($songid != "") {
                    $sql = "INSERT INTO `playlistitems` ( `playlistid`, `trackid`, `sort` ) " . "VALUES ( {$playlistid}, {$songid}, {$i} ); ";
                    // for now, sort in the order the songs are fed in.
                }
            }
            echo "Playlist saved. <a href='#' onclick='window.parent.TogglePopupBg();' title='Click here to close this window.'>Close this window.</a>";
            exit;
        } else {