Thursday, August 30, 2012

Make Forex Trading Easy


Make Forex Trading Easy 


Forex trading is good way to earn income. Earning is not easy in any trade Forex is also have some thing to learn and practice by your self before starting the trade.In Forex trading you should be familiar with following tropics and Forex terms used in trade
  •  Currency Trading
  • Reading a Quote and Understanding the Jargon
  • Forex: Benefits and Risks
  •  Forex: History and Market Participants
  •  Forex: Economic Theories and Data
  •  Forex: Fundamental Trading Strategies
  •  Forex: Technical Analysis
If you are new to Forex trading my recommendation is to start with broker.I recommend you to start with  e-toro with success cases i have seen as well as many more reason you will be realized when you start get use of it.


About eToro Taken from http://www.etoropartners.com 

eToro was born out of a gut feeling that the currency exchange market can be accessible to people other than just professionally trained Forex traders, and that all that’s standing between a person who’s interested in trading Forex and the Forex capital markets are needless complicated charts and graphs and intimidating lingo.
So we went with our feeling and created a platform that uses simple visualizations together with professional FX analysis tools in order to make the financial, Forex and commodities markets approachable to people who have thus far been intimidated by them.
We provide our beginner traders with tools to help them learn about global currency trading and join the international currencies market with confidence. Our platform offers Forex trading guides, tutorials and a demo mode where they can practice and see their progress.
However, we were not in any way prepared to compromise any of the tools a professional Forex trader needs at their disposal. We offer reliable real time execution of trades, over 10 currency pairs to trade in, with bottom low spreads of 2 pips for most of them, along with various charts and charting tools, and leverages ranging from 1:10 to 1:400.
We also offer commodity trading using the same user friendly interfaces where traders can buy and sell Gold, Silver and Oil. And guess what? Our revolutionary approach worked. Today eToro is a world leader in the field of online foreign exchange trading and our ground breaking software is a benchmark in the industry.

Importance of Twitter Followers


Importance of Twitter Followers

Twitter is very important as social media network and spreading your business as well.Twitter followers which sign up in your profile enable you to send your advertisements ,Recent blog post or massages to other people.By using twitter your products and services could be promoted.
              Twitter is a social network has tremendous popularity world wide where users can use short massage service (SMS) with other twitter members.and also can tweet your recent popular blog post in tweets.
It is very importance to get followers in twitter to whom you can send your massages containing  your popular blog post or marketing your products and services.
Twitter can be a great tool for interacting with your customers and marketing your goods and services  and it also a tool for collecting customers feed back.

Following are the simple ways of getting twitter followers
  • Provide link to your twitter profile in your email signature.
  • Provide link to your twitter profile using other social media networks
  • Provide link to your twitter profile in your blog or web site.
  • Following any one who could follows back you.
 Above simple methods get some time to build number of followers.and also get low number of followers.but your aim is propagate your massages among huge number of people with short period of time.In that case, I think the best way of getting followers by using the Tweet Adder software
 
Which has following features and many more

Profile Data Search search twitter bio, plus filters

Location Search search by geographic location around the world, plus filters

Twitter List Search imports another users twitter list

Followers of a User obtains a list of profiles following a particular user

Followed by a User obtains a list of profiles a user is following

Huge flexibility with result filters

Tuesday, August 21, 2012

Different User levels in Login

Different User levels in Login

Different levels of user access should be provided in database management system.Here in my example different users are directed to different pages.
First create table users2 in my database.

