Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions add_random.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
random.php
<?php
include("includes/funzioni.php");

$howmany = 10000;

for($i=1;$i<$howmany;$i++){



$SQL = "INSERT INTO `avideo`.`av_videos`
(`ID`, `host`, `host_video_ID`, `title`, `description`, `thumbnail_default`, `thumbnail_medium`, `thumbnail_high`, `user_ID`, `views`, `timestamp_insert`, `timestamp_edit`, `daily_views`, `weekly_views`, `monthly_views`, `votes`, `daily_votes`, `weekly_votes`, `monthly_votes`) VALUES
(NULL, '".generateRandomString(10)."', '".rand(0,99999999999)."', '".generateRandomString(10)."',
'".generateRandomString(20)."', '".generateRandomString(20)."', '".generateRandomString(20)."',
'".generateRandomString(20)."', '".rand(0,9999999)."', '".rand(0,9999999)."', NOW(), NOW(),
".rand(0,9999999).", ".rand(0,9999999).", ".rand(0,9999999).", ".rand(0,9999999).", ".rand(0,9999999).", ".rand(0,9999999).", ".rand(0,9999999).");";
mysql_query($SQL) or die(mysql_error());
print($SQL."\n");

}



?>
22 changes: 22 additions & 0 deletions cron_views_update.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!C:\xampp\php\php.exe -q

<?php
include("includes/funzioni.php");

$db = apri_connessione();

$query_videos_update[0] = "UPDATE ".$_CONFIG["table_suffix"]."videos SET ".$_CONFIG["table_suffix"]."videos.views = (SELECT COUNT(*) FROM ".$_CONFIG["table_suffix"]."views WHERE ".$_CONFIG["table_suffix"]."views.video_ID = ".$_CONFIG["table_suffix"]."videos.ID);";
$query_videos_update[1] = "UPDATE ".$_CONFIG["table_suffix"]."videos SET ".$_CONFIG["table_suffix"]."videos.daily_views = (SELECT COUNT(*) FROM ".$_CONFIG["table_suffix"]."views WHERE ".$_CONFIG["table_suffix"]."views.video_ID = ".$_CONFIG["table_suffix"]."videos.ID AND date = CURDATE());";
$query_videos_update[2] = "UPDATE ".$_CONFIG["table_suffix"]."videos SET ".$_CONFIG["table_suffix"]."videos.weekly_views = (SELECT COUNT(*) FROM ".$_CONFIG["table_suffix"]."views WHERE ".$_CONFIG["table_suffix"]."views.video_ID = ".$_CONFIG["table_suffix"]."videos.ID AND date >= FROM_UNIXTIME(".strtotime("This Monday")."));";
$query_videos_update[3] = "UPDATE ".$_CONFIG["table_suffix"]."videos SET ".$_CONFIG["table_suffix"]."videos.monthly_views = (SELECT COUNT(*) FROM ".$_CONFIG["table_suffix"]."views WHERE ".$_CONFIG["table_suffix"]."views.video_ID = ".$_CONFIG["table_suffix"]."videos.ID AND date >= FROM_UNIXTIME(".strtotime("First day of this month")."));";

