$p = array("ã","º","þ","î","â","Ã","ª","Þ","ă","ş","ţ","î","â","Ă","Ş","Ţ","Î","Â");
$r = array("a","s","t","i","a","A","S","T","a","s","t","i","a","A","S","T","I","A");
$ds = str_replace($p, $r, $s);
return $ds;
}
Aici voi posta toate partile de tutoriale de care am avut nevoie in "viata de zi cu zi" de webprogrammer (HTML, PHP, MySQL, AJAX, CPanel, etc), nu neaparat ca sa ajute pe altii, ci mai mult ca sa le gasesc ulterior intr-un singur loc.
function curl_get_file_contents($URL)
{
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $URL);
$contents = curl_exec($c) or die("SIZE ERROR<script type='text/javascript'>var t=setTimeout('timeFct()',5000)</script>");
curl_close($c);
if ($contents) return $contents;
else return FALSE;
}
function urlfilesize($url,$thereturn) {
if (substr($url,0,4)=='http') {
$x = array_change_key_case(get_headers($url, 1),CASE_LOWER);
$x = $x['content-length'];
}
else { $x = @filesize($url); }
if (!$thereturn) { return $x ; }
elseif($thereturn == 'mb') { return round($x / (1024*1024),2) ; }
elseif($thereturn == 'kb') { return round($x / (1024),2) ; }
}
$vtemp = $_GET['v'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.youtube.com/watch?v=".$vtemp);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
$info= curl_exec($ch);
$lun = strlen($info);
$pos1 = strpos($info,"&t=",$pos1);
$Stri=substr($info, $pos1+3, 32);
if($Stri!='') echo "Disponibil"; else echo "Indisponibil";
$vtemp = $_GET['v'];
1. intotdeauna sa pun : <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
si <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2. Ca sa fac designu unui site sa folosesc Builderu' de Yahoo
3. Ca sa testez diferite tipur de scris (fonturi) sa folosesc TypeTesteru'
4. Sa folosesc palete de culori, ca se gasesc la Iubitorii de culori, sau chiar la Adobe Kuler. Pot genera palete de culori dintr-o poza (sic) la BigHugeLabs sau la DeGraEve.
5. In CSS exista urmatoarele :
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Titlul gadgetului" />
<Content type="url" href="http://www.pagina.ro/ccare_se_afiseaza.htm" />
</Module>
<?php
mysql_connect('localhost', 'user', 'pass') or die('Not connected : '.mysql_error());
mysql_select_db('db');
?>
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
$mail = new PHPMailer();
$mail->From = $r['from'];
$mail->FromName = $r['fromname'];
$mail->Subject = $r['subject'];
$mail->IsHTML(true);
$mail->Body = $mesaj;
$mail->AddAddress($r['email'], $r['name']);
if(!$mail->Send()) {
echo 'Eroare la trimitere mail ('.$r['email'].')';
} else {
echo 'Mail trimis ('.$r['email'].')';
}
======================================================================================
$mail->AddEmbeddedImage("rocks.png", "my-attach", "rocks.png");
$mail->Body = 'Embedded Image: <img alt="PHPMailer" src="cid:my-attach"> Here is an image!';
======================================================================================
Pentru a sterge articolele duplicat dintr-o tabela MySQL se foloseste DISTINCT astfel :DELETE FROM table1 USING table1, table1 AS vtable WHERE (table1.id > vtable.id) AND (table1.field_name=vtable.field_name)