Monday 25 December 2017

Project 2017


Download project reference code


 Download Validation File


Public Class MDI

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label3.Text = "Donor"
        Donor.ShowDialog()


    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If Panel1.Width <= 78 Then
            Panel1.Width = 78
            Label3.Left = 83
            PictureBox13.Visible = True
            PictureBox14.Visible = True
            PictureBox1.Visible = False

            Timer1.Enabled = False

        Else
            Label3.Left = Label3.Left - 10

            Panel1.Width = Panel1.Width - 10
        End If

    End Sub

    Private Sub PictureBox12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox12.Click
        Timer1.Enabled = True

    End Sub

    Private Sub PictureBox14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox14.Click
        Timer2.Enabled = True

    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        If Panel1.Width >= 284 Then
            Panel1.Width = 284
            Label3.Left = 305
            PictureBox13.Visible = False

            PictureBox14.Visible = False
            PictureBox1.Visible = True

            Timer2.Enabled = False

        Else
            Label3.Left = Label3.Left + 10

            Panel1.Width = Panel1.Width + 10
        End If

    End Sub

    Private Sub PictureBox7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox7.Click
        End

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        DisplayDonors.ShowDialog()

    End Sub
End Class

Tuesday 23 May 2017

VB Project 2017


Module Code
==============================================================

Option Explicit

Public con As New Connection
Public rs As New Recordset
Public num As Integer

Public Sub connect()
If con.State = 1 Then
con.Close
End If
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;data Source=D:\Project_2017\project2017.mdb"
con.Open
MsgBox ("Conected")

End Sub

Public Sub num_query(ByVal q As String)

If rs.State = 1 Then
rs.Close
End If
rs.Open q, con, adOpenDynamic, adLockPessimistic
If rs.BOF Then
num = 0
Else
num = rs.Fields(0).Value
End If

End Sub
Public Sub inupdel(ByVal q As String)
If rs.State = 1 Then
rs.Close
End If
rs.Open q, con, adOpenDynamic, adLockPessimistic
End Sub
Public Sub sel_query(ByVal q As String)
If rs.State = 1 Then
rs.Close
End If
rs.CursorLocation = adUseClient
rs.Open q, con, adOpenDynamic, adLockPessimistic

End Sub
=========================================================================

Student Info Form Code
Option Explicit

Private Sub cmdAdd_Click()
Module1.num_query ("select max(s_rl)+1 from student")
txtRl.Text = num
txtRl.Enabled = False
cmdAdd.Enabled = False
cmdSave.Enabled = True
End Sub

Private Sub cmdNext_Click()
rs.MoveNext
If rs.EOF Then
rs.MoveLast
MsgBox ("This is last Record")
End If
Call loaddata
End Sub

Private Sub cmdPrev_Click()
rs.MovePrevious
If rs.BOF Then
rs.MoveFirst
MsgBox ("This is First Record")
End If
Call loaddata
End Sub

Private Sub cmdSave_Click()
If txtAdd.Text <> "" And txtmb.Text <> "" And txtnm.Text <> "" And txtRl.Text <> "" And cmbClass.Text <> "" Then
Module1.inupdel ("insert into student values(" & CInt(txtRl.Text) & ",'" & txtnm.Text & "','" & txtmb.Text & "','" & txtAdd.Text & "','" & cmbClass.Text & "')")
MsgBox "Student Added Successfully", vbInformation + vbOKOnly, "Insertion"
cmdAdd.Enabled = True
cmdSave.Enabled = False
txtRl.Text = ""
txtnm.Text = ""
txtAdd.Text = ""
txtmb.Text = ""
cmbClass.Text = "Select"
Else
MsgBox "Fields Should not be empty", vbCritical + vbOKOnly, "Error"
End If
End Sub

Private Sub cmdSearch_Click()
Dim rl As Integer
If txtSrch.Text <> "" Then
rl = CInt(txtSrch.Text)
Module1.sel_query ("select * from student where s_rl= " & rl & " ")
If rs.BOF Then
txtRl.Text = ""
txtnm.Text = ""
txtAdd.Text = ""
txtmb.Text = ""
cmbClass.Text = "Select"
MsgBox ("Record Not Found")
Else
txtRl.Text = rs.Fields(0).Value
txtnm.Text = rs.Fields(1).Value
txtmb.Text = rs.Fields(2).Value
txtAdd.Text = rs.Fields(3).Value
cmbClass.Text = rs.Fields(4).Value
cmdUpdate.Enabled = True
End If
Else
MsgBox ("Enter Roll no")
End If
End Sub