for ($i=0; $i<4; $i++) {
if (!$result_videos_update = mysql_query($query_videos_update[$i], $db)) {
echo mysql_error()."<br />";
echo $query_videos_update[$i]."<br />";
mysql_close($db);
die("Problemi l'esecuzione della query.");
} else echo "query_videos_update[".$i."] eseguita correttamente.\n";
}
mysql_close();
?>
20 changes: 20 additions & 0 deletions footer.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--==============================footer=================================-->
<footer>
<div class="container_12">
<div class="wrapper">
<article class="grid_12">
<div class="social">
<a href="#" title="YouTube"><img src="images/soc1.png" width="32" height="64" alt=""></a>
<a href="#" title="RSS"><img src="images/soc2.png" width="32" height="64" alt=""></a>
<a href="#" title="Twitter"><img src="images/soc3.png" width="32" height="64" alt=""></a>
<a href="#" title="Facebook"><img src="images/soc4.png" width="32" height="64" alt=""></a>
</div>
<div class="privacy">
Andrea Cannuni &copy; 2013 All Rights Reserved &nbsp; | &nbsp; <span><a href="webmaster.html">Webmaster</a></span> &nbsp; | &nbsp; <span><a href="privacy_policy.html">Privacy Policy</a></span>
</div>
</article>
</div>
</div>
</footer>
</body>
</html>
35 changes: 35 additions & 0 deletions header.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Home page - Avideo</title>
<!-- inizio META TAG -->
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="author" content="Andrea CANNUNI" />
<meta name="robots" content="index, follow" />
<meta name="revisit-after" content="7 days" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<!-- fine META TAG -->
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" media="screen" href="css/style.css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/superfish.js"></script>
<script type="text/javascript" src="js/jquery.responsivemenu.js"></script>
<script type="text/javascript" src="js/jquery.mobilemenu.js"></script>
<script type="text/javascript" src="http://fast.fonts.com/jsapi/86ac751a-e730-4d0e-a4ec-3e10d0169fa5.js"></script>
<script type="text/javascript" src="js/web_fonts_banner_remover.js"></script>
<script src="js/script.js"></script>
<!--[if lt IE 8]>
<div style=' clear: both; text-align:center; position: relative;'>
<a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode">
<img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." />
</a>
</div>
<![endif]-->
<!--[if lt IE 9]>
<script type="text/javascript" src="js/html5.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="css/ie.css">
<![endif]-->
</head>
26 changes: 22 additions & 4 deletions includes/config.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
<?php


error_reporting(E_ALL);
ini_set('display_errors',1);
ini_set("html_errors", 1);
/* File di configurazione del sito */

/* Inizio configurazione generale */
// Prefisso della tabella nel database MySQL
$_CONFIG['table_suffix']="av_";
/* Fine configurazione generale */

/* Inizio parametri del database */
$db_host = "localhost";
$db_user = "root";
$db_password = "oyju7T3I";
$db_user = "borghesia";
$db_password = "tianming";
$db_name = "avideo";
/* Fine parametri del database */

require("funzioni.php");
require('libs/Smarty.class.php');

$operator = "1";
$current_timestamp = time();

$link = @mysql_connect($db_host,$db_user,$db_password) or die('Unable to establish a DB connection');

mysql_set_charset('utf8');
mysql_select_db($db_name,$link);


?>
31 changes: 15 additions & 16 deletions includes/funzioni.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
<?php
include("includes/config.php");

function apri_connessione()
{
include("includes/config.php");
$db = mysql_connect($db_host, $db_user, $db_password);
if ($db == TRUE) {
mysql_select_db($db_name, $db) or die ("Errore nella selezione del database.");
};


function apri_connessione() {
global $db_host, $db_user, $db_password, $db_name, $db;
$db = new mysqli($db_host, $db_user, $db_password, $db_name);
return $db;
}

function date_time_conversion($timestamp) {
$date_time = date(DATE_RFC822, $timestamp);
return $date_time;
}

$operator = "1";
$current_timestamp = time();

$link = @mysql_connect($db_host,$db_user,$db_password) or die('Unable to establish a DB connection');

mysql_set_charset('utf8');
mysql_select_db($db_name,$link);
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}
return $randomString;
}


?>
15 changes: 15 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
include('libs/Smarty.class.php');

// create object
$smarty = new Smarty;

// assign some content. This would typically come from
// a database or other source, but we'll use static
// values for the purpose of this example.
$smarty->assign('name', 'george smith');
$smarty->assign('address', '45th & Harris');

// display it
$smarty->display('index.tpl');
?>
16 changes: 16 additions & 0 deletions index.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<html>
<head>
<title>Info</title>
</head>
<body>

<pre>
User Information:

Name: {$name|capitalize}
Addr: {$address|escape}
Date: {$smarty.now|date_format:"%b %e, %Y"}
</pre>

</body>
</html>
Loading