ktziavos Δημοσ. 12 Ιουλίου 2005 Δημοσ. 12 Ιουλίου 2005 mipws kaneis mporei na mou pei pws mporw na ftiaksw enan aplo aplo counter gia webside>
Dikemou Δημοσ. 12 Ιουλίου 2005 Δημοσ. 12 Ιουλίου 2005 Αν χρησιμοποιείς php μπορώ να σου πω πως είχα κάνει ένα παλιότερα. Χρησιμοποιείς;
NiCkReD Δημοσ. 15 Ιουλίου 2005 Δημοσ. 15 Ιουλίου 2005 σε php θα χρησιμοποιοησεις 3 αρχεια: counter.inc - ο κωδιακας που χρειαζεσαι count.dat - ενα απλο txt για να μπαινουν να νουμερα index.php - μεσα στην σελιδα θα βαλεις τον κωδικα που θα φορτωνεις το counter.inc counter.inc ><?php // the path of the counter log file $logpath = 'count.dat'; // amount of digits to use in the counter when displayed $pad = 5; // open the log file (if it exists) and read in the current count if (file_exists($logpath)) { $count = file_get_contents($logpath); }else{ // else if it does not exist, the initial count will be 0 $count = 0; } // increment the count by 1 $count++; // open the log file for writing, ensuring that it has been locked for // writing before doing so. // note that if the file does not already exist, an attempt will be made to create it! $file = fopen($logpath, 'w'); // the 'w' indicates writing mode if (flock($file, LOCK_EX)) { // do an exclusive lock fwrite($file, $count); // write out the updated count flock($file, LOCK_UN); // release the lock } fclose($file); // set the zero padding for the count to the value defined previously, then // display the count onscreen. $count = str_pad($count, 5, '0', STR_PAD_LEFT); echo $count; ?> και στο index θα βαλεις αυτο: ><html> <head> <title>Μετρητης</title> <style type="text/css"> p {font-family:"Century Gothic", "Sans Serif"; font-size:12pt; color:black;} </style> </head> <body> <br> <br> <br> <p>εισαι το νουμερο <?php include 'counter.inc'; ?> </p> </body> </html>
Προτεινόμενες αναρτήσεις
Αρχειοθετημένο
Αυτό το θέμα έχει αρχειοθετηθεί και είναι κλειστό για περαιτέρω απαντήσεις.