Internet Methodologies Journal And News

Let's explore internet with imran

Check or Uncheck all in a group of checkbox in JavaScript

JavaScript code to be kept before head tag.

<SCRIPT LANGUAGE="JavaScript">
function CheckAll(chk)
{
for (i = 0; i < chk.length; i++)
chk[i].checked = true ;
}

function UnCheckAll(chk)
{
for (i = 0; i < chk.length; i++)
chk[i].checked = false ;
}
</script>

HTML Code:

<form name="myform" action="checkboxes.asp" method="post">
<b>Scripts for Web design and programming</b><br>
<input type="checkbox" name="check_list" value="1">ASP<br>
<input type="checkbox" name="check_list" value="2">PHP<br>
<input type="checkbox" name="check_list" value="3">JavaScript<br>
<input type="checkbox" name="check_list" value="4">HTML<br>
<input type="checkbox" name="check_list" value="5">MySQL<br>

<input type="button" name="Check_All" value="Check All"
onClick="CheckAll(document.myform.check_list)">
<input type="button" name="Un_CheckAll" value="Uncheck All"
onClick="UnCheckAll(document.myform.check_list)">
  • Share/Bookmark


What is meant by MVC ? cakePHP interview Question

MODEL VIEW CONTROLLER, it is a software architecture, used to isolates business logic from presentation logic. cakephp is based on mvc pattern.

What are 3 important parts of MVC?

1. The Model represents the application data
2. The View renders a presentation of model data
3. The Controller handles and routes requests made by the client

  • Share/Bookmark


Get last visited Page or URL in PHP

If you will go to 1 page to another page on second page it will display that you have come from Page 1.

// index.php
<a href="index2.php">Go to index2</a>

// index2.php
echo $_SERVER['HTTP_REFERER'];  // Display index.php
  • Share/Bookmark


Get Statistics of your website Using PHP

HTTP_ACCEPT
A list of MIME types the client will accept.

HTTP_ACCEPT_LANGUAGE
What type of languages the browser expects.
These are human language, such as en-us, to represent, English, United States.

HTTP_CONNECTION
The type of connection established between the client and the Web server.

HTTP_HOST
The hostname of the client computer.

HTTP_USER_AGENT
The browser type and version, and operating system information of the client.

HTTP_REFERER
The full URL of the Web page containing the hyperlink used to reach the currently executing ASP page.

HTTP_COOKIE
The cookies sent from the browser.

  • Share/Bookmark


How to upload files using HTML and PHP ?

HTML Code:

<form enctype="application/x-www-form-urlencoded" action="script.php" method="post">
  <input type="file" name="myfile" />
  <input type="submit" name="submit" value="Upload" />
</form>

PHP Code :

<?php/* File name is null */
   if($_FILES[’file’][’name’]==’’){
     /* the path to the directory for upload*/
    $target_path =’null’;die();
   }
   else{
      $target_path = "FileDirectory/";
      /* wrong file type - not a doc type file*/
      if (substr($_FILES[’myfile’][’name’],strlen($_FILES[’myfile’][’name’])-4,4)!=’.doc’){
             echo "Failed upload!";}
             /* the path where file will be put */
             $target_path = 'path_here' ;
             if (!move_uploaded_file($_FILES[’myfile’][’tmp_name’], $target_path)){
                 /* error during upload */
                echo "Error!";die ();
             }
        }
?>
  • Share/Bookmark


cULR Library PHP : Check website status


function checkDomainLiveStatus($url)

{

$agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";$ch=curl_init();

curl_setopt ($ch, CURLOPT_URL,$url );

curl_setopt($ch, CURLOPT_USERAGENT, $agent);

curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt ($ch,CURLOPT_VERBOSE,false);

curl_setopt($ch, CURLOPT_TIMEOUT, 5);

$page=curl_exec($ch);

//echo curl_error($ch);

$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);

if($httpcode>=200 && $httpcode<300) return true;

else return false;

}

if(checkDomainLiveStatus("http://www.yourdomain.com")) {

           echo "Website OK"."n";

} else { /* if website is down*/

          echo "Website DOWN";
}
  • Share/Bookmark


The First Of Technology

We cannot trace the future of Technology. But we can surely trace it’s present and it’s past. This time we traced the history of all the equipments which Software Engineers utilize everyday. From mouse to keyboards, from television to cell-phones, we have it all.

The First Mouse: Would you believe it, if we say that the mouse which you use everyday, looked like the above image during its initial days. The way it has transformed from the above image to a wireless mouse with bluetooth in it, lets see if we will have a mouse on our desk or not.

Source: www.codeweek.pk

  • Share/Bookmark


Get Full URL of user / visiter system in PHP?

<?php

 echo getAddress();

  function getAddress(){
    ### check HTTPS
    $protocol = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
    ### Get Full URL
    return $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
 }
?>
  • Share/Bookmark


Why Internet Marketing is Essential for Businesses Boost?

Internet Marketing, is now not new for this era, where every student, shopkeeper, officer, politician and businessman is bound for computer and well connected with all over the world with in no time. In this sphere, arisen demand to be introduced, published, and advertised to all kind of companies, NGO and Govt’s departments.

Internet becomes a global platform to meet, get and deliver the products who are interested. Internet Marketing compels time, money and expertise to be successful. Internet Marketing is broadly classified into Search Engine Marketing (Pay per click advertising, Search Engine Optimization), Local Listings, Email Marketing, Affiliate Marketing, Social Media Marketing, Article Marketing, Online Classifieds, Online Lead Generation and general Online Media Marketing (Display Advertising). Each of these differs in form, process, price, targeting, reach and value. While you are working with various types of businesses that sell diverse products and provide services, you will find internet marketing is the only consistent way of marketing than other types of marketing.

Internet Marketing Strategy

Businesses demonstrating personal services tend to have a local target market. Customers seeking such services tend to seek out references from friends & family. For certain higher priced services, such as tax consulting or accounting, customers are usually perform additional efforts such as contact to experienced professional in order to get their expertise.

Source: www.codeweek.pk

  • Share/Bookmark


How to validate Email Address By a Regular Expression in PHP?

<?php

    ### Write your email address ###
    $email = 'example@imjan.com';

    if(validateEmail($email) == false){
        echo 'Email Address is Invalid';
    } else {
        echo 'Email Address is Valid';
    }

function validateEmail($email){
	$pattern = "/^\S+@[\w\d.-]{2,}\.[\w]{2,6}\z/iU";
	return (bool)preg_match($pattern, $email, $matches);
}

?>
  • Share/Bookmark