Private Sub cmdUpdate_Click()
If txtAdd.Text <> "" And txtmb.Text <> "" And txtnm.Text <> "" And txtRl.Text <> "" And cmbClass.Text <> "" Then
Module1.inupdel ("update student set s_name='" & txtnm.Text & "',s_mob='" & txtmb.Text & "',s_add='" & txtAdd.Text & "',s_class='" & cmbClass.Text & "' where s_rl=" & CInt(txtRl.Text) & "")
MsgBox ("Student Info Updated")
Else
MsgBox ("Enter All Fields")
End If
End Sub

Private Sub Command1_Click()
If cmbclssrch.Text = "Select Class to search" Then
MsgBox ("Select Class")
Else
Module1.sel_query ("select * from Student where s_class='" & cmbclssrch.Text & "'")
Set DataGrid1.DataSource = rs
Call loaddata
End If
End Sub

Private Sub Form_Load()
Me.Width = 9450
Me.Height = 7695
Me.Left = 4000
Me.Top = 1000
Module1.sel_query ("select distinct(s_class) from student")
While Not rs.EOF
cmbclssrch.AddItem (rs.Fields(0).Value)
rs.MoveNext
Wend
Module1.sel_query ("select * from student")
Set DataGrid1.DataSource = rs
End Sub

Private Sub loaddata()
txtRl.Text = rs.Fields(0).Value
txtnm.Text = rs.Fields(1).Value
txtmb.Text = rs.Fields(2).Value
txtAdd.Text = rs.Fields(3).Value
cmbClass.Text = rs.Fields(4).Value
End Sub

Private Sub txtmb_KeyPress(KeyAscii As Integer)
'MsgBox (KeyAscii)
If KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 8 Then

Else
MsgBox "Enter only Number", vbCritical + vbOKOnly, "Invalid Input"
KeyAscii = 0
End If
End Sub

Private Sub txtmb_LostFocus()
If Mid(txtmb.Text, 1, 1) >= 7 And Mid(txtmb.Text, 1, 1) <= 9 And Len(txtmb.Text) = 10 Then

Else
MsgBox "Invalid Mobile Number", vbCritical + vbOKOnly, "Invalid Input"
txtmb.SetFocus
End If

End Sub

Private Sub txtnm_KeyPress(KeyAscii As Integer)
If KeyAscii >= 65 And KeyAscii <= 90 Or KeyAscii >= 97 And KeyAscii <= 122 Or KeyAscii = 32 Or KeyAscii = 8 Then
'nothing to do
Else
MsgBox "Enter only alphabets", vbCritical + vbOKOnly, "Invalid Input"
KeyAscii = 0
End If

End Sub

Friday 17 February 2017

Login validataion in PHP




<?php
include"connect.php";
$un=$_POST['txtuname'];
$up=$_POST['txtpass'];
//echo "$un</br>$up</br>";


$res=pg_query($con,"select count(*) from Users where uname='$un' and upass='$up'");

$r=pg_fetch_array($res);
if($r[0]==1)
{
session_start();
$_SESSION['unm']=$un;
$_SESSION['ups']=$up;

 echo "<script type='text/javascript'>";
                echo "if(confirm('Login Successfully'))document.location='home.html';else document.location='home.html';";
                echo "</script>";

}
else
{

 echo "<script type='text/javascript'>";
                echo "if(confirm('Username or password doesnot match'))document.location='home.html';else document.location='home.html';";
                echo "</script>";

}


?>

Validation and Insertion in PHP




Email Validation in PHP using eregi function



<?php
include"connect.php";

$name=$_GET['txtname'];
$add=$_GET['txtadd'];
$mo=$_GET['txtmno'];
$g=$_GET['radg'];
$email=$_GET['txtemail'];
$dt=$_GET['dd']."/".$_GET['mm']."/".$_GET['yy'];
$un=$_GET['txtuname'];
$pass=$_GET['txtpass'];
$cpass=$_GET['txtcpass'];

