forked from lanceseidman/PiCAST
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrabCAST.php
60 lines (48 loc) · 1.17 KB
/
grabCAST.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
// GRAB PiCAST
// CONNECT TO YOUR DB
$res = mysql_connect("localhost","piCASTER","piCAST1337");
// CONNECT SELECT THE DB
mysql_select_db("picasts", $res);
// MAKE QUERY FOR SELECTING ITEMS (0 Min. Max. 1)
$query = "SELECT * FROM `Items` LIMIT 0, 1 ";
$which = $res;
$sth = mysql_query($query,$which);
while($row = mysql_fetch_assoc($sth))
{
if($row['website'] == null)
{
// For Debug: echo "No Website...";
}
else // Website Exists!
{
// OUTPUT WEBSITE URL FOR PICAST
echo $row['website'];
// CREATE QUERY TO DELETE ENTRY
$order = "DELETE FROM `Items` WHERE 1";
// GO SEND THE DELETE
mysql_query($order, $res);
}
if($row['youtube'] == null)
{
// For Debug: echo "No YouTube Video...";
}
else // Website Exists!
{
echo "midori -e Fullscreen -a http://localhost/youtube.php?youtube=". $row['youtube'];
// CREATE QUERY TO DELETE ENTRY
$order = "DELETE FROM `Items` WHERE 1";
// GO SEND THE DELETE
mysql_query($order, $res);
}
}
/* JSON OPTION
$rows = array();
while($r = mysql_fetch_assoc($sth)) {
$rows[] = $r;
}
print json_encode($rows);
*/
// CLOSE THE SQL CONNECTION
mysql_close($res);
?>