Avance Zone

PHP Javascript Free Capcha

<div id="AvanceZone">
<?php
session_start();
if( isset($_POST['submit']))
 {
  $number1=rand(2,10);
  $number2=rand(3,10);
  $sum = $number1+$number2;
 
// For Debug  For Debug For Debug For Debug For Debug For Debug
//
//echo "Session value  is  <b> ". $_SESSION['val'] . " </b>But Typed AS : <b>" . $_POST['security_code'] . ".</b><br />";
//
// For Debug For Debug For Debug For Debug For Debug For Debug
 
  if( $_SESSION['val'] == $_POST['security_code'] )
  {
  echo 'Thank you. We Will Contact you Shortly';
    }
    else {
  echo 'Sorry, you have provided an Invalid security code';
       }
       session_destroy();
}
else
{
?>
 
 <form action="2.php" method="post">
  <label for="security_code">
  <?php
  $number1=rand(2,10);
  $number2=rand(3,7);
  $sum = $number1+$number2;
  $_SESSION['val']=$sum;
  echo "Please Enter The Sum Of <b> ". $number1 . " </b>And <b>" . $number2 . ".</b><br />";
  ?>
  </label>
  <input id="security_code" name="security_code" type="text" /><br />
  <input type="submit" name="submit" value="Submit" />
 </form>
 
<?php
 }
?>
</div>

Php Free Captch . Randowm Number generator to avoid spam

Use the below code with cache control to generate a random number to avod spam in form submissions

<div id="AvanceZone">
<?php
Header("Cache-Control: must-revalidate");
 
$offset = 60 * 60 * 24 * 3;
$ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
Header($ExpStr);
?>
<script type="text/javascript">
function check()
{
var string1=document.capcha_sum.sum.value
if (string1.==$sum){
alert("Try Again !")
document.capcha_sum.email.focus()
}
}
</script>
<?php
$number1=rand(2,10);
$number2=rand(3,7);
//echo "$number1";
//echo "$number2";
$sum = $number1+$number2;
//echo "$sum";
echo "Please Enter The Sum Of <b> ". $number1 . " </b>And <b>" . $number2 . ".</b><br />";
?>
<form name="capcha_sum">
<input type="text" size="10" name="sum">
<input type="submit" name="B1" value="Submit" onclick="check()">
</form>
</div>

select checkbox page load

javascript_onload_checkbox :

This javascript selects the checkbox using the indexof in pageload event

<html>
<head>
<script type="text/javascript">
var arr1 = "acd";
var arrval = "";
function load()
{
window.status="Page is loaded  here";
if ((searcharray=arr1.indexOf("a"))!=-1)
{
arrval="its A";
callalert();
document.test.checkgroup[0].checked=true;
}
if ((searcharray=arr1.indexOf("b"))!=-1)
{
arrval="its B";
callalert();
document.test.checkgroup[1].checked=true;
}
if ((searcharray=arr1.indexOf("c"))!=-1)
{
arrval="its C";
callalert();
document.test.checkgroup[2].checked=true;
}
if ((searcharray=arr1.indexOf("d"))!=-1)
{
arrval="its D";
callalert();
document.test.checkgroup[3].checked=true;
}
}
function clicked()
{
alert("Changing value manually")
}
function callalert()
{
alert (arrval);
}
document.write(’THE GIVEN VALUE OR ARRAY IS<br>);
document.write(arr1);
</script>
 
</head>
<body onload="load()">
</body>
</html>
<form name="test">
A:<input type="checkbox" name="checkgroup" onclick="clicked()"/><br />
B:<input type="checkbox" name="checkgroup" onclick="clicked()"/><br />
C:<input type="checkbox" name="checkgroup" onclick="clicked()"/><br />
D:<input type="checkbox" name="checkgroup" onclick="clicked()"/><br />
</form>
</html>

Browser full information javascript

To get full information on browser :

Like:

Browser name = Firefox
Full version = 2
Major version = 2
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11

Got a good script to achieve the above Use :

