Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

Monday, 31 March 2014

C Programming graphics | Web browser project in c, c program to open a website/url using C graphics

C Programming graphics | Web browser project in c, c program to open a website/url using C graphics

Source code:-)

#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <graphics.h>
#include <dos.h>
#include <string.h>

void initialize_graphics_mode();
int get_key();
void draw();

union REGS i, o;

main()
{
  int key, i = 0, xpos, ypos, button;
  char arr[200], temp[5], *ptr;
  char a[] = "C:\\Progra~1\\Mozill~1\\firefox ";

  strcpy(arr,a);

  i = strlen(a);

  initialize_graphics_mode();

  draw();

  while(1)
  {
    if(kbhit())
      key = get_key();

    if((key>=97&&key<=122)||(key>=65&&key<=90)||key==46||key==47||key==63)
    {
      arr[i] = key;
      sprintf(temp,"%c",arr[i]);
      outtext(temp);
      if(getx()>470)
      {
        clearviewport();
        moveto(5,2);
      }
      i++;
    }
    else if ( key == 13 )
    {
      arr[i] = '\0';
      system(arr);
      break;
    }
    else if ( key == 27 )
    {
      closegraph();
      exit(EXIT_SUCCESS);
    }
    if(button==1&&xpos>=150&&xpos<=480&&ypos>=300&&ypos<=330)
    {
      system("C:\\Progra~1\\Mozill~1\\firefox errors000.blogspot.in");
      break;
    }
    key = -1;
  }

  closegraph();
  return 0;
}

void initialize_graphics_mode()
{
  int gd = DETECT, gm, errorcode;

  initgraph(&gd,&gm,"C:\\TC\\BGI");
  errorcode = graphresult();

  if( errorcode != grOk )
  {
    printf("Graphics error : %s\n",grapherrormsg(errorcode));

    printf("Press any key to exit...\n");
    getch();
    exit(EXIT_FAILURE);
  }
}

int get_key()
{
  i.h.ah = 0;
  int86(22,&i,&o);

  return( o.h.al );
}

void draw()
{
  settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);
  outtextxy(275,11,"Web Browser");
  outtextxy(155,451,"<a href="http://errors000.blogspot.in"">errors000.blogspot.in"</a>);
  outtextxy(5,105,"Enter URL : ");
  rectangle(120,100,600,130);
  setviewport(121,101,599,129,1);
  moveto(5,1);
}

Sunday, 30 March 2014

JAVA PROGRAMS-Matrix Program in Java

Matrix Program in Java

  Program Name:- matrix.java 

import java.io.*;

class matrix

{

public static void main(String args[])throws IOException

{

 DataInputStream in=new DataInputStream(System.in);

 int i,j,m,n,k;

 int a[][]=new int[10][10];

 int b[][]=new int[10][10];

 int c[][]=new int[10][10];

 int d[][]=new int[10][10];

 System.out.print("\n Enter the row and column\n\n");

 m=Integer.parseInt(in.readLine());

 n=Integer.parseInt(in.readLine());

 System.out.print("\n Enter the element of matrix A\n\n");

 for(i=0;i<m;i++)

 {

 for(j=0;j<n;j++)

 {

 a[i][j]=Integer.parseInt(in.readLine());

 }

 }

 System.out.print("\n Enter the element of matrix B\n\n");

 for(i=0;i<m;i++)

 {

 for(j=0;j<n;j++)

 {

 b[i][j]=Integer.parseInt(in.readLine());

 }

 }

 for(i=0;i<m;i++)

 {

 for(j=0;j<n;j++)

 {

 for(k=0;k<m;k++)

 {

 c[i][j]=c[i][j]+a[i][k]*b[k][j];

 }

 }

 }

 System.out.print("\n A matrix\n");

 for(i=0;i<m;i++)

 {

 for(j=0;j<n;j++)

 {

 System.out.print(a[i][j]+"\t");

 }

 System.out.println();

 }

 System.out.print("\n B matrix\n");

 for(i=0;i<m;i++)

 {

 for(j=0;j<n;j++)

 {

 System.out.print(b[i][j]+"\t");

 }

 System.out.println();

 }

 System.out.print("\n Multipul matrix\n");

 for(i=0;i<m;i++)

 {

 for(j=0;j<n;j++)

 {

 System.out.print(c[i][j]+"\t");

 }

 System.out.println();

 }

 }

}


JAVA PROGRAMS-Stack Program In Java

Stack Program In Java

Program Name:- stackdemo.java

