Initial import
This commit is contained in:
		
							
								
								
									
										223
									
								
								api.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										223
									
								
								api.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,223 @@ | |||||||
|  | <?php | ||||||
|  | include_once("global.inc"); | ||||||
|  | $json = file_get_contents("php://input"); | ||||||
|  | $data = json_decode($json,true); | ||||||
|  | $command = $data['command']; | ||||||
|  |  | ||||||
|  | if ($command == '') | ||||||
|  | { | ||||||
|  | 	exit(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // API stuff for songbook mobile apps | ||||||
|  |  | ||||||
|  | if ($command == "venueExists") | ||||||
|  | { | ||||||
|  | 	$venueUrlName = $data['venueUrlName']; | ||||||
|  | 	$exists = venueExists($venueUrlName); | ||||||
|  | 	$output = array('command'=>$command,'error'=>'false', 'exists'=>$exists); | ||||||
|  |         print(json_encode($output,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); | ||||||
|  |         exit(); | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if ($command == "venueAccepting") | ||||||
|  | { | ||||||
|  | 	if (getAccepting()) | ||||||
|  |         	$output = array('command'=>$command,'accepting'=>true); | ||||||
|  | 	else | ||||||
|  | 		$output = array('command'=>$command,'accepting'=>false); | ||||||
|  |         header('Content-type: application/json'); | ||||||
|  |         print(json_encode($output,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); | ||||||
|  |         exit(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if ($command == "submitRequest") | ||||||
|  | { | ||||||
|  | 	$songId = $data['songId']; | ||||||
|  | 	$singerName = $data['singerName']; | ||||||
|  | 	$sql = "SELECT artist,title FROM songdb WHERE song_id = $songId"; | ||||||
|  | 	foreach ($db->query($sql) as $row) { | ||||||
|  |         	$artist = $row['artist']; | ||||||
|  |         	$title = $row['title']; | ||||||
|  | 	} | ||||||
|  | 	$stmt = $db->prepare("INSERT INTO requests (singer,artist,title) VALUES(:singerName, :artist, :title)"); | ||||||
|  | 	$stmt->execute(array(":singerName" => $singerName, ":artist" => $artist, ":title" => $title)); | ||||||
|  | 	newSerial(); | ||||||
|  | 	$output = array('command'=>$command,'error'=>'false', 'success'=>true); | ||||||
|  |         print(json_encode($output,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); | ||||||
|  | 	exit(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if ($command == "search") | ||||||
|  | { | ||||||
|  | 	$terms = explode(' ',$data['searchString']); | ||||||
|  | 	$no = count($terms); | ||||||
|  | 	$wherestring = ''; | ||||||
|  | 	if ($no == 1) { | ||||||
|  | 	        $wherestring = "WHERE (combined LIKE \"%" . $terms[0] . "%\")"; | ||||||
|  | 	} elseif ($no >= 2) {  | ||||||
|  | 	        foreach ($terms as $i => $term) { | ||||||
|  | 		     if ($i == 0) { | ||||||
|  | 	                $wherestring .= "WHERE ((combined LIKE \"%" . $term . "%\")"; | ||||||
|  | 	            } | ||||||
|  | 	            if (($i > 0) && ($i < $no - 1)) { | ||||||
|  | 	                $wherestring .= " AND (combined LIKE \"%" . $term . "%\")"; | ||||||
|  | 	            } | ||||||
|  | 	            if ($i == $no - 1) { | ||||||
|  | 	                $wherestring .= " AND (combined LIKE \"%" . $term . "%\") AND(artist<>'DELETED'))"; | ||||||
|  | 	            } | ||||||
|  | 	        } | ||||||
|  | 	} else { | ||||||
|  | 	        $wherestring = ""; | ||||||
|  | 	} | ||||||
|  | 	$entries = null; | ||||||
|  | 	$res = array(); | ||||||
|  | 	$sql = "SELECT song_id,artist,title,combined FROM songdb $wherestring ORDER BY UPPER(artist), UPPER(title)"; | ||||||
|  | 	foreach ($db->query($sql) as $row) | ||||||
|  | 	{ | ||||||
|  | 	    if ((stripos($row['combined'],'wvocal') === false) && (stripos($row['combined'],'w-vocal') === false) && (stripos($row['combined'],'vocals') === false)) { | ||||||
|  | 	            $res[] = array('song_id'=>$row['song_id'],'artist'=>$row['artist'],'title'=>$row['title']); | ||||||
|  | 	    } | ||||||
|  | 	} | ||||||
|  | 	$output = array("command" => "search", "songs" => $res); | ||||||
|  | 	header('Content-type: application/json'); | ||||||
|  | 	print(json_encode($output,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); | ||||||
|  | 	exit(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | // API stuff for OpenKJ application | ||||||
|  |  | ||||||
|  | if ($command == "clearDatabase") | ||||||
|  | { | ||||||
|  | 	$db->exec("DELETE FROM songdb"); | ||||||
|  | 	$db->exec("DELETE FROM requests"); | ||||||
|  | 	$newSerial = newSerial(); | ||||||
|  | 	$output = array('command'=>$command,'error'=>'false', 'serial'=>newSerial()); | ||||||
|  | 	print(json_encode($output,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); | ||||||
|  | 	exit(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function error($error_string) { | ||||||
|  |         header('Content-type: application/json'); | ||||||
|  |         print(json_encode(array('command'=>$command,'error'=>'true','errorString'=>$error_string),JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); | ||||||
|  | 	exit(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if ($command == "clearRequests") | ||||||
|  | { | ||||||
|  | 	$db->exec("DELETE FROM requests"); | ||||||
|  |         $output = array('command'=>$command,'error'=>'false', 'serial'=>newSerial()); | ||||||
|  |         print(json_encode($output,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); | ||||||
|  | 	exit(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if ($command == "deleteRequest") | ||||||
|  | { | ||||||
|  | 	$request_id = $data['request_id']; | ||||||
|  | 	$stmt = $db->prepare("DELETE FROM requests WHERE request_id = :requestId"); | ||||||
|  | 	$stmt->execute(array(":requestId" => $request_id)); | ||||||
|  |         $output = array('command'=>$command,'error'=>'false', 'serial'=>newSerial()); | ||||||
|  |         print(json_encode($output,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); | ||||||
|  | 	exit(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if ($command == "connectionTest") | ||||||
|  | { | ||||||
|  | 	header('Content-type: application/json'); | ||||||
|  | 	$output = array('command'=>$command,'connection'=>'ok'); | ||||||
|  | 	print(json_encode($output,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); | ||||||
|  | 	exit(); | ||||||
|  | } | ||||||
|  | if ($command == "addSongs") | ||||||
|  | { | ||||||
|  | 	$stmt = $db->prepare("INSERT OR IGNORE INTO songdb (artist, title, combined) VALUES (:artist, :title, :combined)"); | ||||||
|  | 	$db->beginTransaction(); | ||||||
|  | 	$errors = array(); | ||||||
|  | 	$count = 0; | ||||||
|  | 	$artist = ""; | ||||||
|  | 	$title = ""; | ||||||
|  | 	$combined = ""; | ||||||
|  | 	$error = "false"; | ||||||
|  | 	foreach ($data['songs'] as $song) | ||||||
|  | 	{ | ||||||
|  | 		$artist = $song['artist']; | ||||||
|  | 		$title = $song['title']; | ||||||
|  | 		$combined = $artist . " " . $title; | ||||||
|  | 		$inarray = array(":artist" => $artist, ":title" => $title, ":combined" => $combined); | ||||||
|  | 		$result = $stmt->execute($inarray); | ||||||
|  | 		if ($result === false) | ||||||
|  | 		{ | ||||||
|  | 			$errors[] = $db->errorInfo(); | ||||||
|  | 			$error = "true"; | ||||||
|  | 		} | ||||||
|  | 		$count++; | ||||||
|  | 	} | ||||||
|  | 	$result = $db->commit(); | ||||||
|  | 	if ($result == false) | ||||||
|  | 		$errors[] = $db->errorInfo(); | ||||||
|  | 	$output['command'] = $command; | ||||||
|  | 	$output['error'] = $error; | ||||||
|  | 	$output['errors'] = $errors; | ||||||
|  | 	$output['entries processed'] = $count; | ||||||
|  | 	$output['last_artist'] = $artist; | ||||||
|  | 	$output['last_title'] = $title; | ||||||
|  | 	header('Content-type: application/json'); | ||||||
|  | 	print(json_encode($output,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); | ||||||
|  | 	exit(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if ($command == "getSerial") | ||||||
|  | { | ||||||
|  | 	$output = array('command'=>$command,'serial'=>getSerial(),'error'=>'false'); | ||||||
|  | 	header('Content-type: application/json'); | ||||||
|  | 	print(json_encode($output,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); | ||||||
|  | 	exit(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if ($command == "getAccepting") | ||||||
|  | { | ||||||
|  | 	$accepting = getAccepting(); | ||||||
|  | 	$output = array('command'=>$command,'accepting'=>$venue['accepting'],'venue_id'=>0); | ||||||
|  | 	header('Content-type: application/json'); | ||||||
|  | 	print(json_encode($output,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); | ||||||
|  | 	exit(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if ($command == "setAccepting") | ||||||
|  | { | ||||||
|  | 	$accepting = (bool)$data['accepting']; | ||||||
|  |         setAccepting($accepting); | ||||||
|  | 	$newSerial = newSerial(); | ||||||
|  | 	$output = array('command'=>$command,'error'=>'false','venue_id'=>0,'accepting'=>$accepting,'serial'=>$newSerial); | ||||||
|  |         print(json_encode($output,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); | ||||||
|  |         exit(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if ($command == "getVenues") | ||||||
|  | { | ||||||
|  | 	$output = getVenues(); | ||||||
|  | 	$output['command'] = $command; | ||||||
|  | 	$output['error'] = 'false'; | ||||||
|  | 	header('Content-type: application/json'); | ||||||
|  |         print(json_encode($output,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); | ||||||
|  | 	exit(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if ($command == "getRequests") | ||||||
|  | { | ||||||
|  | 	$serial = getSerial(); | ||||||
|  | 	$output = getRequests(); | ||||||
|  | 	$output['command'] = $command; | ||||||
|  | 	$output['error'] = 'false'; | ||||||
|  | 	$output['serial'] = $serial; | ||||||
|  | 	header('Content-type: application/json'); | ||||||
|  | 	print(json_encode($output,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); | ||||||
|  | 	exit(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | ?> | ||||||
							
								
								
									
										161
									
								
								global.inc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										161
									
								
								global.inc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,161 @@ | |||||||
|  | <?php | ||||||
|  | include("settings.inc"); | ||||||
|  | $db = new PDO("sqlite:$dbFilePath"); | ||||||
|  |  | ||||||
|  | $db->exec("CREATE TABLE IF NOT EXISTS songdb (song_id integer PRIMARY KEY AUTOINCREMENT, artist text, title  TEXT, combined TEXT UNIQUE)");  | ||||||
|  | $db->exec("CREATE TABLE IF NOT EXISTS state (accepting bool, serial integer NOT NULL)"); | ||||||
|  | $db->exec("INSERT OR IGNORE INTO state (rowid,accepting,serial) VALUES(0,0,1)"); | ||||||
|  | $db->exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_songstrings ON songdb(combined)"); | ||||||
|  | $db->exec("CREATE TABLE IF NOT EXISTS requests (request_id integer PRIMARY KEY AUTOINCREMENT, artist TEXT, title TEXT, singer TEXT, request_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP)"); | ||||||
|  |  | ||||||
|  | $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); | ||||||
|  | $accepting = true; | ||||||
|  | $songdbtable = "songdb"; | ||||||
|  | $requeststable = "requests"; | ||||||
|  |  | ||||||
|  | if (isset($_SERVER['REFERER'])) $referer = $_SERVER['REFERER'];  | ||||||
|  | function siteheader($title)  | ||||||
|  | { | ||||||
|  | 	global $venueName; | ||||||
|  | 	global $screensize; | ||||||
|  | 	echo "<html><head> | ||||||
|  | 		<link href='https://fonts.googleapis.com/css?family=Audiowide' rel='stylesheet'> | ||||||
|  | 		<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'> | ||||||
|  | 		<title>$venueName Karaoke Songbook</title> | ||||||
|  | 		<link rel=stylesheet type=\"text/css\" href=venuestyle.css /> | ||||||
|  | 		<script type=\"text/javascript\"> | ||||||
|  |     			function submitreq(varid){ | ||||||
|  |         			window.location = \"./submitreq.php?id=\" + varid; | ||||||
|  |     			} | ||||||
|  | 		</script> | ||||||
|  | 	      </head><body>"; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function sitefooter() { | ||||||
|  | 	echo "</div></body></html>"; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function navbar($backurl)  | ||||||
|  | { | ||||||
|  | 	if ($backurl == "") | ||||||
|  | 		$backurl = index.php; | ||||||
|  | 	global $screensize; | ||||||
|  | 	echo "<div class=navbar> | ||||||
|  | 	<span class=title>OpenKJ Songbook</span> | ||||||
|  | 	</div><div class=mainbody><span class=backbtn><a class=button href=\"$backurl\" class=navbar id=backlink>Back</a></span>"; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function setAccepting($accepting) | ||||||
|  | { | ||||||
|  | 	global $db; | ||||||
|  | 	$db->exec("UPDATE state SET accepting=$accepting"); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function getAccepting() | ||||||
|  | { | ||||||
|  | 	global $db; | ||||||
|  | 	$accepting = false; | ||||||
|  |         foreach ($db->query("SELECT accepting FROM state LIMIT 1") as $row) | ||||||
|  |         { | ||||||
|  |                 $accepting = (bool)$row['accepting']; | ||||||
|  |         } | ||||||
|  | 	return $accepting; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function searchform()  | ||||||
|  | { | ||||||
|  | 	global $db; | ||||||
|  | 	global $venue_id; | ||||||
|  | 	if (!getAccepting()) | ||||||
|  | 	{ | ||||||
|  | 		echo "<br><br><h2>Sorry, requests are not being accepted at this time</h2>"; | ||||||
|  | 	} | ||||||
|  | 	else | ||||||
|  | 	{ | ||||||
|  | 		global $url_name; | ||||||
|  | 		global $screensize; | ||||||
|  | 		echo "<br><p><form method=get action=search.php>Song search: <input type=text name=q autofocus autocomplete=off><input type=submit value=Search></form></p>"; | ||||||
|  | 		echo '<p class=info>You may enter any part of the artist and/or title of the song.  Partial words are allowed.</p> | ||||||
|  | 			<p class=info>For example "pai bla stone" would match "Rolling Stones, The - Paint it black".</p>'; | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | function getSerial() | ||||||
|  | { | ||||||
|  | 	global $db; | ||||||
|  | 	$serial = -1; | ||||||
|  | 	foreach ($db->query("SELECT serial FROM state LIMIT 1") as $row) | ||||||
|  |         { | ||||||
|  |         	$serial = (int)$row['serial']; | ||||||
|  |         } | ||||||
|  | 	return $serial; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function newSerial() | ||||||
|  | { | ||||||
|  |         global $db; | ||||||
|  |         $serial = getSerial(); | ||||||
|  |         $newSerial = mt_rand(0,99999); | ||||||
|  |         while ($newSerial == $serial) | ||||||
|  |         { | ||||||
|  |                 $newSerial = mt_rand(0,99999); | ||||||
|  |         } | ||||||
|  |         $db->exec("UPDATE state SET serial=$newSerial"); | ||||||
|  |         return $newSerial; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function getVenue() | ||||||
|  | { | ||||||
|  | 	// We don't really do multiple venues in standalone, just fake it | ||||||
|  |         global $db; | ||||||
|  | 	global $venueName; | ||||||
|  |         $serial = -1; | ||||||
|  | 	$venue = array(); | ||||||
|  | 	$venue['venue_id'] = $venue_id; | ||||||
|  |         $venue['accepting'] = getAccepting(); | ||||||
|  | 	$venue['name'] = $venueName; | ||||||
|  | 	$venue['url_name'] = "none"; | ||||||
|  | 	return $venue; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function getVenues() | ||||||
|  | { | ||||||
|  | 	// We don't really do multiple venues in standalone, just fake it | ||||||
|  | 	global $db; | ||||||
|  | 	global $venueName; | ||||||
|  | 	$venues = array(); | ||||||
|  | 	$venue['venue_id'] = 0; | ||||||
|  |         $venue['accepting'] = getAccepting(); | ||||||
|  |         $venue['name'] = $venueName; | ||||||
|  | 	$venue['url_name'] = "none"; | ||||||
|  | 	$venues['venues'][] = $venue; | ||||||
|  | 	return $venues; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function getRequests() | ||||||
|  | { | ||||||
|  |         global $db; | ||||||
|  |         $requests = array(); | ||||||
|  |         $result = $db->query("SELECT request_id,artist,title,singer,strftime('%s', request_time) AS unixtime FROM requests"); | ||||||
|  | 	if ($result) | ||||||
|  | 	{ | ||||||
|  |         	foreach ($result as $row) | ||||||
|  |         	{ | ||||||
|  |         	        $request['request_id'] = (int)$row['request_id']; | ||||||
|  |         	        $request['artist'] = $row['artist']; | ||||||
|  |         	        $request['title'] = $row['title']; | ||||||
|  |         	        $request['singer'] = $row['singer']; | ||||||
|  |         	        $request['request_time'] = (int)$row['unixtime']; | ||||||
|  |         	        $requests['requests'][] = $request; | ||||||
|  |         	} | ||||||
|  | 	} | ||||||
|  |         return $requests; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ?> | ||||||
							
								
								
									
										16
									
								
								index.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								index.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | |||||||
|  | <?php | ||||||
|  | include("global.inc"); | ||||||
|  | siteheader("Home"); | ||||||
|  | navbar("index.php"); | ||||||
|  |  | ||||||
|  | searchform(); | ||||||
|  | /* | ||||||
|  | if ($screensize == 'xlarge') | ||||||
|  | { | ||||||
|  | 	echo "<br><br><p class=info>Want to search using your smartphone, tablet, or laptop?<br><br>Browse to songbook.openkj.org/venue/$url_name in the web browser on your device.<br><br> | ||||||
|  | "; | ||||||
|  | } | ||||||
|  | */ | ||||||
|  | sitefooter(); | ||||||
|  |  | ||||||
|  | ?> | ||||||
							
								
								
									
										69
									
								
								search.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								search.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,69 @@ | |||||||
|  | <?php  | ||||||
|  | include('global.inc'); | ||||||
|  | siteheader('Search Results'); | ||||||
|  | navbar("index.php"); | ||||||
|  |  | ||||||
|  | if ($_GET['q'] == '') { | ||||||
|  |         echo "<p>You must enter at least one search term</p>"; | ||||||
|  |         die(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if (strlen($_GET['q']) < 3) | ||||||
|  | { | ||||||
|  | 	echo '<p>Your search string was too short, please try again</p>'; | ||||||
|  | 	die(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | echo '<br><p>Search Results<br>Tap a song to submit it</p>'; | ||||||
|  |  | ||||||
|  | $terms = explode(' ',$_GET['q']); | ||||||
|  | $no = count($terms); | ||||||
|  | $wherestring = ''; | ||||||
|  | if ($no == 1) { | ||||||
|  | 	$wherestring = "WHERE (combined LIKE \"%" . $terms[0] . "%\")"; | ||||||
|  | } elseif ($no >= 2) { | ||||||
|  |         foreach ($terms as $i => $term) { | ||||||
|  |             if ($i == 0) { | ||||||
|  |                 $wherestring .= "WHERE ((combined LIKE \"%" . $term . "%\")"; | ||||||
|  |             } | ||||||
|  |             if (($i > 0) && ($i < $no - 1)) { | ||||||
|  |                 $wherestring .= " AND (combined LIKE \"%" . $term . "%\")"; | ||||||
|  |             } | ||||||
|  |             if ($i == $no - 1) { | ||||||
|  |                 $wherestring .= " AND (combined LIKE \"%" . $term . "%\") AND(artist != 'DELETED'))"; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  | } else { | ||||||
|  | 	echo "<li>You must enter at least one search term</li>"; | ||||||
|  | 	die(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | $entries = null; | ||||||
|  | $res = array(); | ||||||
|  |     $sql = "SELECT song_id,artist,title,combined FROM songdb $wherestring ORDER BY UPPER(artist), UPPER(title)"; | ||||||
|  |     foreach ($db->query($sql) as $row) | ||||||
|  |         { | ||||||
|  | 	if ((stripos($row['combined'],'wvocal') === false) && (stripos($row['combined'],'w-vocal') === false) && (stripos($row['combined'],'vocals') === false)) { | ||||||
|  | 		$res[$row['song_id']] = $row['artist'] . " - " . $row['title']; | ||||||
|  | 	} | ||||||
|  |         } | ||||||
|  |     $db = null; | ||||||
|  |  | ||||||
|  | $unique = array_unique($res); | ||||||
|  |  | ||||||
|  | foreach ($unique as $key => $val) { | ||||||
|  | 	$entries[] = "<tr><td class=result onclick=\"submitreq(${key})\">" . $val . "</td></tr>"; | ||||||
|  | } | ||||||
|  | if (count($unique) > 0) { | ||||||
|  | 	echo '<table border=1>'; | ||||||
|  | 	foreach ($entries as $song) { | ||||||
|  | 		echo $song; | ||||||
|  | 	} | ||||||
|  | 	echo '</table>'; | ||||||
|  | } else { | ||||||
|  | 	echo "<p>Sorry, no match found.</p>"; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | sitefooter(); | ||||||
|  | ?>  | ||||||
							
								
								
									
										5
									
								
								settings.inc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								settings.inc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | <?php | ||||||
|  |  | ||||||
|  | $venueName = 'Default Venue'; | ||||||
|  | $dbFilePath = '/var/www/html/okjweb/okjweb.db'; | ||||||
|  | ?> | ||||||
							
								
								
									
										35
									
								
								submitreq-run.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								submitreq-run.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | |||||||
|  | <?php  | ||||||
|  | include('global.inc'); | ||||||
|  | #header("Refresh: 15; URL="); | ||||||
|  | siteheader("Song Submitted"); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | $songid = $_GET['songid']; | ||||||
|  | $singer = $_GET['singer']; | ||||||
|  | if ($singer == '') { | ||||||
|  | 	navbar($_SERVER['HTTP_REFERER']); | ||||||
|  | 	echo "<p>Sorry, you must input a singer name.  Please go back and try again.</p>"; | ||||||
|  | 	die(); | ||||||
|  |  | ||||||
|  | } | ||||||
|  | navbar("index.php"); | ||||||
|  | $entries = null; | ||||||
|  | $wherestring = null; | ||||||
|  | $artist = ''; | ||||||
|  | $title = ''; | ||||||
|  | $sql = "SELECT artist,title FROM songdb WHERE song_id = $songid"; | ||||||
|  | foreach ($db->query($sql) as $row) { | ||||||
|  | 	$artist = $row['artist']; | ||||||
|  | 	$title = $row['title']; | ||||||
|  | } | ||||||
|  | $stmt = $db->prepare("INSERT INTO requests (singer,artist,title) VALUES(:singer, :artist, :title)"); | ||||||
|  | $stmt->execute(array(":singer" => $singer, ":artist" => $artist, ":title" => $title)); | ||||||
|  | newSerial(); | ||||||
|  | echo "<p>Song: $artist - $title</p> | ||||||
|  |       <p>Submitted for singer: $singer</p> | ||||||
|  | 	<br><p>Please press back to return to the main screen</p> | ||||||
|  | "; | ||||||
|  |  | ||||||
|  | sitefooter(); | ||||||
|  | ?>  | ||||||
							
								
								
									
										25
									
								
								submitreq.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								submitreq.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | |||||||
|  | <?php | ||||||
|  | include('global.inc'); | ||||||
|  | siteheader('Submit Request'); | ||||||
|  | $referer = $_SERVER['HTTP_REFERER']; | ||||||
|  | if (strpos($referer,'submitreq-run.php?screensize=$screensize') !== false) | ||||||
|  | { | ||||||
|  | 	navbar("index.php"); | ||||||
|  | } else { | ||||||
|  | 	navbar($referer); | ||||||
|  | } | ||||||
|  | $songid = $_GET['id']; | ||||||
|  |  | ||||||
|  | $artist = ''; | ||||||
|  | $title = ''; | ||||||
|  | $sql = "SELECT artist,title FROM songdb WHERE song_id = $songid"; | ||||||
|  | foreach ($db->query($sql) as $row) { | ||||||
|  |         $artist = $row['artist']; | ||||||
|  |         $title = $row['title']; | ||||||
|  | } | ||||||
|  | $db = null; | ||||||
|  | echo "<br><p>Submitting Song:<br>"; | ||||||
|  | echo "<p>$artist - $title</p>"; | ||||||
|  | echo "<form method=get action=submitreq-run.php><input type=hidden name=screensize value=$screensize><input type=hidden name=songid value=$songid>Please enter your name or nickname:<br><input type=text name=singer autocomplete=off autofocus><input type=submit></form>"; | ||||||
|  | echo "<p class=info>If you have a common first name, please also enter your last initial or last name.<br>Doing so will help eliminate confusion and reduce the risk of your turn getting skipped."; | ||||||
|  | ?> | ||||||
							
								
								
									
										98
									
								
								venuestyle.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										98
									
								
								venuestyle.css
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,98 @@ | |||||||
|  | @import url(http://fonts.googleapis.com/css?family=Scada); | ||||||
|  | @import url(http://fonts.googleapis.com/css?family=Audiowide); | ||||||
|  |  | ||||||
|  | body | ||||||
|  | { | ||||||
|  | 	text-align: center; | ||||||
|  | 	font-family: 'Scada', sans-serif; | ||||||
|  | 	font-size: 1.2em; | ||||||
|  | 	font-weight: bold; | ||||||
|  | 	background-color: white; | ||||||
|  | 	color: black; | ||||||
|  | 	padding-top: 60px; | ||||||
|  | } | ||||||
|  | input[type=text] { | ||||||
|  |     	border: 2px solid black; | ||||||
|  | 	padding-top: 5px; | ||||||
|  | 	padding-bottom: 5px; | ||||||
|  | 	margin-right: 5px; | ||||||
|  | 	font-size: 1.2em; | ||||||
|  | 	font-weight: bold; | ||||||
|  | } | ||||||
|  | p.info | ||||||
|  | { | ||||||
|  | 	font-size: 1.0em; | ||||||
|  | } | ||||||
|  | div.navbar | ||||||
|  | { | ||||||
|  | #        height: 50px; | ||||||
|  | 	width: 100%; | ||||||
|  |         position: fixed; | ||||||
|  |         left: 0; | ||||||
|  |         top: 0; | ||||||
|  | 	padding-left: 5px; | ||||||
|  | 	padding-top: 5px; | ||||||
|  | 	padding-bottom: 5px; | ||||||
|  | 	padding-right: 5px | ||||||
|  |         width: 100%; | ||||||
|  |         background-color: white; | ||||||
|  |         color: black; | ||||||
|  |         text-align: left; | ||||||
|  | 	border-style: solid; | ||||||
|  | 	border-width: 0px 0px 2px 0px; | ||||||
|  | } | ||||||
|  | a.navbar | ||||||
|  | { | ||||||
|  | 	color: white; | ||||||
|  | 	text-decoration: none; | ||||||
|  | } | ||||||
|  | div.spacer | ||||||
|  | { | ||||||
|  | 	position: relative; | ||||||
|  | 	width: 90%; | ||||||
|  | 	top: 0; | ||||||
|  | 	height: 50px; | ||||||
|  | } | ||||||
|  | table | ||||||
|  | { | ||||||
|  | 	margin: auto; | ||||||
|  | 	min-width: 60%; | ||||||
|  | 	border: 1px; | ||||||
|  | } | ||||||
|  | td.result | ||||||
|  | { | ||||||
|  | 	color: black; | ||||||
|  | 	font-size: 1.6em; | ||||||
|  | 	font-weight: bold; | ||||||
|  | 	text-align: left; | ||||||
|  | 	padding: 20px; | ||||||
|  | 	border-spacing: 10px; | ||||||
|  | 	border-style: solid; | ||||||
|  | 	border-size: 2px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | input[type=button], input[type=submit], input[type=reset], a.button { | ||||||
|  |     background-color: white; | ||||||
|  |     border: 2px; | ||||||
|  |     border-style: solid; | ||||||
|  |     border-color: black; | ||||||
|  |     font-weight: bold; | ||||||
|  |     color: black; | ||||||
|  |     padding: 8px 20px; | ||||||
|  |     margin-top: 12px; | ||||||
|  |     text-decoration: none; | ||||||
|  |     font-size: 1.2em; | ||||||
|  |     cursor: pointer; | ||||||
|  | } | ||||||
|  | .backbtn { | ||||||
|  | 	position: fixed; | ||||||
|  | 	top: 75px; | ||||||
|  | 	left: 5px; | ||||||
|  | } | ||||||
|  | .title { | ||||||
|  | 	font-size: 2em; | ||||||
|  | 	font-family: Audiowide, cursive; | ||||||
|  | 	float: right; | ||||||
|  | 	margin-right: 10px; | ||||||
|  | 	text-shadow: 4px 4px 4px #aaa; | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user