mirror of
https://github.com/FranP-code/Allnews.com.git
synced 2025-10-13 00:32:45 +00:00
Avanzado sobre el backend
This commit is contained in:
@@ -19,10 +19,9 @@
|
||||
<?php
|
||||
|
||||
require 'mySQLconnect.php';
|
||||
require 'news_logic.php';
|
||||
|
||||
$selection = $mySQLconnect -> query('select * from noticias;')-> fetchAll();
|
||||
|
||||
print_r($selection);
|
||||
check_news();
|
||||
|
||||
?>
|
||||
|
||||
|
||||
3
news/00_news_done.txt
Normal file
3
news/00_news_done.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
./news/aaa.html
|
||||
./news/bbb.html
|
||||
./news/ccc.html
|
||||
0
news/aaa.html
Normal file
0
news/aaa.html
Normal file
36
news_logic.php
Normal file
36
news_logic.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
function check_news() {
|
||||
$news = glob('./news/*');
|
||||
|
||||
print_r($news);
|
||||
echo '<br>';
|
||||
|
||||
foreach ($news as $new) {
|
||||
if ($new !== './news/00_news_done.txt'){
|
||||
|
||||
echo '<br>';
|
||||
|
||||
echo 'NEW: ' . $new;
|
||||
|
||||
echo '<br>';
|
||||
|
||||
$news_done = file_get_contents('./news/00_news_done.txt');
|
||||
|
||||
echo $news_done;
|
||||
echo '<br>';
|
||||
|
||||
if (!strstr($news_done, $new)) {
|
||||
$author = know_autor($new); //! HACER FUNCION
|
||||
$create_entry($new, $author); //! HACER FUNCION
|
||||
file_put_contents($news_done, $new . '/n', FILE_APPEND);
|
||||
}
|
||||
|
||||
/*if ($new is in $done) {
|
||||
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user