Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $no=00;
- $nf="../visit.txt";
- $fp=fopen($nf, "r+");
- $jumlah=fgets($fp,filesize($nf));//belum tentu 2!!
- fclose($fp);
- echo "<p>jumlah: $jumlah";
- $fp=fopen($nf, "w");
- $jumlah=intval($jumlah) + 1;
- /*jumlah itu masih string..
- ada bagusnya km bikin jgn string*/
- fputs($fp,$jumlah);
- echo "<p>jumlah $jumlah";
- if ($jumlah<10){
- $jumlah = "000$jumlah";
- //kurang 0
- }
- elseif ($jumlah>=10 and $jumlah<100){
- $jumlah = "00$jumlah";
- }
- elseif ($jumlah<1000){
- $jumlah = "0$jumlah";
- }
- //$nomor_pendaftaran = "<input name='nomor_pendaftaran' type='text' value='$no$jumlah' disabled='disabled'>";
- $nomor_pendaftaran = "$no$jumlah";//berapa jumlah $no ???
- echo "<p>$nomor_pendaftaran ";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement