Thursday, May 31, 2012

Creating a bus Image In PHP using Graphics


<?
$img=imagecreatetruecolor(600,600);
$grey=imagecolorallocate($img,200,191,191);
$brown=imagecolorallocate($img,152,50,50);

imagerectangle($img,245,155,516,253,$grey); //bus
imagerectangle($img,442,96,511,154,$grey); //top-square

imageline($img,244,172,516,172,$grey);
imageline($img,244,232,516,232,$white);

imagefilledrectangle($img,280,180,302,197,$grey); //window1
imagefilledrectangle($img,354,180,376,196,$grey); //window2
imagefilledrectangle($img,424,180,446,196,$grey); //window3

imagefilledellipse($img,295,275,50,50,$brown); //wheel left-outer
imagefilledellipse($img,295,275,20,17,$grey); //wheel left-inner
imagefilledellipse($img,440,280,50,50,$brown); //wheel right-outer
imagefilledellipse($img,440,280,20,17,$grey); //wheel right-inner

header('Content-Type:image/png');
imagePNG($img);
imagepng($img,"t4.png");
imagedestroy($img);
?>

Creating a circle image in PHP using Graphics


<?php 

// create a 200*200 image 
$img = imagecreate(200, 200); 
  
// allocate some colors 
$white = imagecolorallocate($img, 255, 255, 255); 
  
// draw a white circle 
imagearc($img, 100, 100, 150, 150, 0, 360, $white); 

// output image in the browser 
header("Content-type: image/png"); 
imagepng($img); 
  
// free memory 
imagedestroy($img); 

?>

Saturday, May 26, 2012

Creating a Table and Inserting values in table (JAVA)




import java.sql.*;
import java.io.*;
class CreateTable
{
public static void main(String args[])
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc:odbc:coll");
                                   Statement stmt=conn.createStatement();
      stmt.executeUpdate("create table student1(rno INTEGER primary key,name VARCHAR,per FLOAT)");
System.out.println("Table created");

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the roll number");
int r = Integer.parseInt(br.readLine());
System.out.println("Enter name");
String name = br.readLine();
System.out.println("Enter per ");
double per=Double.parseDouble(br.readLine());
stmt.executeUpdate("insert into student1 values("+r+",' "+name+" ',"+per+")");
System.out.println("Record Inserted..");
stmt.close();
conn.close();
}
catch(Exception e){System.out.println(e.toString());}
}
}


Thursday, May 24, 2012

To Count the Number of Vowels (PHP)


<?php

$s=$_POST['str'];

$cnt=0;

for($i=0;$i<strlen($s);$i++)
{

if($s[$i]=="a" || $s[$i]=="e" || $s[$i]=="i" || $s[$i]=="o" || $s[$i]=="u")
{
echo "<br>".$s[$i];
$cnt++;
}

}
"<br>"."No of vowels :  ";
echo $cnt;


/*
echo $_POST['nm'];
$class = $_POST['class'];

echo $class;
*/
?>


Wednesday, May 23, 2012

Factorial (JAVA)


class Factorial
{
public static void main(String arg[])
{
if (arg.length!=1)
System.out.print("Invalid");
else
{
int n=Integer.parseInt(arg[0]);
int fact=1;
while(n>0)
{
fact=fact * n;
n--;
}
System.out.print("Factorial="+fact);
}
}
}

Sunday, May 20, 2012

Display Links in Attractive manner using CSS in your web pages.



