Featured Post Today
print this page
Latest Post

C++ | For Loop Basics | Lecture 9

Here you will learn how to create for loop in C plus plus. Some times you have to run for loop till condition satisfied.

 /*  
  Name: For Loop in C++  
  Copyright: SameeArticles.blogspot.com  
  Author: Samee Ullah Feroz  
  Date: 19/03/14 13:32  
  Description: Here you will learn about C++ for Loop system  
 */  
 #include <iostream>  
 #include <cmath> //it is for all math functions library  
 int main() //it is actually a function here  
   {  
    using namespace std;  
    int x;  
    for (x=0; x <=10; x++)  
      cout << x << endl;  
    system("pause");  
    return 0;  
   }   
0 comments

PHP | Detect User Browser Language

How to detect user browser language and how to use it in URL.
If you add this script above your file code.
Then url will be :
  • www.domain.com/index.php?lang=en
  • www.domain.com/index.php?lang=ar
  • www.domain.com/index.php?lang=es
  • www.domain.com/index.php?lang=fr
  • www.domain.com/index.php?lang=hu
  • www.domain.com/index.php?lang=ra
 Region wise. and you can use this to multilingual website.

 <?php  
 //Redirect by language  
 $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);  
 if(!isset($_GET['lang']))  
 {  
      //Retrieve location, set time  
      if(!isset($lang))  
      {  
           header("location: ".$_SERVER['PHP_SELF']);  
           exit;  
      }  
      else  
      {  
           header("location: ".$_SERVER['PHP_SELF']."?lang=".$lang);  
           exit;  
      }  
 }  
 ?>  

0 comments

Convert XML to PHP Array | Multilingual + Country wise SEO URL Solution

Multilingual + Country wise SEO URL Solution:

Example
https://www.samijeweller.com.com/index.php?loc=pk&lang=en
Here I did deep research that how can I use PHP for Multilingual websites?
But we need to keep in mind some topics like
  1. User IP Address Function
  2. User Language Function
  3. IP to XML
  4. XML to PHP Array Conversion
  5. URL Concept
  6. Language And Area codes concept
If you know these things then, you can use this function easily.

 <?php  
 //Redirect by language  
 $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);  
 $context = stream_context_create(array('http' => array('header' => 'Accept: application/xml')));  
 //redirect by IP  
 $_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];  
 $ip = $_SESSION['ip'];  
 $data = file_get_contents("http://api.hostip.info/get_html.php?ip=".$ip."&position=true");  
 $arrayofdata = explode("\n", $data);  
 $country = explode(":", $arrayofdata[0]);  
 $count = explode(" ", $country[1]);  
 if(!isset($_GET['lang']) AND !isset($_GET['loc']))  
 {  
      //Retrieve location, set time  
      if(empty($count))  
      {  
           header("location: index.php?loc=us-en&lang=".$lang);  
           exit;  
      }  
      else  
      {  
           header("location: index.php?loc=".strtolower(trim($count[2],"()"))."&lang=".$lang);  
           exit;  
      }  
 }  
 ?>  

0 comments

CSS | Fix Background Image

How to fix background image with CSS?

<style>
html
    {
        height:100%;
        width:100%;
        background:url(http://www.southsoft.co.za/images/mysql.jpg) center center no-repeat;
        background-position:center;
 You can also give local file path
    }
</style>
0 comments

PHP | Website Validation Function


php validation function

PHP | Website Validation Function

Could you clarify what type of website validation function you need in PHP? Are you looking for:

URL validation (checking if a URL is valid)
Domain validation (checking if a domain exists)
Form input validation (ensuring users enter a valid website in a form)
Server-side HTTP status check (checking if a website is online or returning a specific response)

Let me know your specific requirement, and I'll provide you with a proper PHP validation function!

function validate_web($input_web)
   {  
   $input_web = preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $input_web);
   $input_web = trim($input_web);  
            $input_web = htmlspecialchars($input_web);  
            $input_web = stripcslashes($input_web);
   return $input_web;
   }

0 comments

PHP | Email Validation Function

PHP Email Validation Function
function validate_email($input_email)
   {  
   $input_email = preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $input_email);
   $input_email = trim($input_email);  
            $input_email = htmlspecialchars($input_email);  
            $input_email = stripcslashes($input_email);
   return $input_email;
   }
0 comments

PHP | Name Validation Function

PHP Name Validation Function
function validate_name($input_name)
   {  
   $input_name = preg_match("/^[a-zA-Z ]*$/", $input_name);
   $input_name = trim($input_name);  
            $input_name = htmlspecialchars($input_name);  
            $input_name = stripcslashes($input_name);
   return $input_name;
   }
0 comments

PHP | Number Validation Function

PHP number validation function
function validate_number($input_number)
   {  
   $input_number = preg_match ("/^[0-9]*$/", $input_number);
   $input_number = trim($input_number);  
            $input_number = htmlspecialchars($input_number);  
            $input_number = stripcslashes($input_number);
   return $input_number;
   }
0 comments

PHP | Form Validation Function

PHP Form Validation Function for your site.
function validate_email($input_email)
   {  
   $input_email = preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $input_email);
   $input_email = trim($input_email);  
            $input_email = htmlspecialchars($input_email);  
            $input_email = stripcslashes($input_email);
   return $input_email;
   }
0 comments

C++ | Usages of Arrays elements| Lecture 8

Lecture 8:
Here you will learn that how to use arrays elements and how to pray with them?
Arrays elements are located or called by their place number or name. Arrays elements place starts from [0]... to so on.

 /*  
  Name: More on arrays  
  Copyright: sameearticles.blogspot.com  
  Author: Samee Ullah Feroz  
  Date: 05/03/14 15:17  
  Description: Here you will learn about usage of arrays element.   
 */  
 #include <iostream>  
 #include <cmath> //it is for all math functions library  
 int main() //it is actually a function here  
   {  
    using namespace std;  
    int ages[3] = {21, 19, 9}; //2nd method  
    cout << ages[1] + ages [0] << endl;  
    system("pause");  
    return 0;  
   }   

0 comments
 
Copyright © 2011-2026. Samee Articles - All Rights Reserved
Proudly powered by Blogger