aRo` automating your e-commerce

This blog has been neglected due to the success of Solidshops.com
29Jun/07

submit an ajaxForm from a hyperlink

Below you can find the democode for submitting a form from an hyperlink.

JavaScript:
  1. $(document).ready(function() {
  2. $('#addusertorunningform').ajaxForm({
  3. target: '#add_user_to_running_status',
  4. success: function() {
  5. document.getElementById('add_user_to_running_status').style.display = 'block';}
  6. });
  7.  
  8. $('a#submit_form').click(function() {
  9. $("#addusertorunningform").submit();
  10. });
  11.  
  12. });

HTML:
  1. <div id="add_user_to_running_status">; <form id="addusertorunningform" action="http://domain.com/ajax/comment.php" name="addusertorunningform" method="post"> <input name="maptolink1" id="maptolink1" value="&lt;? print $mapid; ?&gt;" type="hidden" /> <a href="#" id="submit_form">test</a>
  2. </form></div>

When you click on the link to # with the id "submit_form" it will use the jQuery framework to the submit form code ($("#addusertorunningform").submit();).

Popularity: 2% [?]

Filed under: ajax, jQuery No Comments
26Jun/07

writing a simple ajax call only needs 3 js functions

For getting content from another page you only need 3 functions

  • 1 custom function you can call in your code
  • 1 for fetching the results from an external php file
  • 1 for placing the fetched values in you original code

javascript

JavaScript:
  1. function showDetails(){
  2.     xmlHttp=GetXmlHttpObject()
  3.     if (xmlHttp==null){
  4.         alert ("Browser does not support HTTP Request")
  5.         return
  6.     }
  7.     var url="javascript/result/auto.php"
  8.     url=url+"?q=te"
  9.     xmlHttp.onreadystatechange=stateChanged
  10.     xmlHttp.open("GET",url,true)
  11.     xmlHttp.send(null)
  12. }

JavaScript:
  1. function GetXmlHttpObject(handler){
  2.     var objXMLHttp=null
  3.     if (window.XMLHttpRequest){
  4.         objXMLHttp=new XMLHttpRequest()
  5.     }else if (window.ActiveXObject){
  6.         objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
  7.         }
  8.     return objXMLHttp
  9.     }

JavaScript:
  1. functionstateChanged(){
  2.     if (xmlHttp.readyState==4){
  3.         if(xmlHttp.status == 200){
  4.             document.getElementById("booja").innerHTML=xmlHttp.responseText
  5.         }else{
  6.             alert("Problem with request!");
  7.         }
  8.     }
  9. }

html

HTML:
  1. Click<span style="cursor: pointer; color: green" onclick="showDetails()">this</span> to fill the div

The output of this php page "javascript/result/auto.php" will be shown in the "booja" div.

Popularity: 3% [?]

Filed under: ajax No Comments
9Jun/07

An easy way to find directory’s

Directory's are an easy way to increase your backlinks.

Search google for

inurl:submit.php free title url Description mail name

and you can submit your site all day long.

enjoy

Popularity: 3% [?]

Filed under: SEO No Comments
6Jun/07

Creating a MySQL db and website backup at once

This little scripts create's a backup of your database and website files at once and puts them on a folder on your webhosting.

PHP:
  1. function backupDB($dbhost,$dbuser,$dbpass,$dbname, $sitename){
  2. global $savepath , $date ;
  3.  
  4. $date = date("dmY");
  5. if (!file_exists("$savepath/$date")) {
  6. mkdir("$savepath/$date", 0777);
  7. }
  8. $filename = "$savepath/$date/SQL$sitename-$date.sql";
  9.  
  10. passthru("mysqldump --opt -h$dbhost -u$dbuser -p$dbpass $dbname&gt;$filename");
  11.  
  12. }

PHP:
  1. function backupWWW($wwwdirectory,$wwwname){
  2. global $savepath , $date ;
  3. if (!file_exists("$savepath/$date")) {
  4. mkdir("$savepath/$date", 0777);
  5. }
  6. $filename = "$savepath/$date/WWW$wwwname.tar.gz";
  7.  
  8. $zipline = "tar -czf $filename $wwwdirectory";
  9. shell_exec($zipline);
  10.  
  11. }

PHP:
  1. $settings = array( array( dbhost =&gt; 'myserver1.domain.net',
  2. dbuser =&gt; 'username',
  3. dbpass =&gt; 'pasword',
  4. dbname =&gt; 'dbname',
  5. wwwname =&gt; 'webfoldername',
  6. wwwdirectory =&gt; '/mounted-storage/pathtowebfolder/*'
  7. ),
  8. array( dbhost =&gt; 'myserver.domain.net',
  9. dbuser =&gt; 'username',
  10. dbpass =&gt; 'pasword',
  11. dbname =&gt; 'dbname',
  12. wwwname =&gt; 'webfoldername',
  13. wwwdirectory =&gt; '/mounted-storage/pathtowebfolder/*'
  14. )
  15.  
  16. );

PHP:
  1. for ( $row = 0; $row &lt;count($settings); $row++ )
  2. {
  3. backupDB($settings[$row]['dbhost'], $settings[$row]['dbuser'], $settings[$row]['dbpass'], $settings[$row]['dbname'], $settings[$row]['wwwname']);
  4. backupWWW($settings[$row]['wwwdirectory']$settings[$row]['wwwname']);
  5. echo $settings[$row]['wwwname'] ."backup up
  6. ";
  7. }

Popularity: 2% [?]

Filed under: MySQL, php No Comments
6Jun/07

Monitoring MySQL and some offline query tools

For people like me comming from a Microsoft world(MS SQL/Access) these tools are great. I only used phpmyadmin before but it needed something to quicky join tables and alter data in the grid.

After some investigation i found 2 decent free tools:

Popularity: 2% [?]

Filed under: MySQL No Comments