Refresh a website every one second
<html>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script>
var auto_refresh = setInterval(
function()
{
$('#loaddiv').load('call.php');
}, 1000);
</script>
<body>
<div id="loaddiv">
</div>
</body>
</html>
viernes, 28 de agosto de 2015
sábado, 22 de agosto de 2015
Imprimiendo foto de perfil de FB
<?php
echo "<img src=//graph.facebook.com/100000533296894/picture?type=large>";
?>
http://stackoverflow.com/questions/2821061/facebook-api-how-do-i-get-a-facebook-users-profile-image-through-the-facebook
echo "<img src=//graph.facebook.com/100000533296894/picture?type=large>";
?>
http://stackoverflow.com/questions/2821061/facebook-api-how-do-i-get-a-facebook-users-profile-image-through-the-facebook
To show:
50x50 pixels
200 pixels width
To save (using PHP)
NOTE: Don't use this. See @Foreever's comment below.
Where $fid is your user id (or nickname) on Facebook..
NOTE: In case of images marked as "18+" you will need a valid access_token from a 18+ user:
|
Funcion para generar alertas de colores
<?php
function alert($var) {
if ($var>4){
echo "<font color=red>$var</font>";
}
else {
echo "<font color=blue>$var</font>";
}
}
alert(4); //print blue 4
function alert($var) {
if ($var>4){
echo "<font color=red>$var</font>";
}
else {
echo "<font color=blue>$var</font>";
}
}
alert(4); //print blue 4
preg_match()
<?php
acepta solo letras y espacio y el numero 1
$string="ambiorix1";
$name = $string;
if (!preg_match("/^[a-zA-Z 1]*$/",$name)) {
echo "Only letters and white space allowed";
}
else {
echo "OK";
}
acepta solo letras y espacio y el numero 1
$string="ambiorix1";
$name = $string;
if (!preg_match("/^[a-zA-Z 1]*$/",$name)) {
echo "Only letters and white space allowed";
}
else {
echo "OK";
}
viernes, 21 de agosto de 2015
for each Statement and Multi dimensionals arrays
<?php
$food=array('healthy'=>array('salad','fruit','meat'),'unhealthy'=>array('cocacola','icecream','mcdonald'));
//$a es un arreglo y ahora b tambien es un arreglo
foreach( $food as $a=>$b) {
echo $a."<br>";
//b es otro arreglo q nace de a
foreach($b as $c)
echo $c."<br>";
}
?>
healthy
salad
fruit
meat
unhealthy
cocacola
icecream
mcdonald
$food=array('healthy'=>array('salad','fruit','meat'),'unhealthy'=>array('cocacola','icecream','mcdonald'));
//$a es un arreglo y ahora b tambien es un arreglo
foreach( $food as $a=>$b) {
echo $a."<br>";
//b es otro arreglo q nace de a
foreach($b as $c)
echo $c."<br>";
}
?>
healthy
salad
fruit
meat
unhealthy
cocacola
icecream
mcdonald
jueves, 20 de agosto de 2015
Facebook Singup PHP
http://webtutsdepot.com/2009/12/19/facebook-api-tutorial-with-php/
http://www.krizna.com/general/login-with-facebook-using-php/
http://www.krizna.com/general/login-with-facebook-using-php/
domingo, 9 de agosto de 2015
Guardando salida de un query en HTML
mysql -H -e " select * from asterisk.cdr limit 0,1" -p1234 > /var/www/cdr.html
Luego podemos acceder desde la web
http://75.11.118.23/cdr.html
id_call | calldate | clid | src | dst | dcontext | channel | dstchannel | lastapp | lastdata | duration | billsec | disposition | amaflags | accountcode | uniqueid | userfield | unixtime |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
138594 | 2015-04-11 02:10:52 | "919859582174" <919859582174> | 919859582174 | s | contest | SIP/con1-0000122a | Playback | /var/lib/asterisk/sounds/contest/main | 1 | 1 | ANSWERED | 3 | 1428732652.13950 | 0 |
viernes, 7 de agosto de 2015
Algunas funciones de tiempo
Selecionando la hora, minuto y año de una fecha que esta en unix time
SELECT HOUR( FROM_UNIXTIME( cp_time ) ) , MINUTE( FROM_UNIXTIME( cp_time ) ) , YEAR( FROM_UNIXTIME( cp_time ) )
FROM `campaing`
LIMIT 0 , 30
FROM `campaing`
LIMIT 0 , 30
SELECT *
FROM `campaing`
WHERE HOUR( FROM_UNIXTIME( cp_time ) ) =16 and MINUTE( FROM_UNIXTIME( cp_time ) )>=01 and YEAR( FROM_UNIXTIME( cp_time ) )>=2015
FROM `campaing`
WHERE HOUR( FROM_UNIXTIME( cp_time ) ) =16 and MINUTE( FROM_UNIXTIME( cp_time ) )>=01 and YEAR( FROM_UNIXTIME( cp_time ) )>=2015
SELECT FROM_UNIXTIME( cp_time )
FROM `campaing`
WHERE 1
LIMIT 0 , 30
FROM `campaing`
WHERE 1
LIMIT 0 , 30
2015-07-21 00:30:00
2015-08-02 16:02:00
2015-08-02 16:02:00
MYSQL event
In this tutorial, you will learn about MySQL event scheduler and how to create MySQL events to automate database tasks.
A MySQL event is a task that runs based on a predefined schedule therefore sometimes it is referred to as a scheduled event. MySQL event is also known as “temporal trigger” because it is triggered by time, not by table update like a trigger. A MySQL event is similar to a cron job in UNIX or a task scheduler in Windows.
You can use MySQL events in many cases such as optimizing database tables, cleaning up logs, archiving data, or generate complex reports during off-peak time.
Suscribirse a:
Entradas (Atom)