import java.io.*;
class stack
{
int s[]=new int[100];
int top;
void stack()
 {
 top=0;
 System.out.println("\n The stack is empty");
 }
public void push()throws IOException
 {
 DataInputStream inp=new DataInputStream(System.in);
 int x;
 if(top==100)
  {
  System.out.println("The Stack is full");
  }
 else
  {
  System.out.print("\n Enter the value  :");
  x=Integer.parseInt(inp.readLine());
  s[top]=x;
  top++;
  System.out.println("\n The value is pushed");
  }
 }
public void pop()throws IOException
 {
 DataInputStream inp=new DataInputStream(System.in);
 int y;
 if(top==0)
  {
  System.out.println("\n The stack is empty");
  }
 else
  {
  top--;
  y=s[top];
  s[top]='\0';
  System.out.println("\n The value is poped");
  }
 }
void display()
 {
 int i;
 if(top==0)
 {
  System.out.println("\nThe stack is empty");
  }
 else
  {
   System.out.println("\nValues are top-->");
  }
 for(i=top-1;i>=0;i--)
  System.out.println(s[i]);
 }
}
public class stackdemo
{
public static void main(String args[])throws IOException
 {
 stack in=new stack();
 int item=0;
 int opt=1;
 String s=new String();
 while(opt<4)
 {
 System.out.println("\n\n\t\t Main menu\n\n1.push\n\n2.Pop\n\n3.Display\n\n4.Exit\n\nSelection the option");
 DataInputStream din=new DataInputStream(System.in);
 s=din.readLine();
 opt=Integer.parseInt(s);
 switch(opt)
  {
   case 1:
   System.out.println("\nEnter the elementis add");
   in.push();
   break;
   case 2:
   System.out.println("\nEnter the delete item");
   in.pop();
   break;
   case 3:
   System.out.println("\nThe stack element is:");
   in.display();
   break;
   default:
   opt=4;
   }
  }
 }
}

Monday, 3 March 2014

PHP TUTORIALS-Create Login Page with DataBase-PhpMyAdmin-Mysql

PHP TUTORIALS Create Login Page with DataBase-PhpMyAdmin-Mysql

FULL DETAILS..

PHP TUTORIALS-Create Login Page with Database using PhpMyAdmin-Mysql


PHP TUTORIALS Create Login Page with DataBase PhpMyAdmin Mysql PART2 



Program Name :- htmllogin.html

<html>

<head>

<body bgcolor="">

<font>

<center><h1>Login</h1></center>

</font>

<form action="login.php" method="POST">

Username:<input type="text" name="uname">

Password:<input type="password" name="pass"><br>

<input type="submit" value="login" name="submit">

</form>

</body>

</head>

</html>


Program Name:-  login.php

<?php

require ('sql_connect.php');

if (isset($_POST['submit'])){

$username=mysql_escape_string($_POST['uname']);

$password=mysql_escape_string($_POST['pass']);

if (!$_POST['uname'] | !$_POST['pass'])

 {

echo ("<SCRIPT LANGUAGE='JavaScript'>

        window.alert('You did not complete all of the required fields')

        window.location.href='htmlogin.html'

        </SCRIPT>");

exit();

     }

$sql= mysql_query("SELECT * FROM `login_users` WHERE `username` = '$username' AND `password` = '$password'");

if(mysql_num_rows($sql) > 0)

{

echo ("<SCRIPT LANGUAGE='JavaScript'>

        window.alert('Login Succesfully!.')

        window.location.href='htmllogin.html'

        </SCRIPT>");

exit();

}

else{

echo ("<SCRIPT LANGUAGE='JavaScript'>

        window.alert('Wrong username password combination.Please re-enter.')

        window.location.href='htmllogin.html'

        </SCRIPT>");

exit();

}

}

else{

}

?>


Program Name:-   sql_connect.php

<?php

mysql_connect("localhost", "root", "") or die("mysql connection is failure.");

mysql_select_db("login") or die("Database does not exists.");

?>

Friday, 28 February 2014

PHP TUTORIALS-GET METHOD

CODING FOR GET METHOD WITH EXAMPLE PROGRAM SESSON-2


Program name:- htmlget1.php

<html>

<head>

<body>

<h1><center>GET METHOD</center></h1>

<form action="get1.php" method="get">

Name:<input type="text" name="name">

Email:<input type="text" name="email">

<input type="submit" value="submit">

</body>

</head>

</html>


get1.php

 

Welcome<?php echo $_GET["name"];?>

Your Email Address is: <?php echo $_GET["email"];?>