Oct 05
<script type=“text/javascript”>
function checking() {

if (document.form.pass.value ==”"){
alert (‘Enter password’);
document.form.pass.focus ();
return false;
}
if (document.form.pass1.value==”"){
alert (‘Enter Confirm password correct value’);
document.form.pass1.focus ();
return false;
}

var pw1 = document.form.pass.value;
var pw2 = document.form.pass1.value;
if (pw1 == ” || pw2 == ) {
alert (‘Please enter your password twice.’);
return false;
}
else if (pw1 != pw2) {
alert (“You did not enter the same new password twice. Please re-enter your password.”);
return false;
}
return true
}


</script>

written by admin \\ tags: , , , , , , , , , , , , , , , , , ,

Aug 14

Download this file And see examples….!

written by admin \\ tags: , , , , , , , ,

Jul 07

Image create   thumbel size &  uploading

==========================================================

<?php
$file=$_FILES['file']['name'];

if($file){
if ((($_FILES["file"]["type"] == “image/pjpeg)
|| ($_FILES["file"]["type"] == “image/jpeg”)))
{

$tmpName = $_FILES['file']['tmp_name'];
list ($width, $height, $type, $attr) = getimagesize ($tmpName);
$img=$_FILES["file"]["name"];
$rand=chr(rand(97,122)).chr(rand(97,122)).chr(rand(97,122)).chr(rand(97,122));
$target_path = “upload/”;
$target_path = $target_path . basename($file2= $rand.”_”.$_FILES['file']['name']);
if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
}
$save = ‘upload/’.$file2;
$file = ‘upload/’.$file2;
$size =$height/$width;
list($width, $height) = getimagesize($file) ;
$ck=$_REQUEST['file_set'];
if($ck==‘prop’){
$modwidth=204;
$modheight=204*$size;
}
elseif($ck==fix){
$modwidth=204;
$modheight=305;
}
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height);
imagejpeg($tn, $save, 100);
}
else{
echo ‘<script type=”text/javascript”>window.location.href=”member_info.php?file_err=1″</script>‘;
}
///////////////////
}
?>

written by admin \\ tags: , , , , , , , , , ,

Jun 01

Pop up window script in javasript

======================================================

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>

<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>pop</title><head>

<script type=“text/javascript”>

function myPopup2()
{
window.open( “http://www.haiderali.net/”, “myWindow”,
“status = 1, height = 400, width = 400, resizable = 0″
)
}

</script>
</head>

<body>

<form>
<input type=“button” onClick=“return myPopup2()” value=“POP2!”>
</form>

</body>

</html>

written by admin \\ tags: , , , , , , , , , , , , , ,

Jun 01

Email check alert box script

====================================================

<script language=“javascript”>

/**

* DHTML email validation script. Courtesy of  (Scriptshots)

*/

function echeck(str) {

var at=”@”

var dot=”.”

var lat=str.indexOf(at)

var lstr=str.length

var ldot=str.indexOf(dot)

if (str.indexOf(at)==-1){

alert(“Invalid E-mail ID”)

return false

}

if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

alert(“Invalid E-mail ID”)

return false

}

if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){

alert(“Invalid E-mail ID”)

return false

}

if (str.indexOf(at,(lat+1))!=-1){

alert(“Invalid E-mail ID”)

return false

}

if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

alert(“Invalid E-mail ID”)

return false

}

if (str.indexOf(dot,(lat+2))==-1){

alert(“Invalid E-mail ID”)

return false

}

if (str.indexOf(” “)!=-1){

alert(“Invalid E-mail ID”)

return false

}

return true

}

