2012 ~ ScriptsSnippets

Monday, 5 March 2012

Two Flower VLC Media Player

Two Flower VLC Media Player

  •  VLC Releases its newer version of its Popular Media Player,the Two Flower VLC Media Player.
  • With faster decoding on multi-core, GPU, and mobile hardware and the ability to open more formats, notably professional, HD and 10bits codecs, 2.0 is a major upgrade for VLC.
  • Twoflower has a new rendering pipeline for video, with higher quality subtitles, and new video filters to enhance your videos.
  • It supports many new devices and BluRay Discs (experimental)
  • Two Flower Fixes Sevral Hundred Bugs
  • And After all that its free,portable and supported on all Platforms
  • Download Link :http://www.videolan.org/vlc/releases/2.0.0.html
Thank u for reading this  Article hope it was useful !
-Regards
ScriptsSnippets


PHP Session

PHP Session


  • A cookie recides on the users web Browser and may be suited for storing small amount of information and for limited concern on security.
  • When we need to store a considerable amount of information we use session and we have a Security advantage of session being stored on the web server itself which is more secure than a Cookie on the User's Browser.
  • PHP allows us to use Sessions by a Session Variable which is a 'Super Global' , It holds information about a Single User.
  • Sessions create a Unique Id for each Visitor and stores variables based on this UID



SESSION START
  • First we must start up a Session before using it to store User's Information
Session Start Snippet




<?php session_start(); ?>

<html>
<body>

</body>
</html>


Note:The session_start() function should be included before outputting any HTML content


SESSION VARIABLE


  • A Session variable is created by the variable $_SESSION
  • We can assign any name to a Session variable
      Session Variable Snippet