<html>
<head>
<style type="text/css">
a:link {color:#FF0000;}    /* unvisited link */
a:visited {color:#00FF00;} /* visited link */
a:hover {color:#FF00FF;}   /* mouse over link */
a:active {color:#0000FF;}  /* selected link */
</style>
</head>

To play videos in your web pages (Video Tag)

<video width="320" height="240" controls="controls">
  <source src="movie.mp4" type="video/mp4" />
  <source src="movie.ogg" type="video/ogg" />
  <source src="movie.webm" type="video/webm" />
<object data="movie.mp4" width="320" height="240">
  <embed src="movie.swf" width="320" height="240" />
</object> 
</video>


Accepting Input from user and Retrieving data from database


/*index.jsp*/


<HTML>
    <HEAD>
        <TITLE>Database Lookup</TITLE>
    </HEAD>

    <BODY>
        <H1>Database Lookup</H1>
        <FORM ACTION="basic.jsp" METHOD="POST">
            Please enter the ID of the publisher you want to find:
            <BR>
            <INPUT TYPE="TEXT" NAME="id">
            <BR>
            <INPUT TYPE="SUBMIT" value="Submit">
        </FORM>
    </BODY>
<HTML>

/*basic.jsp*/


<%@ page import="java.sql.*" %>
<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); %>

<HTML>
    <HEAD>
        <TITLE>Fetching Data From a Database</TITLE>
    </HEAD>

    <BODY>
        <H1>Fetching Data From a Database</H1>

        <%
            Connection connection = DriverManager.getConnection(
                "jdbc:odbc:data", "YourName", "password");

            Statement statement = connection.createStatement();

            String id = request.getParameter("id");

            ResultSet resultset =
                statement.executeQuery("select * from Publishers where pub_id = '" + id + "'") ;

            if(!resultset.next()) {
                out.println("Sorry, could not find that publisher. ");
            } else {
        %>

        <TABLE BORDER="1">
            <TR>
               <TH>ID</TH>
               <TH>Name</TH>
               <TH>City</TH>
               <TH>State</TH>
               <TH>Country</TH>
           </TR>
           <TR>
               <TD> <%= resultset.getString(1) %> </TD>
               <TD> <%= resultset.getString(2) %> </TD>
               <TD> <%= resultset.getString(3) %> </TD>
               <TD> <%= resultset.getString(4) %> </TD>
               <TD> <%= resultset.getString(5) %> </TD>
           </TR>
       </TABLE>
       <BR>
       <%
           }
       %>
    </BODY>
</HTML>


Fetching whole data from the Database Using JSP (JAVA)


<%@ page import="java.sql.*" %>

<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); %>

<HTML>
    <HEAD>
        <TITLE>The Publishers Database Table </TITLE>
    </HEAD>

    <BODY>
        <H1>The Publishers Database Table </H1>

        <%
            Connection connection = DriverManager.getConnection(
                "jdbc:odbc:data", "userName", "password");

            Statement statement = connection.createStatement() ;
            ResultSet resultset = statement.executeQuery("select * from Publishers") ;
        %>

        <TABLE BORDER="1">
            <TR>
                <TH>ID</TH>
                <TH>Name</TH>
                <TH>City</TH>
                <TH>State</TH>
                <TH>Country</TH>
            </TR>
            <% while(resultset.next()){ %>
            <TR>
                <TD> <%= resultset.getString(1) %></td>
                <TD> <%= resultset.getString(2) %></TD>
                <TD> <%= resultset.getString(3) %></TD>
                <TD> <%= resultset.getString(4) %></TD>
                <TD> <%= resultset.getString(5) %></TD>
            </TR>
            <% } %>
        </TABLE>
    </BODY>
</HTML>

Accesing Database Table using JSP (JAVA)


<%@ page import="java.sql.*" %>
<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ; %>

<HTML>
    <HEAD>
        <TITLE>Accessing the Publishers Database Table</TITLE>
    </HEAD>

    <BODY>

        <H1>Accessing the Publishers Database Table</H1>


        <%
            Connection connection = DriverManager.getConnection(
                "jdbc:odbc:data", "UserName", "password");

                Statement statement = connection.createStatement() ;
                ResultSet resultset = statement.executeQuery("select pub_name from Publishers") ;
        %>

        <TABLE BORDER="1">
            <TR>
                <TH>Name</TH>
            </TR>
            <% while(resultset.next()){ %>
                <TR>
                    <TD>
                        <%= resultset.getString(1)%>
                    </TD>
                </TR>
            <% } %>
        </TABLE>
    </BODY>
</HTML>

Saturday, May 19, 2012

Program name: write a PHP script: Given a flat file of student information student no, name, mark I, mark II, mark III. Read this file and print the mark list in tabular form. Mark list will contain Student no, Name, Mark I, Mark II, Mark III and percentage for all students(PHP)


<?php

if(file_exists("stud_1.dat"))
{
$fp = fopen("stud_1.dat","r");

if(!$fp)
echo "File opening Error";
else
{
$buf = fread($fp,filesize("stud_1.dat"));
$tempercs = explode("\n",$buf);
$i = 0;

       //echo $buf;
foreach($tempercs as $t)
if(strlen($t)>0)
$records[$i++] = explode(" ",$t);

echo "<p>************* Student Name ***************</p>";
echo "<table border=2>";
echo "<tr><th> Roll No </th><th> Name </th>
<th> Mark I </th>
<th> Mark II </th>
<th> Mark III </th>
<th> Percentage </th></tr>";



foreach($records as $rec)
{
//print_r($rec);
echo "<tr>";
$k = 1;
$tot = 0;
foreach($rec as $f)
{
printf("<td>%s</td>",$f);
$k++;


if($k>3)
$tot = $tot + $f;
}
$ptage = ($tot/3.0);
printf("<td>%2f</td></tr>",$ptage);
}
echo "<table>";
fclose($fp);
}

}
else
{
echo "Not Exist";
}
?>



Assembler (System Programming)


// Program  : Assembler


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 50
struct symtab
{
char name[20];
int addr,len,value,used,dcl;
}SYM[MAX];

char symtab[][5]={"STOP","ADD","SUB","MUL","MOVER","MOVEM","COMP","BC","DIV","READ","PRINT"};
char directive[][10]={"START","END","ORIGIN","EQU"};
char regtab[][10]={"","AREG","BREG","CREG","DREG"};
char condtab[][5]={"LT","LE","EQ","GT","GE","ANY"};

int symbcnt,pc,tokcnt;
char srcfile[MAX],tok1[MAX],tok2[MAX],tok3[MAX],tok4[MAX],buffer[80];
FILE *fp;

int searchop(char *str)
{
int l;
for(l=0;l<11;l++)
{
if(strcmp(symtab[l],str)==0)
return l;
}
return -l;
}

int searchdir(char *str)
{
int l;
for(l=0;l<4;l++)
{
if(strcmp(directive[l],str)==0)
return l;
}
return -1;

}

int searchsymb(char *str)
{
int l;
for(l=0;l<=symbcnt;l++)
{
if(strcmp(SYM[l].name,str)==0)
return l;
}
return -l;
}

void DispSymtab()
{
int l;
for(l=0;l<symbcnt;l++)
{
if(SYM[l].used==0 && SYM[l].dcl==1)
printf("\n Symbol %s declared but not used",SYM[l].name);
if(SYM[l].used==1 &&SYM[l].dcl==0)
printf("\n Symbol %s used but not declared",SYM[l].name);

}
}

//int main(int argc,char *argv[])
//{
void main()
{
clrscr();
/*if(argc!=2)
{
printf("Wrong input\n");
exit(1);
}
strcpy(srcfile,argv[1]);
*/
pass1();
DispSymtab();
getch();
// return 0;
}



 pass1()
{
int i,j,k;
printf("Enter File Name");
scanf("%s",srcfile);
//puts(srcfile);
fp=fopen(srcfile,"r");
if(fp==NULL)
{
printf("File does not exist");
exit(0);
}
while(fgets(buffer,80,fp))
{
tokcnt=sscanf(buffer,"%s%s%s%s",tok1,tok2,tok3,tok4);
       // printf("%d",tokcnt);
switch(tokcnt)
{
case 2:
i=searchop(tok1);
if(i==9||i==10)
{
j=searchsymb(tok2);
if(j==-1)
{
strcpy(SYM[symbcnt].name,tok2);
SYM[symbcnt++].used=1;
}
else
SYM[j].used=1;
break;
}
i=searchdir(tok1);
if(i==0||i==2)
{
pc=atoi(tok2)-1;
}
else
{
i=searchop(tok2);
if(i==0)
{
j=searchsymb(tok1);
if(j==-1)
{
strcpy(SYM[symbcnt].name,tok1);
SYM[symbcnt].addr=pc;
SYM[symbcnt].value=0;
SYM[symbcnt].dcl=1;
SYM[symbcnt++].len=0;
}
else
{
if(SYM[j].dcl==1)
printf("\n Error at line %d:redeclaration of symbol:%s",pc,tok1);
else
{
SYM[j].addr=pc;
SYM[j].value=0;
SYM[j].dcl=1;
SYM[j].len=0;
}//else

} //else

}//if

}//else
break;
case 3:
     i=searchop(tok1);
     if(i>=1&&i<=8)
     {
j=searchsymb(tok3);
if(j==-1)
{
strcpy(SYM[symbcnt].name,tok3);
SYM[symbcnt++].used=1;

}//if
else
SYM[j].used=1;


     } //if
     else if(strcmp(tok2,"DC")==0)
     {
j=searchsymb(tok1);
if(j==-1)
{
strcpy(SYM[symbcnt].name,tok1);
SYM[symbcnt].addr=pc;
SYM[symbcnt].value=atoi(tok3);
SYM[symbcnt].dcl=1;
SYM[symbcnt++].len=1;
}
else
{
if(SYM[j].dcl==1)
{
printf("\nError at line %d :redeclaration of symb %s",pc,tok1);
}
else
{
SYM[j].addr=pc;
SYM[j].value=atoi(tok3);
SYM[j].dcl=1;
SYM[j].len=1;
}//else
}//else

     } //else if
     else if(strcmp(tok2,"DS")==0)
     {
j=searchsymb(tok1);
if(j==-1)
{
strcpy(SYM[symbcnt].name,tok1);
SYM[symbcnt].addr=pc;
SYM[symbcnt].value=atoi(tok3);
SYM[symbcnt].dcl=1;
SYM[symbcnt++].len=atoi(tok3);
}
else
{
if(SYM[j].dcl==1)
{
printf("\nError at line %d :redeclaration of symb %s",pc,tok1);
}
else
{
SYM[j].addr=pc;
SYM[j].value=0;
SYM[j].dcl=1;
SYM[j].len=atoi(tok3);
}//else
}//else
pc+=atoi(tok3)-1;
     }//else if
     else
     {
j=searchsymb(tok1);
if(j==-1)
{
strcpy(SYM[symbcnt].name,tok1);
SYM[symbcnt].addr=pc;
SYM[symbcnt].value=0;
SYM[symbcnt].dcl=1;
SYM[symbcnt++].len=0;
} //if
else
{       if(SYM[j].dcl==1)
printf("\n Error at line %d:redeclaration of symbol:%s",pc,tok1);
else
{
SYM[j].addr=pc;
SYM[j].value=0;
SYM[j].dcl=1;
SYM[j].len=0;
}//else
}//else
i=searchop(tok2);
if(i==9 || i==10)
{
j=searchsymb(tok3);
if(j==-1)
{
strcpy(SYM[symbcnt].name,tok3);
SYM[symbcnt++].used=1;
}
else
SYM[j].used=1;
}//if

     }//if
     break;
case 4:
j=searchsymb(tok1);
if(j==-1)
{
strcpy(SYM[symbcnt].name,tok1) ;
SYM[symbcnt].addr=pc;
SYM[symbcnt].value=0;
SYM[symbcnt].dcl=1;
SYM[symbcnt].len=0;
}//if
else
{
      if(SYM[j].dcl==1)
      printf("\n Error at line %d:redeclaration of symbol:%s",pc,tok1);
      else
      {
SYM[j].addr=pc;
SYM[j].value=0;
SYM[j].dcl=1;
SYM[j].len=0;
}//else
}//else
i=searchop(tok2);
if(i>=1 && i<=8)
{
j=searchsymb(tok4);
if(j==-1)
{
strcpy(SYM[symbcnt].name,tok4);
SYM[symbcnt++].used=1;
}
else
SYM[j].used=1;
}
break;

}//switch


}//while
 return 0;
}//pass1

/* OUTPUT   


START 100,2
READ A
MOVER A,AREG
BDD AREG,A
A MOVEM AREG,'=2'
STOP
x DS 1
y DS 1
END

START 100
READ A
B MOVER BREG,A
ADD BREG,A
A MOVEM AREG,Z
STOP
A DS 1
B DS 1
END

Enter File Namec:\neel\ass2.txt

Error at line 99 :redeclaration of symb A
Error at line 99 :redeclaration of symb B

Enter File Name c:\neel\ass3.txt

Error at line 99 :redeclaration of symb y

*/


??

??

??

??




1


??

??

??

??




2


Generating a circle in PHP (GRAPHICS)


<?php 


// create a 200*200 image 
$img = imagecreate(200, 200); 
  
// allocate some colors 
$white = imagecolorallocate($img, 255, 255, 255); 
  
// draw a white circle 
imagearc($img, 100, 100, 150, 150, 0, 360, $white); 


// output image in the browser 
header("Content-type: image/png"); 
imagepng($img); 
  
// free memory 
imagedestroy($img);

Sending Mail in PHP


<?php


$to = $_POST['to'];
$sub = $_POST['sub'];
$msg = $_POST['msg'];
$header = "From: chinmay_youthmail@yahoo.co.in";
$report = mail($to,$sub,$msg,$header);


if($report)
{
echo "Mail transfered successfully.......";
}
else
{
echo "There is error in sending mail....";
}
?>

User Tracking


<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-31891737-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

Creating Frame using SWING( JAVA)


/* EXTENDING THE FRAME CLASS */

import javax.swing.*;
import java.awt.event.*;

class MyFrame extends JFrame implements ActionListener
{
JButton btnExit;

public MyFrame()
{
super("My Third Window...");

btnExit = new JButton("Exit");
add(btnExit);
btnExit.addActionListener(this);

setSize(400, 400);
setVisible(true);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

public void actionPerformed(ActionEvent ae)
{
System.exit(0);
}
}

public class SwingFrame
{
public static void main(String[] args)
{
MyFrame mf = new MyFrame();
}
}

Friday, May 18, 2012

Array Factorial (JAVA)


class arrayfact
{
    public static void main(String arg[])
    { int a[] = new int[arg.length];
      int i, f , n;
      for(i = 0 ; i < arg.length ; i++)
          a[i] = Integer.parseInt(arg[i]);
    for(i = 0  ; i < arg.length ; i++)
    {  n = a[i];
       for(f = 1 ; n > 1 ; n--)
             f = f*n;
       System.out.println("No : "+a[i]+" Factorial is " +f);
     }
   }
}

Simple Arithematic Operations in JAVA


import java.io.*;
class arith
{   public static void main(String arg[]) throws IOException
    {     int a,b,c;
          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          a = Integer.parseInt(br.readLine());
          b = Integer.parseInt(br.readLine());
          c = a+b;
          System.out.println("Addition is " +c);
          c = a-b;
         System.out.println("Substraction is " +c);
          c = a*b;
       System.out.println("Multiplication is " +c);
          c = a/b;
         System.out.println("Division is " +c);
          c = a%b;
          System.out.println("Modulus is " +c);
     }
}

Armstrong number (JAVA)


class armstrong
{    public static void main(String args[])
     {     int n , n1, rem , sum;
           n = Integer.parseInt(args[0]);
           n1 = n;
           for(sum = 0 ; n > 0 ; n = n/10)
           {    rem = n %10;
                sum = sum + (rem*rem*rem);                    
          }
           if(n1 == sum)
              System.out.println(n1 + " is Armstrong");
           else
                System.out.println(n1 + " is not Armstrong");
      }
}

VALIDATIONS in JAVASCRIPT


<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.lang.*"%>
<%! static int temp=0;%>
<%
try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection cn=DriverManager.getConnection("jdbc:odbc:database");
Statement stat = cn.createStatement();
ResultSet rs  = stat.executeQuery("select max(form_no) from hostel");


   while(rs.next())
  {
 
  temp=rs.getInt(1);
  temp=temp+1;
     
  }
       stat.close();
      rs.close();
      cn.close();

}
catch(Exception e)
{
}
%>

<%%>


<html>
<!-- CSS -->


<style type="text/css">
a{text-decoration:none}
a:hover{background-color:#cfd2d7;}
a:link{color:purple}
a:visited{color:purple;}
a:active{color:orange;}




p.serif{font-family:"Times New Roman",Times,serif;}
p.sansserif{font-family:Arial,Helvetica,sans-serif;}
</style>

<body>
<!-- Page starts -->


<!--Main table -->

<table border=1 bgcolor=skyblue height=730 width="750">

<tr>
<td>

<table BORDER=1  bgcolor=white background=  height=130 width=750>

<tr>
<td>
<!--sub Main table --><table  height=100 width=750>
<tr>

<td align="left">
<img src="images\fule.jpg" height="100" width="100">
</td>
<td width="550" align="center" >  <font face="Verdana" color=teal size="8"><b> Pune University</b></font><br><br> <font face="papyrus" color="brown" size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>Oxford of the East..  </td>



<td align="right"> </font>
<img src="images\sav.jpg" height="100" width="100">
</td>


</tr>
<!--Main table --></table>
</td>
</tr>

<tr>
<td>
<table border=1 background="images\bckg1.png" align="center"height="30" width="750">
<tr>
<td  align=center> <a href="index.html">  <font face="calibri" size="5">Home </font> </td>
<td  align=center> <a href="aboutuni.html">  <font face="calibri" size="5">              About university</td>
<td  align=center> <a href="academic.html">  <font face="calibri" size="5">   Academic </td>
<td  align=center> <a href="administration.html">  <font face="calibri" size="5">   Administration </td>
<td  align=center> <a href="feedback.jsp">  <font face="calibri" size="5">   Feedback </td>
<td  align=center> <a href="contact.html">  <font face="calibri" size="5">   Contact</td>
<td  align=center> <a href="admin.html">  <font face="calibri" size="5">   Admin </td>


</tr>

</table>


</td>
</tr>
</table>

</td>
</tr>



<tr>
<td>
<table border=1  bgcolor=skyblue height=150 width=750>
<tr>
<td  width=200>

<table border=1 background="images\bckg1.png" height=150 width=200>
<tr>
<td   align=center> <a href="distancelearning.html"> <font face="calibri" size="5"> Distance learning</font>     </td> </tr>
<tr><td  align=center> <a href="career.html">   <font face="calibri" size="5">    Career </td></tr>
<tr><td  align=center> <a href="studentCorner.html">   <font face="calibri" size="5">     Student Corner </td></tr>
<tr><td  align=center> <a href="hostel.jsp">   <font face="calibri" size="5">     Hostel </td>
</tr>
</table>
</td>

<td align=center height=150 width=400 background=>
<img src="images\hb.jpg" height=150 width=400>
</td>

<td align="center" height=150 width="150" >

<img src="images\gy.jpg" height="150" width="140">

</td>

</tr>
</table>



</td>
</tr>


<tr>
<td align="center">

<li><font face="calibri" size="5"><b>  Hostel Information : - <a href ="images\pdf\hostelinfo.pdf">   CLICK HERE </a><br><br>
<li>Hostel Rules :- <a href="images\pdf\hostelr.pdf"> CLICK HERE </a><br><br>
<li>Hostel Fees :- <a href="images\pdf\hostelf.pdf">  CLICK HERE </a><br><br>
<font face="calibri" size="4">if you accept terms and conditions then only fill the form<br><br>
</td>
</tr>


<tr>
<td align=left bgcolor=skyblue>


<form action="http://localhost:8080/hostel1.jsp" method="post" name="hf" onsubmit="return validateForm()">



<table  align="left" width="100%" border=0 cellspacing="0" cellpadding="0">

<tr>
<td bgcolor="#EFFCFC" align="center"><font face="calibri" color="teal" size="6">
HOSTEL ADMISSION FORM</font></td></tr>


<tr><td align=center> <br><br><img src="images\man1.jpg" height=10 width=10><font face="calibri" color="brown" size="3"> &nbsp;&nbsp;<b>marked options are mandatory</b></td>
</tr>


<tr>
<td bgcolor=skyblue colspan=100%>

<br><br><table align="left" border=0 cellspacing="0" cellpadding="0" width="600" >

<tr>

<td align="right"> <font face="calibri" color=gray><b> Form No. :
 <b></td>
<td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="fn" size=1 value=<%=temp%>> </td>

</tr>

<tr>
<td>&nbsp;<td>
</tr>


<tr>

<td align="right"> <font face="calibri"><b> First Name :
<img src="images\man1.jpg" height=10 width=10> <b></td>
<td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="fname" size=20 title="Enter your First name"> </td>

</tr>

<tr>
<td>&nbsp;<td>
</tr>



<tr>
<td align="right"> <font face="calibri"><b> Last Name :<img src="images\man1.jpg" height=10 width=10> </b></td>
<td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="lname" size=20 title="Enter your Last name"> </td>

</tr>

<tr>
<td >&nbsp;<td>
</tr>

<tr>
<td align="right"><font face="calibri"> <b>Gender :<img src="images\man1.jpg" height=10 width=10> </b></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" name="gender" value="Male" /> Male
<input type="radio" name="gender" value="Female" /> Female
</td>
</tr>

<tr>
<td>&nbsp;<td>
</tr>




<tr>
<td align="right"> <font face="calibri"> <b>D.O.B :<img src="images\man1.jpg" height=10 width=10> </b></td>
<td> &nbsp;&nbsp;
<select name="d"> <option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option><option>9</option><option>10</option><option>11</option><option>12</option><option>13</option><option>14</option><option>15</option><option>16</option><option>17</option><option>18</option><option>19</option><option>20</option><option>21</option><option>22</option><option>23</option><option>24</option><option>25</option><option>26</option><option>27</option><option>28</option><option>29</option><option>30</option><option>31</option> </select> &nbsp;
<select name="m"> <option>jan</option><option>feb</option><option>mar</option><option>apr</option><option>may</option><option>jun</option><option>july</option><option>aug</option><option>sep</option></option><option>oct</option></option><option>nov</option></option><option>dec</option> </select>&nbsp;
<select name="y"> <option>1992</option><option>1991</option><option>1990</option><option>1989</option><option>1988</option><option>1987</option><option>1986</option><option>1985</option><option>1984</option></option><option>1983</option></option><option>1982</option></option><option>1981</option> </select>
</tr>

<tr>
<td >&nbsp;<td>
</tr>








<tr>
<td align="right"> <font face="calibri"> <b>Contact Number :<img src="images\man1.jpg" height=10 width=10> </b></td>
<td> &nbsp;&nbsp;+91-
<input type="text" name="cnum" size=20 maxlength="10" title="Enter your Contact Number">     &nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;(only 10 Digit) </td>
</tr>

<tr>
<td >&nbsp;<td>
</tr>

<tr>
<td align="right"> <font face="calibri"> <b>Landline Number : </b></td>
<td> &nbsp;&nbsp;+91-<input type="text" name="lnum" size=20 title="Enter your Landline Number"><br> </td>
</tr>


<tr>
<td >&nbsp;<td>
</tr>


<tr>
<td align="right"> <font face="calibri"> <b>Permanent Address :<img src="images\man1.jpg" height=10 width=10> </b></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<textarea name="padd" value="padd" style="scrollbar-arrow-color:yellow;
                 scrollbar-base-color:skyblue;
                 scrollbar-darkshadow-color:blue;
                 scrollbar-highlightcolor:yellow;
                 scrollbar-shadow-color:blue" rows="3" cols="20" title="Enter your Permanent Address">
 </textarea></td>
</tr>

<tr>
<td>&nbsp;<td>
</tr>


<tr>
<td align="right"> <font face="calibri"><b> City :<img src="images\man1.jpg" height=10 width=10> </b></td>
<td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="city" size=20 title="Enter your City"> </td>

</tr>

<tr>
<td>&nbsp;<td>
</tr>

<tr>
<td align="right"> <font face="calibri"><b> State :<img src="images\man1.jpg" height=10 width=10> </b></td>
<td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="state"  size=20 title="Enter your state"> </td>

</tr>



<tr>
<td >&nbsp;<td>
</tr>

<tr>
<td align="right"> <font face="calibri"> <b>why do u need hostel? :<img src="images\man1.jpg" height=10 width=10> </b></td>
<td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<textarea name="terms" style="scrollbar-arrow-color:yellow;
                 scrollbar-base-color:skyblue;
                 scrollbar-darkshadow-color:blue;
                 scrollbar-highlightcolor:yellow;
                 scrollbar-shadow-color:blue" rows="3" cols="20" title="Enter the details why do you need hostel">


</textarea></td>
</tr>

<tr>
<td>&nbsp;<td>
</tr>

<tr>

<td align=right colspan=100%><input type="checkbox" name="chkbox">I accept the terms and conditions.</td>

</tr>

<tr>
<td>&nbsp;<td>
</tr>

<tr>
<td align="right"> <input type="submit" value="submit" title="Click here to submit the form"></td>
<td align="center"> <input type="reset" name="reset" title="Click here to Clear the form"> </font>
</td>
</tr>
</table>
</td>
</tr>



</table>

</form>




</td>

</tr>



<!-- Footer -->


<tr>
<td>



<table  border=0 background="images\c.jpg" height=50 width=760>

<tr>
<td align=center colspan=95%>

<table border=0   align="center"height="30" width="300">
<tr>
<td  align=center> <a href="index.html">  <font face="calibri"  size="2"> Home|</font></td>
<td  align=center> <a href="aboutuni.html">  <font face="calibri" size="2">                   About Us|</td>
<td  align=center> <a href="feedback.jsp">  <font face="calibri" size="2">                   Feedback| </td>
<td  align=center> <a href="contact.html">  <font face="calibri" size="2">                   Contac Us| </td>
<td  align=center> <a href="admin.html">  <font face="calibri" size="2">                  Admin </td>
</tr>

</table>
<font face="papyrus" size="2" color="purple">All rights are reserved @ <a href="index.html"><font face="calibri" size="1" color=#EFFCFC>&nbsp; WWW.UNIPUNE.COM</font></a>

</td>

<td align=right colspan=5%>
powered by <a href="powered.html"> <img src="images\log.jpg" height="30" width="30">
</td>
</tr>
</table>

</td>
</tr>

</table>
<!--Main table Closed -->
</body>

<!--VALIDATION PART-->

<script language="javascript">

function validateForm()
{
var x=document.forms["hf"]["fname"].value;
if (x==null || x=="")
  {
  alert("First name must be filled out");
document.forms["hf"]["fname"].focus();
  return false;
  }

var x=document.forms["hf"]["lname"].value;
if (x==null || x=="")
 {
  alert("Last name must be filled out");
document.forms["hf"]["lname"].focus();
  return false;
  }


  var x = document.forms["hf"]["cnum"].value;
        if(isNaN(x)|| x.indexOf(" ")!=-1)
{
              alert("Enter numeric value");
document.forms["hf"]["cnum"].focus();
return (false);

               }

       if (x.charAt(0)!="9")
{
                alert("Enter the number and it should start with 9");
       document.forms["hf"]["cnum"].focus();
                return (false);
                 }



  var x = document.forms["hf"]["lnum"].value;
        if(isNaN(x)|| x.indexOf(" ")!=-1)
{
              alert("Enter numeric value");
document.forms["hf"]["lnum"].focus();
return (false);

               }

       if (x.charAt(0)!="0")
{
                alert("code must be specified ");
document.forms["hf"]["lnum"].focus();
                return (false);
                 }




var x=document.forms["hf"]["padd"].value;
if (x==null || x=="")
  {
  alert("Address must be filled out");
document.forms["hf"]["padd"].focus();
  return false;
  }


var x=document.forms["hf"]["city"].value;
if (x==null || x=="")
  {
  alert(" name of the city must be filled out");
document.forms["hf"]["city"].focus();
  return false;
  }

var x=document.forms["hf"]["state"].value;
if (x==null || x=="")
  {
  alert(" name of the state must be filled out");
document.forms["hf"]["state"].focus();
  return false;
  }
var x=document.forms["hf"]["terms"].value;
if (x==null || x=="")
  {
  alert(" reason must be filled out");
document.forms["hf"]["terms"].focus();
  return false;
  }

if(document.hf.chkbox.checked==false)
{
 
  alert("you havn't accepted the terms and condition");
  return false;
  }

var qry= confirm ( "Are you sure you want to submit the form?");

if (!qry)
{
return false;

//document.write ("The form is submited sucessfully");
}


}

</script>
</html>








Login Screen build in HTML with CSS effects connectivity with JSP and Validation with JAVASCRIPT




<html>
<body>
<style type="text/css">
a{text-decoration:none}
a:hover{background-color:#cfd2d7;}
a:link{color:purple}
a:visited{color:purple;}
a:active{color:orange;}






p.serif{font-family:"Times New Roman",Times,serif;}
p.sansserif{font-family:Arial,Helvetica,sans-serif;}
</style>


<!-- Page starts -->


<!--Main table -->



<table border=1 bgcolor=skyblue height=730 width="750">


<tr>
<td>
<table BORDER=1  bgcolor=white background=  height=130 width=750>


<tr>
<td>
<!--sub Main table --><table  height=100 width=750>
<tr>


<td align="left">
<img src="images\fule.jpg" height="100" width="100">
</td>
<td width="550" align="center" >  <font face="Verdana" color=teal size="8"><b> Pune University</b></font><br><br> <font face="papyrus" color="brown" size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <b>Oxford of the East..  </td>





<td align="right"> </font>
<img src="images\sav.jpg" height="100" width="100">
</td>




</tr>
<!--Main table --></table>
</td>
</tr>


<tr>
<td>
<table border=1 background="images\bckg1.png" align="left"height="30" width="750">
<tr>
<td  align=center> <a href="index.html">  <font face="calibri" size="5">Home </font> </td>
<td  align=center> <a href="aboutuni.html">  <font face="calibri" size="5">              About university</td>
<td  align=center> <a href="academic.html">  <font face="calibri" size="5">   Academic </td>
<td  align=center> <a href="administration.html">  <font face="calibri" size="5">   Administration </td>
<td  align=center> <a href="feedback.jsp">  <font face="calibri" size="5">   Feedback </td>
<td  align=center> <a href="contact.html">  <font face="calibri" size="5">   Contact</td>
<td  align=center> <a href="admin.html">  <font face="calibri" size="5">   Admin </td>




</tr>


</table>



</td>
</tr>
</table>


</td>
</tr>






<tr>
<td>
<table border=1  bgcolor=skyblue height=150 width=750>
<tr>
<td  width=200>


<table border=1 background="images\bckg1.png" height=150 width=200>
<tr>
<td   align=center> <a href="distancelearning.html"> <font face="calibri" size="5"> Distance learning</font>     </td> </tr>
<tr><td  align=center> <a href="career.html">   <font face="calibri" size="5">    Career </td></tr>
<tr><td  align=center> <a href="studentCorner.html">   <font face="calibri" size="5">     Student Corner </td></tr>
<tr><td  align=center> <a href="hostel.jsp">   <font face="calibri" size="5">     Hostel </td>
</tr>
</table>
</td>




<td align=center height=150 width=400 background=>
<img src="images\admi.jpg" height=150 width=400>








</td>
<td align="center" height=150 width="150" >


<img src="images\savarkar.jpg" height="150" width="140">


</table>


</td>


</tr>





</td>
</tr>
<form action="http://localhost:8080/admin.jsp" name="admin" method="post" onsubmit="return validateForm()">


<tr>
<td bgcolor="#EFFCFC" align="center"><font face="calibri" color="teal" size="6">
ADMIN</font><td>
</tr>
<tr>
<td align=center height=400>
<table align=center border=0>




<tr>


<td align="right"> <font face="calibri"><b>Username : <b></td>
<td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="uname" size=20 title="Enter Username">   </td>

</tr>

<tr>
<td>&nbsp;<td>
</tr>





<tr>
<td align="right"> <font face="calibri"><b> Password : </b></td>
<td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="password" name="pwd" size=20 title="Enter your password"> </td>

</tr>
 





<tr>
<td>&nbsp;</td>
</tr>




<tr>

<td>&nbsp;</td>
<td align="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" title="Click here to submit" value="Login">&nbsp;&nbsp;&nbsp; <input type="reset" title="Click here to clear" value="clear"></td>

 </td>


</tr>
</form>
</table>


</td>
</tr>






<!-- Footer -->




<tr>
<td>



<table  border=0 background="images\c.jpg" height=50 width=760>


<tr>
<td align=center colspan=95%>


<table border=0   align="center"height="30" width="300">
<tr>
<td  align=center> <a href="index.html">  <font face="calibri"  size="2"> Home|</font></td>
<td  align=center> <a href="aboutuni.html">  <font face="calibri" size="2">                   About Us|</td>
<td  align=center> <a href="feedback.jsp">  <font face="calibri" size="2">                   Feedback| </td>
<td  align=center> <a href="contact.html">  <font face="calibri" size="2">                   Contac Us| </td>
<td  align=center> <a href="admin.html">  <font face="calibri" size="2">                  Admin </td>
</tr>


</table>
<font face="papyrus" size="2" color="purple">All rights are reserved @ <a href="index.html"><font face="calibri" size="1" color=#EFFCFC>&nbsp; WWW.UNIPUNE.COM</font></a>


</td>


<td align=right colspan=5%>
powered by <a href="powered.html"> <img src="images\log.jpg" height="30" width="30">
</td>
</tr>
</table>


</td>
</tr>


</table>
<!--Main table Closed -->
</body>






<script language="javascript">


function validateForm()
{
var x=document.forms["admin"]["uname"].value;
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
 {
 alert("Incorrect Username");
document.forms["admin"]["uname"].focus();
 return false;
 }



var x=document.forms["admin"]["pwd"].value;
if (x==null || x=="")
  {
  alert("Provide the password");
document.forms["admin"]["pwd"].focus();
  return false;
  }
}
</script>
</html>