//(ereg("^[a-zA-Z ]$",$name)) && (ereg("^[7-9]?[0-9]{9}$",$mo)))


//eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9]+)*(\.[a-z]{2,3})$",$email)))

//echo "$name </br>$add</br>$mo</br>$g</br>$email</br>$dt</br>$un</br>$pass</br>$cpass</br>";

if($name!="" && $add!="" && $mo!="" && $g!="" && $email!="" && $dt!="" && $un!="" && $pass!="" && $pass===$cpass)
{

    if((eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9]+)*(\.[a-z]{2,3})$",$email)) && (ereg("^[a-zA-Z ]+$",$name)) && (ereg("^[7-9]?[0-9]{10}$",$mo)))
    {
        $r=pg_query($con,"insert into Users values('$name','$add','$mo','$g','$email','$dt','$un','$pass')");
        if($r)
        {
        echo "<script type='text/javascript'>";
        echo "if(confirm('You are registered Successfully'))document.location='career.html';else document.location='career.html';";
        echo "</script>";
        }   
        else
        {
        echo "<script type='text/javascript'>";
        echo "if(confirm('Something Wrong'))document.location='index.html';else document.location='index.html';";
        echo "</script>";
       
        }
    }
    else
    {

        echo "<script type='text/javascript'>";
        echo "if(confirm('email or name or mobile invalid'))document.location='index.html';else document.location='index.html';";
        echo "</script>";
    }


}
else
{
    echo "<script type='text/javascript'>";
    echo "if(confirm('Fields should not be empty'))document.location='index.html';else document.location='index.html';";
    echo "</script>";

}
?>

Thursday 16 February 2017

Upload imge in database in Project folder Using PHP




HTML FILE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="barrensavannah.css" />
<title>Clean Pune </title>

<b><u><font size=5 face="italic" color=black width=500><marquee align=top behaviour=slide  bgcolor=orange direction=left width=750 height=25 >WELCOME TO CLEAN PUNE</marquee></font></blink></u></b>


</head>

<body onload="seaproblems()">

<script type="text/javascript">
        function seaproblems()
        {
                var xmlhttp=false;
                if(window.XMLHttpRequest)
                {
                        xmlhttp=new XMLHttpRequest();
                }
                xmlhttp.onreadystatechange=function()
                {
                        if(xmlhttp.readyState==4 && xmlhttp.status==200)
                        {
                                document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
                        }
                }
                xmlhttp.open("GET","seaproblems.php");
                xmlhttp.send();
        }
</script>






    <div id="page">
        <div class="topNaviagationLink"><a href="index.html">Home</a></div>
        <div class="topNaviagationLink"><a href="problems.html">Problems</a></div>
 <div class="topNaviagationLink"><a href="listofcorporators.php">Corporators</a></div>       
<div class="topNaviagationLink"><a href="contact.html">Contact Us</a></div>
<div class="topNaviagationLink"><a href="login.html">Login</a></div>

    </div>
    <div id="mainPicture">
        <div class="picture">
            <div id="headerTitle"></div>
            <div id="headerSubtext"></div>
        </div>
    </div>
        <div class="contentBox">
        <div class="innerBox">
            <h1> Enter your problem here </h1>
          <div class="contentText">
<form action=problem.php method=post enctype="multipart/form-data">   
<table width=680 align=center frame="box">

    <tr><td width="200">   Area</td><td><select name="area">
                <option value="">Select</option>
                <option value="Shaniwar Peth">Shaniwar Peth</option>
                <option value="Rupeenagar-Talawade">Rupeenagar-Talawade </option>
                <option value="Raviwar Peth">Raviwar Peth</option>
                <option value="Chikhali">Chikhali</option>   
                <option value="Krushnanagar">Krushnanagar</option>   
                 </select></td></tr>

    <tr><td>   Description</td><td><textarea rows="5" cols="50" name="desc">
    </textarea></td></tr>

<tr><td>   Upload image:</td><td> <input type="file" name="uploadedimage" id="pic"></td></tr>
</br>

<tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td><td ><input type="submit" value="Submit" /></td></tr>
</table>
</form>

<div id="txtHint">your problem will be listed here</div>

           </div>
         
         
          <!-- Please leave this in place after all of your content - thanks :) -->