<?php
session_start();
// store session data
$_SESSION['name’]=”sathesh”;
?>

<html>
<body>

<?php
//retrieve session data
echo "The Author of ScriptsSnippets is=". $_SESSION['name'];
?>

</body>
</html>
Output:
The Author of ScriptsSnippets is Sathesh
 

SESSION DESTROY

  • If you want to unset a particular Session variable we can use the unset() function to remove the value from the session variable
Unsetting a variable Snippet

<?php
unset($_SESSION['name']);
?>


  • When you do not need any of your Session variable and our aim is to completely destroy the session then we use session_destroy() function.
Session Destroy Snippet

<?php
session_destroy();
?>


 Thank u for reading this  Article hope it was useful !
-Regards
ScriptsSnippets




Saturday, 3 March 2012

Login Logout Snippet PHP

PHP Login validation and logout Snippet



Login.php
  • This is the login HTML page wit a Username and Password text field and a submit button

   <form action="verify.php" method="post" >
  <tr>
    <td>UserName :</td><td><input type="text" name="username"      value=""/></td></tr>
    <tr>
  <td>Password:</td><td><input type="password" name="password" value="" /></td></tr>
  <tr><td /><td><input type="submit" name="login" value="Login" /></td></tr>
 </form>
 




Verify.php

  • This is the PHP script specified in the Form Action of the HTML Page,whose primary purpose is to authenticate a user is a verified user or not.

<?php 
if(isset($_POST['login'])){ 
    $dbHost = "localhost";        //Location Of Database usually its localhost 
    $dbUser = "root";            //Database User Name 
    $dbPass = "";            //Database Password 
    $dbDatabase = "";    //Database Name 
     
    $db = mysql_connect($dbHost,$dbUser,$dbPass)or die("Error connecting to database."); 
    //Connect to the databasse 
    mysql_select_db($dbDatabase, $db)or die("Couldn't select the database."); 
    //Selects the database 
     
    The Above code can be in a different file, then you can place include'filename.php'; instead.
   
    $usr = mysql_real_escape_string($_POST['username']); 
    $pas = mysql_real_escape_string($_POST['password']); 
    $sql = mysql_query("SELECT * FROM login  
        WHERE username='$usr' AND 
        password='$pas' 
        LIMIT 1"); 
    if(mysql_num_rows($sql) == 1){ 
        $row = mysql_fetch_array($sql); 
        session_start(); 
        $_SESSION['username'] = $row['username']; 
        $_SESSION['logged'] = TRUE; 
  
  echo "Login Successful";
        // Modify to go to the page you would like 
        exit; 
    }else{ 
 $_SESSION['logged']= FALSE;
 echo "Login Failed";
                exit; 
    } 
}else{    //If the form button wasn't submitted go to the index page, or login page 
    header("Location: index.html");     
    exit; 
} 
?> 

Logout.php
  • This is the logout PHP Script used to unset and destroy the created Session

<?php
 //Start session
 session_start();
 //Unset the variables stored in session
 unset($_SESSION['username']);
 unset($_SESSION['logged']);
 session_destroy();
 //unset($_SESSION['SESS_LAST_NAME']);
?>
  • Note: Start the session again before destroying the variables in the logout page else an error will be specified
Include these in the your html pages you need to use.Cheers !

Thank u for reading this  Article hope it was useful !
-Regards
ScriptsSnippets

Sunday, 26 February 2012

XAMPP / WAMP / MAMP

In order for a web application to be Complete we need a database platform,A Server to execute server side Scripts and to store our files.



Instead of downloading this packages Separately and installing them individually these are available in a Single Package.
Point to Mention here is they are available free of Cost.
This can be Downloaded Separately from 
Apache: http://apache-http-server.en.softonic.com/
Mysql: http://www.mysql.com/downloads/

  1. WAMP
  • WAMP - Windows Apache MySql Php
  • Wamp is for windows which includes the the Apache server Mysql and Php that for optimised for the Microsoft Windows OS
  • Download link for WAMP: http://sourceforge.net/projects/wampserver/files/WampServer%202/WampServer%202.2/wampserver2.2c-x32.exe/download

     2. MAMP
  • MAMP -Mac Apache MySql Php
  • Mamp is for Mac  which includes the the Apache server Mysql and Php that for optimised for the Macintosh OS
  • Download link for MAMP:  http://www.mamp.info/en/downloads/index.html

     3.XAMPP
  • XAMPP - X(Cross Platform) MySQl PHP Perl

  • XAMPP  is a cross platform package which runs on all Os such as Mac,Windows,Solaris etc,it is not built for a particular platform and its size is larger than the other two.
  • Additionally it also runs the Perl Scripts which is a older Server Side Scripting Language
  • Download link: http://xampp.en.softonic.com/download


Order to be followed when Learning Web Technology/Web Application

1.HTML/XHTML: The first thing to learn in Web technology is html.Html lets us allow design web pages,without html there is no way we can create a web page.

XHTML is an extended HTML,it is just an extension of HTML,we can call it a Strict HTML in which we have to strictly use doctype in our pages and other restrictions.One can use W3 Schools to learn html.

2.CSS: CSS- Cascading Style Sheets
The Next thing after learning HTML one must learn is CSS

CSS offers Web Designers to Style their HTML Pages.
It Allows us to design layouts for our page.

3.JAVASCRIPT: Next in the order Comes JavaScript
  • It is a premier Client Side Scripting Language
  • Almost all Browsers interpret JavaScript
  • Its use to add Programming to our static web pages
W3 Schools and Headfirst JavaScript are good Source for learning JavaScript

4.PHP : My Personal Preference is PHP- PHP:Hypertext Preprocessor


  • It is a Server Side Scripting Language
  • All Validations and processing is done on the server side eg.On a Apache server
  • Login validations database usage is possible with PHP
  • Learning Php or any other server side scripting Is Mandatory in order to complete a web application.
 Source:Lynda.com offers good Tutorials in Beginners PHP

5.JQUERY: JQuery is primarily used to please the visual appearance of the web pages

  • Jquery is capable of doing extraordinary transition effects,and visually appealing effects
  • Make JQuery as a final touchup to your page.
  • If you have Mastered the other four Come for Jquery.
  • Source:Newboston Offers good Php Tutorials




Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Web Hosting Coupons