function ValidateForm(){

var emailID=document.frmSample.txtEmail

if ((emailID.value==null) || (emailID.value==”")){

alert(“Please Enter your Email ID”)

emailID.focus()

return false

}

if (echeck(emailID.value)==false){

emailID.value=”"

emailID.focus()

return false

}

return true

}

</script>

Enter an Email Address :

written by admin \\ tags: , , , , , , , , , , , , , , ,

May 31

Multi check box select script in Javascript

======================================================

<script type=“text/javascript”>

function Fill() {
if (document.form1.main.checked==true){
document.form1.checkbox.checked=true;
document.form1.checkbox2.checked=true;
document.form1.checkbox3.checked=true;
}else{
document.form1.checkbox.checked=false;
document.form1.checkbox2.checked=false;
document.form1.checkbox3.checked=false;
}
}

</script>
</head>

<body>
<form name=“form1″ method=“post” action=“”>

<input type=“checkbox” name=“main” onclick=“Fill();/>

<input type=“checkbox”  name=“checkbox”/>
<input type=“checkbox” name=“checkbox2″/>
<input type=“checkbox” name=“checkbox3″/>
</form>
</body>


For more impressive scripts

written by admin \\ tags: , , , , , , , , , , , , , ,

May 15

Date Validation script in php
================================================================

<?php
if ($_SERVER['REQUEST_METHOD'] == ‘POST’ && isset($_POST['date'])) {
if (preg_match(‘#^(\d{4})-(\d{2})-(\d{2})$#’, $_POST['date'], $matches) && checkdate($matches[2], $matches[3], $matches[1])) {
echo ‘<p>The date is <strong>valid</strong>!</p>’;
}
else {
echo ‘<p>The date is <strong>invalid</strong>!</p>’;
}

echo ‘<hr>’;
}
?>

<form action=<?php echo $_SERVER['PHP_SELF'] ?> method=“post”>
<label for=”date”>Enter an ISO 8601 date:</label>
<input type=“text” name=“date” id=“date”<?php if (!empty($_POST['date'])): ?> value=<?php echo htmlentities($_POST['date']) ?><?php endif ?>>
<button type=“submit”>Check validity</button>
</form>

written by admin \\ tags: , , , ,

May 14

This script use with captcha file.

file type is monofont

====================================================

<?php
session_start();

/*
* File: CaptchaSecurityImages.php
* Author: Simon Jarvis
* Copyright: 2006 Simon Jarvis
* Date: 03/08/06
* Updated: 07/02/07
* Requirements: PHP 4/5 with GD and FreeType libraries
* Link: http://www.white-hat-web-design.co.uk/articles/php-captcha.php
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
* http://www.gnu.org/licenses/gpl.html
*
*/

class CaptchaSecurityImages {

var $font = ‘monofont.ttf’;

function generateCode($characters) {
/* list all possible characters, similar looking characters and vowels have been removed */
$possible = ’23456789bcdfghjkmnpqrstvwxyz’;
$code =;
$i = 0;
while ($i < $characters) {
$code .= substr($possible, mt_rand(0, strlen($possible)-1), 1);
$i++;
}
return $code;
}

function CaptchaSecurityImages($width=’120′,$height=’40′,$characters=’6′) {
$code = $this->generateCode($characters);
/* font size will be 75% of the image height */
$font_size = $height * 0.75;
$image = @imagecreate($width, $height) or die(‘Cannot initialize new GD image stream’);
/* set the colours */
$background_color = imagecolorallocate($image, 255, 255, 255);
$text_color = imagecolorallocate($image, 93, 155, 223);
$noise_color = imagecolorallocate($image, 255, 255, 255);
/* generate random dots in background */
for( $i=0; $i<($width*$height)/3; $i++ ) {
imagefilledellipse($image, mt_rand(0,$width), mt_rand(0,$height), 1, 1, $noise_color);
}
/* generate random lines in background */
for( $i=0; $i<($width*$height)/150; $i++ ) {
imageline($image, mt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color);
}
/* create textbox and add text */
$textbox = imagettfbbox($font_size, 0, $this->font, $code) or die(Error in imagettfbbox function’);
$x = ($width - $textbox[4])/2;
$y = ($height - $textbox[5])/2;
imagettftext($image, $font_size, 5, $x, $y, $text_color, $this->font , $code) or die(‘Error in imagettftext function’);
/* output captcha image to browser */
header(‘Content-Type: image/jpeg’);
imagejpeg($image);
imagedestroy($image);
$_SESSION['security_code'] = $code;
}

}

$width = isset($_GET['width']) ? $_GET['width'] : ’120′;
$height = isset($_GET['height']) ? $_GET['height'] : ’40;
$characters = isset($_GET['characters']) && $_GET['characters'] > 1 ? $_GET['characters'] : ’6′;

$captcha = new CaptchaSecurityImages($width,$height,$characters);

?>

Download Monofont File



written by admin \\ tags: , , , , , ,

May 12

Age Calculator  Script in PHP

==============================================

<?php

if ( isset( $_POST["month"] ) )
{
$bmonth = intval( $_POST["month"] );
$bday = intval( $_POST["day"] );
$byear = intval( $_POST["year"] );

$date1 = time ();
$date2 = mktime ( 0, 0, 0, $bmonth, $bday, $byear );

$dateDiff = $date1 – $date2;
$fullDays = floor($dateDiff/(60*60*24));
$fullHours = floor(($dateDiff-($fullDays*60*60*24))/(60*60));
$fullMinutes = floor(($dateDiff-($fullDays*60*60*24)-($fullHours*60*60))/60);
$years = floor( $fullDays / 365 );
$months = ceil( $fullDays % 365 / 30 );

if ( $date2 == false )
{
$message = “ERORRE: Invalid birth date given; must be greater than 12/14/1901.”;
}
else if ( $years == 0 )
{
$message = “Your approximate age is $months month(s).”;
}
else
{
$message = “Your approximate age is ‘$years’ year(s) and ‘$months’ month(s).”;
}

echo ‘<span style=”color:#990000; font-weight:bold; font-size:14px; font-family:Verdana, Arial, Helvetica, sans-serif;”>’.”$message<br/>”.’</span>’;
}

?>

<form action=<?php echo $_SERVER["PHP_SELF"]; ?> method=“POST”>
<p><strong>Month:</strong>
<input type=“text” name=“month” size=“8″ maxlength=“2″ />
<strong>Day:</strong>
<input type=“text” name=“day” size=“8″ maxlength=“2″/>
<strong>Year:</strong>
<input type=“text” name=“year” size=“8″ maxlength=“4″/></p><br /><br />

<p style=”padding-left:80px;”>

<input type=“submit” value=“Calculate age!”/>

</p>
</form>


For more impressive scripts

written by admin \\ tags: , , , , , ,

May 08

This script only Type number in text feildes & textareas

=================================================

<script language=“javascript1.1″>

function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57)){
alert (“Type Only Number“);
return false;
}

return true;
}


</script>

<input type=“text” onkeypress=“return isNumberKey(event); />

<input type=“submit” name=“submit” value=“Save” />

written by admin \\ tags: , , , , , , , , ,

Copy right © ' Haider ali's Blog ' All resvred