rerzaz
June 14th, 2014, 16:04
من یک کد PHP نوشته ام که با کلیک بر روی لینک داده شده تهداد کلیک هارو ذخیره می کنه توی یک فایل .txt ذخیره میکنه من می کی خوام بجای اینکه تو فایل .txt ذخیره کنه توی یک متغیر ذخیره بشه و خروجی بده
<?phpif(!file_exists('medias/counter.txt')){file_put_contents('medias/counter.txt', '0');}elseif($_GET['like'] == 1){file_put_contents('medias/counter.txt', ((int) file_get_contents('medias/counter.txt')) + 1);header("Location: like.php");die;}?><head></head>
<body><b><?php echo file_get_contents('medias/counter.txt'); ?></b> like this.</p></body><?phpif(!file_exists('medias/counter.txt')){file_put_contents('medias/counter.txt', '0');}?><head><!-- This script loads when the page loads and checks to see if the user has javascript enabled or not --><script>window.setTimeout("jsload()", 100);</script></head>
<body><!-- If javascript is enabled it will continue with the javascript vs PHP option --><script>function jsload(){document.getElementById('nojs').style.dis play='';}</script><label><!-- This is the script that will parse out if the user does not have javascript enabled --><noscript><p><a href="?like=1"><img height="32px" alt="Like this page" width="32px" src="images/like.png"></a>| <b><?php echo file_get_contents('medias/counter.txt'); ?></b> like this.</p></noscript><div id="nojs" style="display:none"><a href="javascript:like()"><img src="http://istatik.ir/test/wp-content/uploads/2014/06/1402759200_like.png" alt="Like this page" width="32px" height="32px" border="0"></a><input name="likethis" type="text" id="likethis" value="<?php echo file_get_contents('medias/counter.txt'); ?>" style="border:none; cursor:text;" readonly="true" size="8"><!-- This script sends a command to the iframe that is hidden to public view as well as upping the value of the text field which is hidden to make it look like actual text :) --><script>function like(){document.getElementById('server-like').src="like.php?like=1";document.getElementById('likethis').value++a=a+1; }</script>
</label></body><iframe src="like.php" id="server-like" style="display:none"></iframe>
<?phpif(!file_exists('medias/counter.txt')){file_put_contents('medias/counter.txt', '0');}elseif($_GET['like'] == 1){file_put_contents('medias/counter.txt', ((int) file_get_contents('medias/counter.txt')) + 1);header("Location: like.php");die;}?><head></head>
<body><b><?php echo file_get_contents('medias/counter.txt'); ?></b> like this.</p></body><?phpif(!file_exists('medias/counter.txt')){file_put_contents('medias/counter.txt', '0');}?><head><!-- This script loads when the page loads and checks to see if the user has javascript enabled or not --><script>window.setTimeout("jsload()", 100);</script></head>
<body><!-- If javascript is enabled it will continue with the javascript vs PHP option --><script>function jsload(){document.getElementById('nojs').style.dis play='';}</script><label><!-- This is the script that will parse out if the user does not have javascript enabled --><noscript><p><a href="?like=1"><img height="32px" alt="Like this page" width="32px" src="images/like.png"></a>| <b><?php echo file_get_contents('medias/counter.txt'); ?></b> like this.</p></noscript><div id="nojs" style="display:none"><a href="javascript:like()"><img src="http://istatik.ir/test/wp-content/uploads/2014/06/1402759200_like.png" alt="Like this page" width="32px" height="32px" border="0"></a><input name="likethis" type="text" id="likethis" value="<?php echo file_get_contents('medias/counter.txt'); ?>" style="border:none; cursor:text;" readonly="true" size="8"><!-- This script sends a command to the iframe that is hidden to public view as well as upping the value of the text field which is hidden to make it look like actual text :) --><script>function like(){document.getElementById('server-like').src="like.php?like=1";document.getElementById('likethis').value++a=a+1; }</script>
</label></body><iframe src="like.php" id="server-like" style="display:none"></iframe>