Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $doc = new DOMDocument();
- $file = "/home/user/public_html/cron1/cron.php";
- if($doc->loadhTMLFile($file)){
- $span = $doc->getElementsByTagName('span')->item(0);
- $count = $span->textContent;
- $count++;
- $doc->getElementsByTagName('span')->item(0)->nodeValue = $count;
- $doc->saveHTMLFile($file);
- echo 'file updated sucessfully';
- }
- else{
- return false;
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equic="Content-Type" content="text/html; charset=UTF-8">
- <meta charset="UTF-8">
- <title>This is just a cron example</title>
- </head>
- <body>
- <h1>This is test <span id="count">0</span></h1>
- </body>
- </html>
- date_default_timezone_set('Europe/Oslo');
- $dbhost = 'host';
- $dbuser = 'user';
- $dbpass = 'password';
- $dbname = 'name';
- //Connect
- $mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
- if (mysqli_connect_errno()) {
- printf("MySQLi connection failed: ", mysqli_connect_error());
- exit();
- }
- // Change character set to utf8
- if (!$mysqli->set_charset('utf8')) {
- printf('Error loading character set utf8: %sn', $mysqli->error);
- }
- $sql = "
- SELECT
- categories.*
- FROM
- categories
- ORDER BY RAND()
- LIMIT 1";
- $res = mysqli_query($mysqli, $sql) or die('-1' . mysqli_error());
- $row = mysqli_fetch_assoc($res);?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement