Bepul sahifa hisoblagichi PHP skripti

Bepul aloqa shakli PHP skript
Bepul PHP mehmon kitobi skripti

bu Bepul sahifa hisoblagichi php skripti foydalanadi fopen(), fread(), fwrite()va fclose() hisoblagichning joriy qiymatini saqlaydigan matn faylini o'qish va yangilash funktsiyalari. Ushbu skriptni ishlatishdan oldin “counter.txt” matn fayli yaratilishi va dastlab nolga o'rnatilishi kerak.

<?php
  // Open the text file
  $file = fopen("counter.txt", "r");
  // Read the current value of the counter
  $count = fread($file, filesize("counter.txt"));
  // Close the file
  fclose($file);
  // Increment the counter
  $count = $count + 1;
  // Open the file for writing
  $file = fopen("counter.txt", "w");
  // Write the new value to the file
  fwrite($file, $count);
  // Close the file
  fclose($file);
?>
<html>
  <head>
    <title>Website counter</title>
<style>
.counter {
  text-align: center;
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #f5f5f5;
  padding: 20px;
  border-radius: 5px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

.counter p {
  font-size: 20px;
  margin-bottom: 5px;
  color: #333;
}

.counter span {
  font-size: 36px;
  font-weight: bold;
  color: #4CAF50;
}

.counter:hover {
  background-color: #e5e5e5;
  cursor: pointer;
}
</style>
  </head>
<body>	
<div class="counter">
  <p>Visitors:</p>
  <span>232323<?php echo $count; ?></span><br />
  <u><a href="https://php.org" title="PHP tutorials">Powered by PHP.org</a></u>
</div>
</body>
</html>
Bepul aloqa shakli PHP skript
Bepul PHP mehmon kitobi skripti

PHP haqida yangiliklardan xabardor bo'ling!

Biz spam yubormaymiz!

en English
X
Top o'ting