Skip to content

Instantly share code, notes, and snippets.

@hdogan hdogan/cekilis.php
Last active Dec 22, 2015

Embed
What would you like to do?
Linux Yaz Kampı 2013 - PHP ile Yazılım Geliştirme Kursu Çekiliş Kodu
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="utf-8">
<title>Çekiliş</title>
<style>
body {
font-family: Tahoma, sans-serif;
font-size: 40px;
}
</style>
</head>
<body>
<?php
/*
* Katilimci listesini dizi olarak giriyoruz (sadece anketi dolduranlar)
*/
$katilimcilar = array(
'Hidayet Doğan',
'Engin Aygen',
'Engür Pişirici',
'Ramazan Terzi',
'Adil İlhan'
);
/*
* random.org API'sini kullanarak 0'dan baslayip $katilimcilar eleman sayisindan 1 eksik
* aralikta rasgele sayi getiriyoruz.
*/
$balik = file_get_contents('http://www.random.org/integers/?num=1&min=0&max=' . (count($katilimcilar) - 1) . '&col=1&base=10&format=plain&rnd=new');
echo '<p>Kazanan: <strong>' . $katilimcilar[(int) $balik] . '</strong></p>';
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.