<div id="footer"><a href="http://www.aszx.net"> developed</a> by <a href="http://www.bryantsmith.com">Pooja Shelke & Reshma Shinde</a></div>
<!-- Please leave this in place after all of your content - thanks :) -->
       
       
     </div>

    </div>
       
</body>
</html>




PHP FILE

<?php
include "connect.php";

$parea=$_POST['area'];
$pdesc=$_POST['desc'];


$count=1;
$row=mysql_query("select * from problem");
while($res=mysql_fetch_array($row))
$count=$count+1;


    function GetImageExtension($imagetype)
         {
       if(empty($imagetype)) return false;
       switch($imagetype)
       {
           case 'image/bmp': return '.bmp';
           case 'image/gif': return '.gif';
           case 'image/jpeg': return '.jpg';
           case 'image/png': return '.png';
           default: return false;
       }
     }



if (!empty($_FILES["uploadedimage"]["name"]) && !empty($parea) && !empty($pdesc))
{

        $file_name=$_FILES["uploadedimage"]["name"];
        $temp_name=$_FILES["uploadedimage"]["tmp_name"];
        $imgtype=$_FILES["uploadedimage"]["type"];
        $ext= GetImageExtension($imgtype);
        $imagename=date("d-m-Y")."-".time().$ext;
        $target_path = "images/".$imagename;


    if(move_uploaded_file($temp_name, $target_path))
    {   

            $query_upload="INSERT into problem VALUES($count,'$parea','".$target_path."','$pdesc','".date("Y-m-d")."','Not Solved')";
            //mysql_query($query_upload) or die("error in $query_upload == ----> ".mysql_error());
        if(mysql_query($query_upload))
        {
            echo "<script type='text/javascript'>";
                echo "if(confirm('Your Problem uploaded successfully'))document.location='problems.html';else document.location='problems.html';";
                   echo "</script>";   
       
        }
        else
        {
            echo "<script type='text/javascript'>";
                echo "if(confirm('Your Problem not uploaded'))document.location='problems.html';else document.location='problems.html';";
                   echo "</script>";   
        }

    }
    else
    {

           exit("Error While uploading your problem on the server");
    }
}
else
{
            echo "<script type='text/javascript'>";
                echo "if(confirm('Something Wrong'))document.location='problems.html';else document.location='problems.html';";
                   echo "</script>";   
   
}
?>


Wednesday 15 February 2017

Validation in VB.Net


Imports System.Text.RegularExpressions
Public Class Validation
    Private Sub Validation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        DateTimePicker1.MaxDate = Today

    End Sub

    Private Sub txtName_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtName.KeyPress
        If e.KeyChar >= "a" And e.KeyChar <= "z" Or e.KeyChar >= "A" And e.KeyChar <= "Z" Or e.KeyChar = " " Or e.KeyChar = Convert.ToChar(Keys.Back) Then
            'nothing to do valid character
        Else
            e.KeyChar = ""
            txtName.Select()
            MsgBox("Enter only Alphabets", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Invalid Input")
        End If
    End Sub

    Private Sub txtMobile_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtMobile.KeyPress
        If e.KeyChar >= "0" And e.KeyChar <= "9" Or e.KeyChar = Convert.ToChar(Keys.Back) Then

        Else
            e.KeyChar = ""
            txtMobile.Select()
            MsgBox("Enter only Numbers", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Invalid Input")
        End If

    End Sub


    Private Sub txtMobile_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtMobile.Leave
        Try

            If txtMobile.Text.Substring(0, 1) >= 7 And txtMobile.Text.Length = 10 Then

            Else

                txtMobile.Select()
                MsgBox("Enter valid mobile", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Invalid Input")
            End If

        Catch ex As Exception
            MsgBox(ex.Message)

        End Try
    End Sub

    Private Sub txtemail_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtemail.Leave
        Dim f As Boolean
        f = Module1.validateEmail(txtemail.Text)
        If f = False Then
            MsgBox("Enter valid Email", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Invalid Input")
            txtemail.Select()
        End If
    End Sub
    Public Function validateEmail(ByVal emailAddress) As Boolean
        ' Dim email As New Regex("^(?[^@]+)@(?.+)$")
        Dim email As New Regex("([\w-+]+(?:\.[\w-+]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7})")
        If email.IsMatch(emailAddress) Then
            Return True
        Else
            Return False
        End If
    End Function

End Class