Imprimare
( 0 Votes ) 
Categorie parinte: ROOT Categorie: Noutati Scris de Zeus  

 - Codul de mai jos este pentru index.php. Form simplu cu javascript function, insertRecord(), in ajax_framework.js 

<!-- Include AJAX Framework -->
<script src="/ajax/ajax_framework.js" language="javascript"></script>

<!-- Show Message for AJAX response --><br /><div id="insert_response"></div>
<br /><!-- Form: the action="javascript:insert()"calls the javascript function "insert" into ajax_framework.js -->
<form action="javascript:insert()" method="post">
><input name="site_url" type="text" id="site_url" value=""/>
<input name="site_name" type="text" id="site_name" value=""/>
<input type="submit" name="Submit" value="Insert"/>
</form>
</pre>
<p> - Activare XMLHTTPRequest In <strong>ajax_framework.js</strong></p>
<pre class="brush: js;">
 /* ---------------------------- */
/* XMLHTTPRequest Enable */
/* ---------------------------- */
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}
var http = createObject();</pre>
<p>- <strong>javascript.js</strong></p>
<pre class="brush: js;"> /* -------------------------- */
/* INSERT */
/* -------------------------- */
/* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */
var nocache = 0;
function insert() {
 // Optional: Show a waiting message in the layer with ID login_response
document.getElementById('insert_response').innerHTML = "Just a second..." // Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding. var site_url= encodeURI(document.getElementById('site_url').value); var site_name = encodeURI(document.getElementById('site_name').value); // Set te random number to add to URL request nocache = Math.random(); // Pass the login variables like URL variable http.open('get', 'insert.php?site_url='+site_url+'&site_name=' +site_name+'&nocache = '+nocache); http.onreadystatechange = insertReply; http.send(null); } function insertReply() { if(http.readyState == 4){ var response = http.responseText; // else if login is ok show a message: "Site added+ site URL".<br />document.getElementById('insert_response').innerHTML = 'Site added:'+response; } } </pre> <p> - <strong>insert.php</strong></p> <pre class="brush: js;"> <!-- Include Database connections info. --> <?php include('config.php'); ?> <!-- Verify if user exists for login --> <?php if(isset($_GET['site_url']) && isset($_GET['site_name'])){ $url= $_GET['site_url']; $sitename= $_GET['site_name']; $insertSite_sql = 'INSERT INTO SITE (site_url, site_name) VALUES('. $url. ',' . $sitename. ')'; $insertSite= mysql_query($insertSite_sql) or die(mysql_error()); <!-- If is set URL variables and insert is ok, show the site name --> echo $sitename; } else { echo 'Error! Please fill all fileds!'; } >
Acum puteti testa scriptul pe localhost .
 
Imprimare
( 0 Votes ) 
Categorie parinte: ROOT Categorie: Noutati Scris de Zeus  

Lansat prin August 2011 Ubuntu One  (gen Dropbox pentru cunoscatori ) pentru  Windows , inclus in  Ubuntu 9.10 este acum in varianta Beta. 

Ubuntu one head 

Initial  Ubuntu One  includea  2GB, acum avand deja 5GB.

Pentru cine vrea mai mult:

20GB - 3usd pe lună (30usd pe an)

20GB  (pentru muzica) -  4usd pe lună (40usd pe an).

 

Download Ubuntu One for Windows public beta

 

- Instalearea este facila, nu poti alege orice folder pentru sincronizare, decât cu ce este în C:Users[numeletau]Ubuntu One.

- Interfata aerisita, programul "ocupa"  din memopria ram 25 MB.

 

ubuntu one  


 
Imprimare
( 0 Votes ) 
Categorie parinte: ROOT Categorie: Noutati Scris de Zeus  

Sa consideram urmatoarea adresa drept exemplu :

http://domain.com/showtopic.php?id=10 

1. In primul rand un hacker poate ataca cu relativa usurinta baza de date,  schimband valoarea "10" cu o valoare invalida, aceasta generand la randul ei erori ce pot fi "interpretate".

2. In al doilea rand motoarele de cautare precum Yahoo sau Google nu pot "retine" nimic din aceasta adresa, de exemplu prin "10" nu poate sa inteleaga cuvantul "carte" ce face parte din titlul unui articol. 

Pentru ca adresa  de mai sus sa arate mai "prietenoasa" ne vom foloside de Apache si mod_rewrite. 

 

Primul pas

Activam mod_rewrite in httpd.conf, stergand semnul "#" din linia corespunzatore cuvintelor "LoadModule rewrite_module" si "modules/mod_rewrite.so".

Pasul doi

Adaugam un fisier .htaccess in lfolderul pe care al dorim ca "rewrite" sa isi faca efectul ( efectul se va intinde si asupra subfolderelor), 

Pasul trei

rewrite  Deschidem .htaccess cu un editor si adaugam:

Options +FollowSymLinks
RewriteEngine on 

-  am activat local rescrierea adreselor 

RewriteRule ^index.html$ index.php [L] 

 - rescrierea adreselor se vor face in formatul: www.domain.com/index.html (extensia s-a schimbat din php in html)

 

Sa explicam putin regulile adaugate mai sus

 ^ - caracterul marcheaza inceputul regulei  - spune serverului sa nu se astepte la nimic inaintea acestu caracter.

 $ - specifica sfarsitul.

  L - Spune serverului Apache sa nu mai proceseze RewriteRules daca a fost aplicata cu succes l. 

 

EXEMPLU

index.php?field_name=name&row_id=11&field_value=value  >>> index.html/name-11/value.html

Regula este -

Options +FollowSymLinks
RewriteEngine on  
RewriteRule ^(.*)-(.*)/(.*).html index.php?field_name=$1&row_id=$2& &field_value=$3 [L]

 

 ATENTIE - Anumite firme de hosting nu au activata functia  mod_rewrite  !


 
Imprimare
( 0 Votes ) 
Categorie parinte: ROOT Categorie: Noutati Scris de Zeus  

Firstlook dubleaza spatiul de hosting, si reduce cu 30 % pretul platit pentru pachetul ales . COMANDA ACUM !


Joomla 1.6 Templates designed by Joomla Hosting Reviews