CREATE TABLE IF NOT EXISTS `users` (
  `id` int(60) NOT NULL AUTO_INCREMENT,
  `user_name` varchar(60) NOT NULL,
  `pass_word` varchar(60) NOT NULL,
  `user_type` varchar(40) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Then create register page as follows register.php


<?php
    session_start();
?>
<html>
<head>

<title>Registration Form</title>

</head>
<body>
<?php
    if( isset($_SESSION['ERRMSG_ARR']) && is_array($_SESSION['ERRMSG_ARR']) && count($_SESSION['ERRMSG_ARR']) >0 ) {
        echo '<ul class="err">';
        foreach($_SESSION['ERRMSG_ARR'] as $msg) {
            echo '<li>',$msg,'</li>';
        }
        echo '</ul>';
        unset($_SESSION['ERRMSG_ARR']);
    }
?>
<h2><center><font color=#f09718>Registration Form</font></center></h2>
<form id="loginForm" name="loginForm" method="post" action="register-check.php">
  <table bgcolor=#f09718 align="center">
  
    <tr bgcolor=#ffffff>
      <th width="124">User Name</th>
      <td width="168"><input name="user_name" type="text" class="textfield" id="user_name" /></td>
    </tr>
    <tr bgcolor=#ffffff>
      <th>Password</th>
      <td><input name="pass_word" type="password" class="textfield" id="pass_word" /></td>
    </tr>
    <tr bgcolor=#ffffff>
      <th>User Type </th>
      <td><select name="user_type">
                                <option value="1">Administrator</option>
                                <option value="2">User1</option>
                                <option value="3">User2</option>
        </select></td>
    </tr>
    <tr bgcolor=#ffffff>
      <td>&nbsp;</td>
      <td><input type="submit" name="Submit" value="Register" /></td>
    </tr>
  </table>
</form>
</body>

register-check.php 



<?php
 
    session_start();
 
 
    require_once('dbcon.php');
 
 
    $errmsg_arr = array();
 

    $errflag = false;
 

    $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
    if(!$link) {
        die('Failed to connect to server: ' . mysql_error());
    }
 
    //Select database
    $db = mysql_select_db(DB_DATABASE);
    if(!$db) {
        die("Unable to select database");
    }
 
    //Function to sanitize values received from the form. Prevents SQL injection
    function clean($str) {
        $str = @trim($str);
        if(get_magic_quotes_gpc()) {
            $str = stripslashes($str);
        }
        return mysql_real_escape_string($str);
    }
 
    //Sanitize the POST values
    $user_name = clean($_POST['user_name']);
    $pass_word = clean($_POST['pass_word']);
    $user_type = clean($_POST['user_type']);
 
    //Input Validations
  
 
    if($user_name == '') {
        $errmsg_arr[] = 'Login ID missing';
        $errflag = true;
    }
    if($pass_word == '') {
        $errmsg_arr[] = 'Password missing';
        $errflag = true;
    }
    if($user_type  == '') {
        $errmsg_arr[] = 'User Type  missing';
        $errflag = true;
    }
  
 
    //Check for duplicate login ID
    if($user_name != '') {
        $qry = "SELECT * FROM users2 WHERE user_name='$user_name'";
        $result = mysql_query($qry);
        if($result) {
            if(mysql_num_rows($result) > 0) {
                $errmsg_arr[] = 'Login ID already in use';
                $errflag = true;
            }
            @mysql_free_result($result);
        }
        else {
            die("Query failed");
        }
    }
 
 
    if($errflag) {
        $_SESSION['ERRMSG_ARR'] = $errmsg_arr;
        session_write_close();
        header("location: register.php");
        exit();
    }


    $qry = "INSERT INTO users2(user_name, pass_word , user_type) VALUES('$user_name','".md5($_POST['pass_word'])."','$user_type')";
    $result = @mysql_query($qry);
 
    //Check whether the query was successful or not
    if($result) {
        header("location: register-success.php");
        exit();
    }else {
        die("Query failed");
    }
?>

register-success.php 


<html>
<head>
<title>Registration Successful</title>
</head>
<body>
<h1>Registration Successful</h1>
<p><a href="login.php">Click here</a> to login to your account.</p>
</body>
</html>

login.php 


<fieldset>
            <legend>User Login</legend>
<form id="loginForm" name="loginForm" method="post" action="login-exc.php">
            <label>Username</label><br>
            <input size="30" name="user_name" type="text"><br>
            <label>Password</label><br>
            <input size="30" name="pass_word" type="password"><br>
            <label>User Type</label><br>
            <select name="user_type">
                                 <option value="1">Administrator</option>
                                <option value="2">User1</option>
                                <option value="3">User2</option>
 </select><br>
            <input value="Submit" type="submit">
</form>
        </fieldset>

login-exc.php 

<?php
 
    session_start();
 
 
    require_once('dbcon.php');
 
 
    $errmsg_arr = array();
 

    $errflag = false;
 
 
    $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
    if(!$link) {
        die('Failed to connect to server: ' . mysql_error());
    }
 
    //Select database
    $db = mysql_select_db(DB_DATABASE);
    if(!$db) {
        die("Unable to select database");
    }
 
 
    function clean($str) {
        $str = @trim($str);
        if(get_magic_quotes_gpc()) {
            $str = stripslashes($str);
        }
        return mysql_real_escape_string($str);
    }
 
 
    $user_name = clean($_POST['user_name']);
    $pass_word = clean($_POST['pass_word']);
   $user_type = clean($_POST['user_type']);
    //Input Validations
    if($user_name == '') {
        $errmsg_arr[] = 'Login ID missing';
        $errflag = true;
    }
    if($pass_word == '') {
        $errmsg_arr[] = 'Password missing';
        $errflag = true;
    }
   if($user_type == '') {
        $errmsg_arr[] = 'User Type missing';
        $errflag = true;
    }
    //If there are input validations, redirect back to the login form
    if($errflag) {
        $_SESSION['ERRMSG_ARR'] = $errmsg_arr;
        session_write_close();
        header("location: login.php");
        exit();
    }
 
 
    $qry="SELECT * FROM users2 WHERE (user_name='$user_name' AND pass_word='".md5($_POST['pass_word'])."' AND user_type='$user_type')";
    $result=mysql_query($qry);
 
    switch($user_type){
case 1:
    //Check whether the query was successful or not
        if($result){      
    if(mysql_num_rows($result) == 1){
        //Login successful
            session_regenerate_id();
            $login = mysql_fetch_assoc($result);
            $_SESSION['SESS_username'] = $login['user_name'];
            $_SESSION['SESS_usercategory'] = $login['pass_word'];
            $_SESSION['SESS_password'] = $login['user_type'];
          
            session_write_close();
            header("location: sample1.php");
               exit();
            }else {
            //Login failed
            header("location: login_failed.php");
            exit();
            }
        }
       break;
     
case 2:
    //Check whether the query was successful or not
 if($result){      
          if(mysql_num_rows($result) == 1){
        //Login successful
            session_regenerate_id();
           $login = mysql_fetch_assoc($result);
            $_SESSION['SESS_username'] = $login['user_name'];
            $_SESSION['SESS_usercategory'] = $login['pass_word'];
            $_SESSION['SESS_password'] = $login['user_type'];
            session_write_close();
            header("location: sample2.php");
               exit();
            }else {
            //Login failed
            header("location: login_failed.php");
            exit();
            }
        }
     break;
   
case 3:
    //Check whether the query was successful or not
    if($result){      
    if(mysql_num_rows($result) == 1){
        //Login successful
            session_regenerate_id();
           $login = mysql_fetch_assoc($result);
            $_SESSION['SESS_username'] = $login['user_name'];
            $_SESSION['SESS_usercategory'] = $login['pass_word'];
            $_SESSION['SESS_password'] = $login['user_type'];
          
            session_write_close();
            header("location: sample3.php");
               exit();
            }else {
            //Login failed
            header("location: login_failed.php");
            exit();
            }
        }
     break;
default:die("Query failed");
     exit();
    }
       
  
?>


sample1.php
 sample1</br>
<?php
require_once "authorization.php"; 
echo "welcome".$_SESSION['SESS_username'];
?>
 <a href="logout.php">Logout</a>
sample2.php
 sample2</br>
<?php
require_once "authorization.php"; 
echo "welcome".$_SESSION['SESS_username'];
?>
<a href="logout.php">Logout</a>
sample1.php
sample3</br>
<?php

require_once "authorization.php";  
echo "welcome".$_SESSION['SESS_username'];
?>

 <a href="logout.php">Logout</a>

authorization.php 



<?php 
//Start session    session_start();    
if(!isset($_SESSION['SESS_username']) || (trim($_SESSION['SESS_username']) == '')) {        header("location: access-denied.php");     
exit();    }
?>

access-denied.php 


<html>
<head>
<title>Access Denied</title>
</head>
<body>
<h1>Access Denied </h1><p align="center">&nbsp;</p><h4 align="center" class="err">Access Denied!<br />  You do not have access to this resource.</h4>
</body>
</html>

logout.php

<?php
 
    session_start();
 
 
      unset($_SESSION['SESS_username']);
      unset($_SESSION['SESS_usercategory']);
    unset($_SESSION['SESS_password']);
?>
<html>
<head>

<title>Logged Out</title>

</head>
<body>
<h1>Logout </h1>
<p align="center">&nbsp;</p>
<h4 align="center" class="err">You have been logged out.</h4>
<p align="center">Click here to <a href="login_form.php">Login</a></p>
</body>
</html>

Saturday, August 18, 2012

Multiple Selection in to a MySQL table


Multiple Selection in to a MySQL table

Drop down select only one option and no any issues with sending single value into a MySQL table.But look at bellow multiple select  box.

We could select multiple item listed here by using shift key.with simple scripting you could also sent the selected values in to a MySQL table.I have created table called multiple in my_database as follows

CREATE TABLE IF NOT EXISTS `multiple` (
  `id` int(30) NOT NULL AUTO_INCREMENT,
  `multy_name` varchar(40) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Then created above html file.

<form action="send.php" method="post">
<select name="test[]" multiple="multiple">
    <option value="one">one</option>
    <option value="two">two</option>
    <option value="three">three</option>
    <option value="four">four</option>
    <option value="five">five</option>
</select>
<input type="submit" value="Send" />
</form>

send.php Which will be sending data into MySQL table is as bellow

 
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_database", $con);
    $test=$_POST['test'];
    if ($test){
     foreach ($test as $t){
mysql_query("INSERT INTO multiple
VALUES ('', '$t')");

}
    }
echo "<font color='red'>successfull!</font>";
mysql_close($con);
?>

Stored data looks like bellow in the table.



Friday, August 17, 2012

PHP Installer

PHP Installer

Some PHP applications need to have installer to install databases, in order to install database and tables provided by php applications we have to input our password,user name,database name etc.which are to be written into the file mostly name as config.php to install the tables.You need to post your following details to to be written into confg.php by using bellow table.


Input Host Name
Input Password
Input Database Name
Input Table Name
Click To Install The Application


<table bgcolor=#445275 align="center">
<form action="install.php" method="post">
<tr bgcolor=#cfd9f5><td>Input Host Name</td><td><input type="text" name="host"></td></tr>
<tr bgcolor=#cfd9f5><td>Input Passward</td><td><input type="text" name="pward"></td></tr>
<tr bgcolor=#cfd9f5><td>Input Database Name</td><td><input type="text" name="dbname"></td></tr>
<tr bgcolor=#cfd9f5><td>Input Table Name</td><td><input type="text" name="tbname"></td></tr>
<tr bgcolor=#cfd9f5><td>Click To Inatall The Application</td><td><input type="submit" value="Install"></td></tr>
</form>
</table>

install.php will write the above information into config.php shown 2nd bellow


<?php
$host=$_POST['host'];
$pward=$_POST['pward'];
$dbname=$_POST['dbname'];
$tbname=$_POST['tbname'];
$myFile = "config.php";
$fh = fopen($myFile, 'w') or die("can't open file");
$tag1="<?php";
$host="\$host='$host';\n";
$pward="\$pward='$pward';\n";
$dbname="\$dbname='$dbname';\n";
$tbname="\$tbname='$tbname';\n";
$tag2="?>";
fwrite($fh, $tag1);
fwrite($fh, $host);
fwrite($fh, $pward);
fwrite($fh, $dbname);
fwrite($fh, $tbname);
fwrite($fh, $tag2);
fclose($fh);
header("location: config.php");

?>

config.php :-Empty file created to write above details bellow it has written with the data i entered



<?php
$host='localhost';
$pward='novotelwebinfoplus';
$dbname='infoplus';
$tbname='wintable';
?>

Saturday, August 11, 2012

Free Software Links



Free Software Links



Web BrowsersAnti Virus Programs








Free Office Suites

Photo Editing Software





Text Editorshttp://www.gimp.org/images/news-icons/wilber.pngGimp

Notepad++


PSPad


Komodo Edit


Programmer’s Notepad


TotalEdit


Crimson Editor


Nvu


Amaya


RText






Move to Next and Previous records PHP MySQL



Move to Next and Previous records PHP MySQL

Viewing single record and move from one record to another could be done in MySQL by using PHP.Bellow table I have taken from person table in my_database, which you have created in previous tutorial.anyway creating the table also,I have included codes bellow.

CREATE TABLE IF NOT EXISTS `person` (
  `id` int(45) NOT NULL AUTO_INCREMENT,
  `FirstName` varchar(15) DEFAULT NULL,
  `LastName` varchar(15) DEFAULT NULL,
  `birth_day` date DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;

--
-- Dumping data for table `person`
--

INSERT INTO `person` (`id`, `FirstName`, `LastName`, `birth_day`) VALUES
(1, 'Scarl', 'Johan', '1949-06-04'),
(2, 'Clooneer', 'Henderson', '1974-06-04'),
(3, 'Katena ', 'Daviddson', '1950-06-04'),
(4, 'Mark', 'Jones', '1955-06-05'),
(5, 'Silvi', 'James', '1970-06-05'),
(6, 'Jerry', 'Harfer', '1987-04-08'),
(7, 'Mark', 'Header', '1955-03-08'),
(8, 'Kim', 'Darrel', '1990-06-05'),
(9, 'Tiny', 'Dare', '1951-06-05');

Displaying data file looks like as in bellow

Person details

Clooneer
Henderson
1974-06-04
Following codes move records as previous and next

<h2><center>Person details</center></h2>
<?php
mysql_connect("localhost", "root", "");
mysql_select_db("my_database");
if(isset($_GET['id']) && (int)$_GET['id']) $id = $_GET['id'];
else $id = 1;

$query = "SELECT*FROM person WHERE id = '$id' LIMIT 1";
$result = mysql_query($query);
if($num=mysql_numrows($result))
{
$record = mysql_fetch_assoc($result);
$fname = $record["FirstName"];
$lname = $record["LastName"];
$birth_day =$record["birth_day"];

echo "<table bgcolor=#7c98d5 align='center' width=200><tr bgcolor=#e2e6ef><td>".$fname."</td></tr>";
echo "<tr bgcolor=#e2e6ef><td>".$lname."</td></tr>";
echo "<tr bgcolor=#e2e6ef><td>".$birth_day."</td></tr></table>";
echo $max;
}

$next = $id + 1;
$prev = $id - 1;
?>
<table align="center"><tr><td><a href="nrecord.php?id=<?php echo $prev;?>"><input type="button" value="<<"></a></td>
<td><a href="nrecord.php?id=<?php echo $next;?>"><input type="button" value=">>"></a></td>
</tr></table>

Monday, August 6, 2012

Tool Tip Js



Tool Tip Js 

You could create tool tips using java scripts bellow is the code to create above tool tip images.




<head>

<script type="text/javascript">


     var tip=new Array
           tip[0]='Zoom Tool:-Zoom your Images<br /> upto 2000px!'
           tip[1]='Crop Images:-crop your Images<br /> 200*200 scale!'
           tip[2]='Text Tool:-Type the text you need!'
       
         
     function showtip(current,e,num)
        {
         if (document.layers)
            {
             theString="<DIV CLASS='ttip'>"+tip[num]+"</DIV>"
             document.tooltip.document.write(theString)
             document.tooltip.document.close()
             document.tooltip.left=e.pageX+14+'px'
             document.tooltip.top=e.pageY+2+'px'
             document.tooltip.visibility="show"
            }
         else
           {
            if(document.getElementById)
              {
               elm=document.getElementById("tooltip")
               elml=current
               elm.innerHTML=tip[num]
               elm.style.height=elml.style.height
               elm.style.top=parseInt(elml.offsetTop+elml.offsetHeight)+'px'
               elm.style.left=parseInt(elml.offsetLeft+elml.offsetWidth+10)+'px'
               elm.style.visibility = "visible"
              }
           }
        }
function hidetip(){
if (document.layers)
   {
    document.tooltip.visibility="hidden"
   }
else
  {
   if(document.getElementById)
     {
      elm.style.visibility="hidden"
     }
  }
}
</script>
</head>
<body>
<table bgcolor=#000000>
<div id="tooltip" style="position:absolute;visibility:hidden;border:1px solid black;font-size:12px;layer-background-color:#efe07e;background-color:#efe07e;padding:1px"></div>
<tr bgcolor=#ffffff><td><img src="mag.jpg" onMouseover="showtip(this,event,'0')" onMouseOut="hidetip()"></td>
<td></tr>
<tr bgcolor=#ffffff><td><img src="crop.jpg" onMouseover="showtip(this,event,'1')" onMouseOut="hidetip()"></td>
<td></tr>
<tr bgcolor=#ffffff><td><img src="test.jpg" onMouseover="showtip(this,event,'2')" onMouseOut="hidetip()"></td>
</tr>
</table>
</body>

Saturday, August 4, 2012

Exporting and Importing data in Xampp



Exporting and Importing data in Xampp 


xampp is used to build up local server in our PC.where we run these php scripts.After the development of an application is over we have to transfer the pages and data in database in to a remote server.File transfer is very easy but data base transfer?.. It also very easy due to exporting and importing facilities in xampp.

Exporting Data from Xampp

We will look at the  table we created as namelist in xampp interface.you have to go xampp interface by typing URL:-http://localhost/phpmyadmin/ then you would see the following interface.


Then select my_database you would see the tables in my_database


Click on the table namelist you would see bellow table


Then press the export tab in xampp and then press Goyou would see bellow picture.
 Then right click on the above page and select all,copy the consent and paste into a note pad name it as .txt file in your own name in my case i have named it as dump.txt.
Then create database in any name.I have created it as blog


Then press import tab then bellow window appears.


Then browse the dump.txt you created and press Go table name list will be created as follows.






Multiple Submits in Single Form php



Multiple Submits in Single Form php 



Name
Designation
Home Town

You often have seen one form with one submit button.But by using PHP scripts we can create multiple submission of single form.This example,I have created to submit one for printing by using print.php and other for entering the form content into database by using enter.php which enters data into a table called employee_details created using following .txt file in my_database.
CREATE TABLE IF NOT EXISTS `employee_details` (
  `id` int(20) NOT NULL AUTO_INCREMENT,
  `First_Name` varchar(40) NOT NULL,
  `Designation` varchar(40) NOT NULL,
  `Home_Town` varchar(40) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

These two submission Print and Enter are deviated by a file called div.php which contains include and if, else if and else conditions,used to deviate print  button submission to print .php and enter button submission to enter.php
<html>
<head>
</head>
<body>
<table bgcolor=#f7d9c7 width=100 height=100 align="center">
<form action="div.php" method="post" target="foo" onSubmit="window.open('', 'foo', 'width=800,height=500,status=yes,resizable=yes,scrollbars=yes')">
<tr><td>Name</td><td><input type="text" name="First_Name"/></td></tr>
<tr><td>Designation</td><td><input type="text" name="Designation"/></td></td></tr>
<tr><td>Home Town</td><td><input type="text" name="Home_Town"/></td></tr>
<tr><td align="right"><input type="submit" value="Print" name="prnt" id="prnBtn"></td><td align="right"><input type="submit" value="Enter" name="save" id="subBtn"></td></tr>
</form>
</table>
</body>
</html>

Web pages and web application development use HTML,PHP,Java Scripts and CSS in combination. This example also,I have used java scripts to open print.php and enter.php in new window without menu bars and use given width and height values to view real software window like appearance.and It also has used  CSS styles to prevent print button printing with the document.
div.php:-

<?php

if ($_POST['prnt']=='Print')
{
include "print.php";
}
else if ($_POST['save']=='Enter')
{
include "enter.php";
}
else
{
 echo "error!";
}
?>

print.php:- 

<head>
<style type='text/css' media='print'>
#prnBtn {display : none}
</style>

</head>
<body>
<?php
$fname=$_POST['fname'];
$desig=$_POST['desig'];
$htown=$_POST['htown'];
?>
<table>
<tr><td><img src="pn.png"></td><td>Employers detail of web design company</td></tr>
<tr><td>Name:</td><td><?php echo $fname;?></td></tr>
<tr><td>Designation:</td><td><?php echo $desig;?></td></tr>
<tr><td>Home Town:</td><td><?php echo $htown;?></td></tr>
<tr><td>&nbsp;</td><td>--------------------</td></tr>
<tr><td>&nbsp;</td><td>Authorized officer's Signature</td></tr>
<tr><td><input type="button" value="PRINT" onClick="window.print()" id="prnBtn"></td></tr>
</table>
</body>

enter.php

<?php
$username="root";
$password="";
$database="my_database";

$First_Name=$_POST['First_Name'];
$Designation=$_POST['Designation'];
$Home_Town=$_POST['Home_Town'];

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO employee_details VALUES ('','$First_Name','$Designation','$Home_Town')";
mysql_query($query);
mysql_close();
echo
"<font color='red'>You have sucessfully entered data </font>"
?>

Friday, August 3, 2012

Image Rotation JS



Image Rotation JS

You have ability of rotating few images using java scripts.I have created folder named pics in in web root directory(Xampp it is htdocs) then added 4 images img1.img2,img3 and img4 and created following js file.


<body>
<style>
.textstyle {
position:absolute;
visibility:visible;
border-style:solid;
border-width:2px;
border-color:#EEEEEE;
font-family:Arial;
font-size:8pt;
color:#FFFFFF;
text-align:center;
background-color:#CCCCCC;
top:-1000px;
}
</style>

<script>
var rotatingimage=new Array()
var rotatingtext=new Array()
var rotatinglink=new Array()
rotatingimage[0]="img1.jpg"
rotatingimage[1]="img2.jpg"
rotatingimage[2]="img3.jpg"
rotatingimage[3]="img4.jpg"
rotatingtext[0]="Sea Fish1"
rotatingtext[1]="Sea Fish2"
rotatingtext[2]="Sea Fish3"
rotatingtext[3]="Sea Fish4"
rotatinglink[0]="map5.html"
rotatinglink[1]="map2.html"
rotatinglink[2]="http://www.hotscripts.com"
rotatinglink[3]="http://www.hotscripts.com"
var circlewidth=420
var circleheight=240
var imgwidth=150
var imgheight=90
var textboxheight=17
var bgimg="beach.jpg"
var displaymax=7
var step=0.02;
var zoomfactor=2;
var imgpadding=10
var maxopacity=new Array()
var i_imgcounter=0
var segment=360/(displaymax);
var decrement=0;
var op
var tmr
var opacitystep=Math.round(100/circleinnerheight)
var zoomobj
var twidth
var theight
var windowwidth
var windowheight
var circleinnerwidth=circlewidth-(imgwidth+2*imgpadding)
var circleinnerheight=circleheight-(imgheight+2*imgpadding)
circleinnerwidth=circleinnerwidth/2
circleinnerheight=circleinnerheight/2

var ns4=document.layers?1:0
var ns6=document.getElementById&&!document.all?1:0
var ie=document.all?1:0

var preloadedimages=new Array()
for (i=0;i<rotatingimage.length;i++){
    preloadedimages[i]=new Image()
    preloadedimages[i].src=rotatingimage[i]
}

for (i=0;i<displaymax;i++) {
    maxopacity[i]=1
}

function getpagesize() {
    windowwidth=parseInt(document.body.clientWidth)
    windowheight=parseInt(document.body.clientHeight)
    twidth=Math.floor(circleinnerwidth)
    theight=Math.floor(circleinnerheight)
    i_imgcounter=0
   
    for (i=0; i<displaymax; i++) {
        var thisspan=eval("document.getElementById('span"+i+"').style")
        thisspan.left=(twidth*Math.sin(decrement+i*segment*Math.PI/180)+circleinnerwidth+imgpadding)+"px";
        thisspan.top=(theight*Math.cos(decrement+i*segment*Math.PI/180)+circleinnerheight+imgpadding)+"px";
        thisspan.zIndex=parseInt(thisspan.top)

        op=parseInt(100/circleinnerheight*(parseInt(thisspan.top)*0.5))
        document.getElementById('span'+i).innerHTML="<a href='"+rotatinglink[i_imgcounter]+"'><img border=0 width="+imgwidth+" src='"+rotatingimage[i_imgcounter]+"' id='im"+i_imgcounter+"' onMouseover='stoprotating(this)' onMouseout='restartrotating()'></a><br>"+rotatingtext[i_imgcounter]
    document.getElementById('span'+i).style.visibility="visible"
            maxopacity[i]=-1
            i_imgcounter++
        if (i_imgcounter>=rotatingimage.length) {
            i_imgcounter=0
        }
    }
   
    rotatetext()
}

function rotatetext() {
    for (i=0; i<displaymax; i++) {
        var thisspan=eval("document.getElementById('span"+i+"').style")
        thisspan.left=(twidth*Math.sin(decrement+i*segment*Math.PI/180)+circleinnerwidth+imgpadding)+"px";
        thisspan.top=(theight*Math.cos(decrement+i*segment*Math.PI/180)+circleinnerheight+imgpadding)+"px";
        thisspan.zIndex=parseInt(thisspan.top)

        op=parseInt((100/circleinnerheight*(parseInt(thisspan.top)*0.5))-imgpadding)
       
        if (op<5 && maxopacity[i]==1) {
            if (i_imgcounter>=rotatingimage.length) {
                i_imgcounter=0
            }
            document.getElementById('span'+i).innerHTML="<a href='"+rotatinglink[i_imgcounter]+"'><img border=0 width="+imgwidth+" src='"+rotatingimage[i_imgcounter]+"' id='im"+i_imgcounter+"' onMouseover='stoprotating(this)' onMouseout='restartrotating()'></a><br>"+rotatingtext[i_imgcounter]
    document.getElementById('span'+i).style.visibility="visible"
            maxopacity[i]=-1
            i_imgcounter++
        }
        if (op>90) {
            maxopacity[i]=1
        }
   
        if (ie) {
            var thisfilter=eval("document.getElementById('span"+i+"')")
            thisfilter.filters.alpha.opacity=op
        }
        else {
            var thisfilter=eval("document.getElementById('span"+i+"').style")
            thisspan.opacity=op/100
        }
    }
    decrement-=step;
    tmr=setTimeout('rotatetext()', 50);
}

function stoprotating(thisobj) {
    clearTimeout(tmr)
    zoomobj=thisobj
    document.getElementById(zoomobj.id).style.width=(zoomfactor*imgwidth)+"px"
    document.getElementById(zoomobj.parentNode.parentNode.id).style.width=(zoomfactor*imgwidth)+"px"
    zoomobj.parentNode.parentNode.style.zIndex=9999
    if (ie) {
        zoomobj.parentNode.parentNode.filters.alpha.opacity=100
    }
    else {
        zoomobj.parentNode.parentNode.style.opacity=1
    }
}

function restartrotating() {
    document.getElementById(zoomobj.id).style.width=imgwidth+"px"
    document.getElementById(zoomobj.parentNode.parentNode.id).style.width=imgwidth+"px"
    rotatetext()
}


document.write('<div id="roof" style="position:relative;width:'+circlewidth+'px;height:'+(circleheight+textboxheight)+'px;">')
if (bgimg) {
    document.write('<img src="'+bgimg+'" width="'+circlewidth+'" height="'+(circleheight+textboxheight)+'">')
}
for (i=0;i<displaymax;i++) {
    document.write("<div id='span"+i+"' class='textstyle' style='filter:alpha(opacity=80);opacity:0.8;width:"+imgwidth+"px;visibility:hidden'></div>");
    i_imgcounter++
    if (i_imgcounter>=rotatingimage.length) {
        i_imgcounter=0
    }
}
document.write('</div>');
window.onload=getpagesize;
</script>

</body>

Thursday, August 2, 2012

Slide Images js



Slide Images js

Using java scripts you could create sliding image application for this I have used 3 Images called "Christina.jpg"
,"Jessica.jpg"&"Victoria.jpg". You could watch the Video of that image slide and scripts are as follows.



<body>
<style>
.textstyle {
    font-family:Arial;
    font-size: 9pt;
    color:#FFFFFF;
    background-color:#AAAAAA;
    text-align:center;
}
</style>
<script>
var imgname=new Array()
var imglink=new Array()
var message=new Array()
imgname[0]="Christina.jpg"
imgname[1]="Jessica.jpg"
imgname[2]="Victoria.jpg"
imglink[0]="http://wintekweb.blogspot.com/2012/08/add-additional-input-to-drop-down-js.html"
imglink[1]="http://wintekweb.blogspot.com/2012/07/auto-fill-same-type-of-inputs-js.html"
imglink[2]="http://wintekweb.blogspot.com/2012/07/word-and-character-counter-js.html"
message[0]="Christina Milian"
message[1]="Jessica Alba"
message[2]="Victoria Justice"
var imgwidth=256
var imgheight=164
var textheight=17
var pause=2000
var imgpreload=new Array()
for (i=0;i<=imgname.length-1;i++) {
    imgpreload[i]=new Image()
    imgpreload[i].src=imgname[i]
}
var pause=2000
var speed=20
var step=20
var i_loop=0
var i_image=0

var pos_left=0
var pos_top=0

function stretchimage() {
    if (i_loop<=imgwidth) {
        imgcontainer.innerHTML="<a href='"+imglink[i_image]+"' target='_blank'><img width='"+i_loop+"' src='"+imgname[i_image]+"' border='0'></a>"
        i_loop=i_loop+step
        var timer=setTimeout("stretchimage()",speed)
      }
    else {
        clearTimeout(timer)
        imgcontainer.innerHTML="<a href='"+imglink[i_image]+"' target='_blank'><img width='"+imgwidth+"' src='"+imgname[i_image]+"' border='0'></a>"
        textcontainer.innerHTML=message[i_image]
        textcontainer.style.visibility="visible"
        var timer=setTimeout("shrinkimage()",pause)
    }
}

function shrinkimage() {
    if (i_loop>-step) {
        textcontainer.style.visibility="hidden"
        imgcontainer.innerHTML="<a href='"+imglink[i_image]+"' target='_blank'><img width='"+i_loop+"' src='"+imgname[i_image]+"' border='0'></a>"
        i_loop=i_loop-step
        var timer=setTimeout("shrinkimage()",speed)
      }
    else {
        clearTimeout(timer)
        changeimage()
    }
}

function changeimage() {
    i_loop=0
    i_image++
    if (i_image>imgname.length-1) {i_image=0}
       var timer=setTimeout("stretchimage()",pause)
}

function initiate() {
    document.getElementById('imgcontainer').style.left=pos_left
    document.getElementById('imgcontainer').style.top=pos_top
    changeimage()
}

document.write('<div id="roof" style="position:relative;width:'+imgwidth+';height:'+imgheight+'">')
document.write('<div id="imgcontainer" style="position:absolute;top:0px;left:0px;width:'+imgwidth+'px;height:'+imgheight+'px"></div>')
document.write('<div id="textcontainer" class="textstyle" style="position:absolute;top:'+imgheight+'px;left:0px;width:'+imgwidth+'px;height:'+textheight+'px;visibility:hidden"></div>')
document.write('</div>')
window.onload=onLoad=stretchimage
</script>
</body>

Add Additional Input to Drop down js



Add Additional Input to Drop down js 

HTML Drop down boxes are not allowed to add additional drop down elements.But user will be facing the problem of entering new item to the list of options.Using the Java Scripts we could add additional items into list of options.But after submission of the form or with page refresh it disappears.
Following example click the New category option then java script input box appear to input your new list item of options.After submission new item is in the drop down list.






<html>
<head>
<script type="text/javascript">
function xCar_Type(select) {
if (select.value!= "new") return;
var Car_TypeName = prompt('Please enter category name:','');
if (!Car_TypeName) return;
var newOption = document.createElement("option");
newOption.value = Car_TypeName;
newOption.appendChild(document.createTextNode(Car_TypeName));
select.insertBefore(newOption, select.lastChild);
select.selectedIndex = select.options.length-3;
}
</script>
</head>
<body>
<table align="center" height=100 bgcolor=#e5b5b5>
<tr><td><select name="Car_Type" onchange="xCar_Type(this)">
<option value='Cadillac'>Cadillac</option>
<option value='Ford'>Ford</option>
<option value='Chevrolet '>Chevrolet</option>
<option value="new">New category</option>
</select></td></tr>
</table>
</body>
</html>