<html>
<SCRIPT LANGUAGE=”JavaScript”>
var nVer = navigator.appVersion;
var nAgt = navigator.userAgent;
var browserName  =;
var fullVersion  = 0;
var majorVersion = 0;
// In Internet Explorer, the true version is after “MSIE” in userAgent
if ((verOffset=nAgt.indexOf(”MSIE”))!=-1) {
 browserName  = “Microsoft Internet Explorer”;
 fullVersion  = parseFloat(nAgt.substring(verOffset+5));
 majorVersion = parseInt(+fullVersion);
}
// In Opera, the true version is after “Opera”
else if ((verOffset=nAgt.indexOf(”Opera”))!=-1) {
 browserName  = “Opera”;
 fullVersion  = parseFloat(nAgt.substring(verOffset+6));
 majorVersion = parseInt(+fullVersion);
}
// In Firefox, the true version is after “Firefox”
else if ((verOffset=nAgt.indexOf(”Firefox”))!=-1) {
 browserName  = “Firefox”;
 fullVersion  = parseFloat(nAgt.substring(verOffset+8));
 majorVersion = parseInt(+fullVersion);
}
// In most other browsers, “name/version” is at the end of userAgent
else if ( (nameOffset=nAgt.lastIndexOf(’ ‘)+1) < (verOffset=nAgt.lastIndexOf(/')) )
{
 browserName  = nAgt.substring(nameOffset,verOffset);
 fullVersion  = parseFloat(nAgt.substring(verOffset+1));
 if (!isNaN(fullVersion)) majorVersion = parseInt(”+fullVersion);
 else {fullVersion  = 0; majorVersion = 0;}
}
// Finally, if no name and/or no version detected from userAgent…
if (browserName.toLowerCase() == browserName.toUpperCase()
 || fullVersion==0 || majorVersion == 0 )
{
 browserName  = navigator.appName;
 fullVersion  = parseFloat(nVer);
 majorVersion = parseInt(nVer);
}
document.write(’Browser name  = ‘+browserName+’<br>’);
document.write(’Full version  = ‘+fullVersion+’<br>’);
document.write(’Major version = ‘+majorVersion+’<br>’);
document.write(’navigator.appName = ‘+navigator.appName+’<br>’);
document.write(’navigator.userAgent = ‘+navigator.userAgent+’<br>’);
</script>
<a href=”http://avancezone.com”>avancezone</a>
</html>

Javascript to know browser name and browser version

<html>
<body>
<script type="text/javascript">
var browser=navigator.appName;
var b_version=navigator.appVersion;
var version=parseFloat(b_version);
var cdname=navigator.appCodeName;
document.write("Browser name: "+ browser);
document.write("<br />");
document.write("code name: "+ cdname);
document.write("<br />");
document.write("Browser version: "+ version);
</script>
</body>
</html>

Connection of Database from Linux shell

mysql advantages and Connectivity from unix / linux shell 

•Ability to handle an unlimited number of simultaneous users.
•Capacity to handle 50,000,000+ records.
•Very fast command execution, perhaps the fastest to be found on the market.
•Easy and efficient user privilege system.

                Connect mysql from linux shell :
shell> mysql ?u arvind –p
where arvind is the username
(might work for root for username)
Enter password when prompted.

                To select database in mysql

mysql> use mydb;
Result:
Database changed Mydb>
You now are connected to mydb database

                Create table in mysql :


mysql> CREATE TABLE test ( > name VARCHAR (15), > email VARCHAR (25), > phone_number
INT, > ID INT NOT NULL AUTO_INCREMENT, > PRIMARY KEY (ID));

                Insert command in mysql :

mysql> INSERT INTO test VALUES mysql> (’Bugs Bunny’, ‘carrots@devshed.com’, mysql> 5554321,NULL);

                Delete a record from mysql table

mysql> DELETE FROM test mysql> WHERE (name = “arvind”);

Update a record in mysql database :

mysql> UPDATE test SET name = ‘arvind1′ mysql> WHERE name = “arvind2″;

arvind2 will be replace with arvind1

                selection and order by mysql :?
mysql> SELECT * FROM test WHERE mysql> (name = “arvind”) ORDER BY mysql>
phone_number;

MySql php Connection

<div id="Avance Zone">
<?php
echo "php started.....";
$sqlConn = mysql_connect('localhost', 'dbuname', 'dbpwd');
//this is comment
//dbuname is the database username
//dbpwd is the database password
if (!$sqlConn)
{
die('Connect error'.mysql_error());
//the error will be displayed if php cannt connet to your database
}
else
{
echo "Connected";
//connected will be displayed once your php connected with mysql
}
//$query = "show databases;";
//select which database you want to edit
$db=mysql_select_db("dbname");
//dbname is the database name
if(!$db)
{
die('mysql select error'.mysql_error());
//if db cannot be connected this shows this message
}
//select the table
$result = mysql_query("select * from R");
$numofrows = mysql_num_rows($result);
echo "No of rows".$numofrows;
echo "<br>";
echo "<table border='1'>
<tr>
<th>FirstName</th>
<th>Lastname</th>
<th>City</th>
<th>Mobile</th>
<th>email</th>
<th>pre_emp</th>
<th>Experience</th>
<th>Qualification</th>
<th>college</th>
<th>skill set</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['first_name'] . "</td>";
echo "<td>" . $row['last_name'] . "</td>";
echo "<td>" . $row['city'] . "</td>";
echo "<td>" . $row['mobile'] . "</td>";
echo "<td>" . $row['email1'] . "</td>";
echo "<td>" . $row['department'] . "</td>";
echo "<td>" . $row['Experience'] . "</td>";
echo "<td>" . $row['previous_employer'] . "</td>";
echo "<td>" . $row['college'] . "</td>";
echo "<td>" . $row['skillset'] . "</td>";
echo "</tr>";
}
echo "</TABLE>";
mysql_close($sqlConn);
?>
</div>

Find browser size

Find browser size

Here is the Best and simple way to find the users browser size

The screen size and browser size are different…
A perfect web developer has to fit his developed website to the use rs bowser and not his screen resolution
here is the script to find the users screen resolution .

Javascript to find browser size Just copy and paste in .html file

<script type="text/javascript">
function alertSize() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		myWidth = window.innerWidth;
                myHeight = window.innerHeight;
	} else if( document.documentElement &&
                 ( document.documentElement.clientWidth ||
                   document.documentElement.clientHeight ) ) {
		myWidth = document.documentElement.clientWidth;
                myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth ||
                   document.body.clientHeight ) ) {
		myWidth = document.body.clientWidth;
                myHeight = document.body.clientHeight;
	}
	window.alert( 'Width = ' + myWidth + ' and height = ' + myHeight );
}
</script>
<p>Test your screen size <a href="javascript:alertSize();">
Java script resolution</a></p>

Mozilla Firefox And Google chrome

Mozilla Firefox, Speed it up! Speed up Mozilla FireFox

1. Type “about :config” in the adress field.
2. Set the value of network.http.pipelining to “true”.
3. Set the value of network.http.pipelining.maxrequests to “100″.
4. Set the value of network.http.proxy.pipelining to “true”
5. Set the value of nglayout.initialpaint.delay to “0″ (not availible in newer versions)


GOOGLE CHROME
Get google chrome Advance memory details
Type about:memory in Address bar…

Read My Entire Blog on Google chrome secrets

Speed Up Internet

If you didn’t know, Windows, by default, uses 20% of your bandwidth. It reserves it for automatic updates, etc.

Go To Start > Run > Type in “gpedit.msc” > Click Ok
Now, the Group Policy Editor window should be open.
Go To – Local Computer Policy > Computer Configuration > Administrative Templates > Network > QOS Packet Scheduler > Limit Reservable Bandwidth
Double click on Limit Reservable Bandwidth.
Click Properties > Enable Reservable Bandwidth > Input “0? > Click OK
Now, you should get all of your bandwidth back!

Next Page »

Avance Zone