Hallo,
Een 2-tal weken geleden ben ik begonnen met PHP leren, ik had toen al een paar dingen gemaakt. Waaronder de Random Youtube V1. Het stelt nog niet veel voor, maar ik wil het toch met jullie delen.
Door de examens kan ik niet verder PHP leren, maar als ik er binnenkort verder aan kan doen. Maak ik het uitgebreider met een admin zodat je niets meer in het script zelf moet aanpassen, met de database dus. Dat zal de v2 worden.
Demo: http://sander.s3.one2xs.com/PHP/musicV1
Tips of verbeteringen zijn altijd welkom.
Reacties natuurlijk ook
Sander
Een 2-tal weken geleden ben ik begonnen met PHP leren, ik had toen al een paar dingen gemaakt. Waaronder de Random Youtube V1. Het stelt nog niet veel voor, maar ik wil het toch met jullie delen.
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]# Copyright Sander C. 2012 #
# Niet cleinmen als uw eigen #
//Hier voeg je handmatig de namen van de code (!!!GENUMMERD!!!). Dus $naam [1] is de naam van $code [1][/COLOR]
[COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]1[/COLOR][COLOR= #007700]] =[/COLOR][COLOR= #DD0000]"Gusttavo Lima con Neymar - Balada"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]2[/COLOR][COLOR= #007700]] =[/COLOR][COLOR= #DD0000]"Carly Rea Jepsen - Call My Maybe"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]3[/COLOR][COLOR= #007700]] =[/COLOR][COLOR= #DD0000]"Triggerfinger - I Follow Rivers"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]4[/COLOR][COLOR= #007700]] =[/COLOR][COLOR= #DD0000]"Gers Pardoel ft. Sef - Bagagedrager"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]5[/COLOR][COLOR= #007700]] =[/COLOR][COLOR= #DD0000]"DJ Fresh ft. Rita Ora - Hot Right Now"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]6[/COLOR][COLOR= #007700]] =[/COLOR][COLOR= #DD0000]" Jason Derulo - Skys the limit"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #FF8000]// Hier plak je de code van de youtube video in. Dit stuk staat achter de [/COLOR]
[COLOR= #0000BB]$code[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]1[/COLOR][COLOR= #007700]] =[/COLOR][COLOR= #DD0000]"SYhF56heGxw"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$code[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]2[/COLOR][COLOR= #007700]] =[/COLOR][COLOR= #DD0000]"fWNaR-rxAic"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$code[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]3[/COLOR][COLOR= #007700]] =[/COLOR][COLOR= #DD0000]"fzWQV5OiQQQ"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$code[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]4[/COLOR][COLOR= #007700]] =[/COLOR][COLOR= #DD0000]"MZRw9NiVUuM"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$code[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]5[/COLOR][COLOR= #007700]] =[/COLOR][COLOR= #DD0000]"5_4CDt4To9A"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$code[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #DD0000]6[/COLOR][COLOR= #007700]] =[/COLOR][COLOR= #DD0000]"MYGjxZh0W7U"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #FF8000]// Alles tellen[/COLOR]
[COLOR= #0000BB]$codes[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/count"]count[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$code[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$naams[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/count"]count[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$naam[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$random[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$codes[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$videototaal[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$code[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]//Het tellen van het totaal van alle videos. [/COLOR]
?>
<html>
<head>
<title>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$random[/COLOR][COLOR= #007700]];[/COLOR] ?></title>
<meta http-equiv="refresh" content="360"> <!-- De pagina refresht automatish na 6 minuten. -->
<style type="text/css">
//* CSS van de info blok *//
.info{
border:1px solid #444444;
text-align:center;
width:50%;
margin-right:auto;
margin-left:auto;
background-image:url(http://icons.iconarchive.com/icons/deleket/plastic-mini/32/Button-Reload-icon.png);
background-repeat:no-repeat;
background-position:right top;
}
</style>
</head>
<body style=" font-family:Arial;">
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]//Checken of het aantal codes klopt bij het aantal namen[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$codes[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #0000BB]$naams[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De namen bij de codes klopppen niet.[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div class="info" onclick="javascript:location.reload(true)">Nu speelt: <strong>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$naam[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$random[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</strong><br/>
[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$videototaal[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000] videos - Copyright Sander Corens 2012
</div><br/>
<center><embed src="http://www.youtube.com/v/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$code[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$random[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]&autoplay=1" type="application/x-shockwave-flash" wmode="transparent" width="1200" height="720"></embed></center>
<br/>[/COLOR][COLOR= #007700];
}[/COLOR]
?>
</body>
</html> Door de examens kan ik niet verder PHP leren, maar als ik er binnenkort verder aan kan doen. Maak ik het uitgebreider met een admin zodat je niets meer in het script zelf moet aanpassen, met de database dus. Dat zal de v2 worden.
Demo: http://sander.s3.one2xs.com/PHP/musicV1
Tips of verbeteringen zijn altijd welkom.
Reacties natuurlijk ook

Sander
