Hallo,
Naar aanleiding van dit topic en hoe die gebruiker ermee omging heb ik het script zelf ook maar gemaakt. Het is voor het whearsysteem!
Voor de mensen die het gratis willen :
Dit stukje code moet in de bron
Ook mag je niet zeggen dat jij het hebt gemaakt en ook niet verkopen.
In de footer moet ook dit :
Dan het script en de SQL :
Er kunnen fouten inzitten, komt omdat ik het whearsysteem niet helemaal ken.
Je moet zelf het script maken die de winnaar kiest.
Verder wens ik je er veel plezier mee.
Als de vermelding er niet bij staat, zal er actief ondernomen worden!
Groetjes, Maarten.
Naar aanleiding van dit topic en hoe die gebruiker ermee omging heb ik het script zelf ook maar gemaakt. Het is voor het whearsysteem!
Voor de mensen die het gratis willen :
Dit stukje code moet in de bron
<!-- Loterij script gemaakt door zeax.nl --> Ook mag je niet zeggen dat jij het hebt gemaakt en ook niet verkopen.
In de footer moet ook dit :
Loterij script gemaakt door zeax.nl Dan het script en de SQL :
[COLOR= #0000BB]<?[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]))
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Log in![/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]koop[/COLOR][COLOR= #007700]]) &&[/COLOR] [URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]loten[/COLOR][COLOR= #007700]]))
{[/COLOR]
[COLOR= #0000BB]$userQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT credits FROM users WHERE id="[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]ERROR[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$userQuery[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$user[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]credits[/COLOR][COLOR= #007700]] <[/COLOR] [COLOR= #0000BB]3[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je hebt niet genoeg credits![/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE users SET credits=credits-3 WHERE id="[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]ERROR[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE loterij SET pot=pot+3, loten=loten+1"[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]ERROR[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO loten (user) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]ERROR[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]U heeft succesvol lotjes gekocht![/COLOR][COLOR= #007700];
}
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[COLOR= #0000BB]$lotenQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM loterij"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$loten[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$lotenQuery[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$x[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]1[/COLOR]/[COLOR= #0000BB]3[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$a[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$x[/COLOR][COLOR= #007700]*[/COLOR][COLOR= #0000BB]2[/COLOR][COLOR= #007700];[/COLOR]
?>
Er zijn al [COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$loten[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]loten[/COLOR][COLOR= #007700]];[/COLOR] ?> verkocht. De winaar verdient dus [COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$loten[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]pot[/COLOR][COLOR= #007700]]*[/COLOR][COLOR= #0000BB]$a[/COLOR][COLOR= #007700];[/COLOR] ?> punten.
<form action="" method="post">
<input type="submit" name="koop" value="Koop een lot!" />
</form>
[COLOR= #0000BB]<?
$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]loten[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]aan[/COLOR][COLOR= #007700];
}
}[/COLOR]
?>
CREATE TABLE IF NOT EXISTS `loterij` (
`pot` int(11) NOT NULL,
`loten` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
<- voeg 1 in met 0, 0 ->
CREATE TABLE IF NOT EXISTS `loten` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1; Er kunnen fouten inzitten, komt omdat ik het whearsysteem niet helemaal ken.
Je moet zelf het script maken die de winnaar kiest.
Verder wens ik je er veel plezier mee.
Als de vermelding er niet bij staat, zal er actief ondernomen worden!
Groetjes, Maarten.
