Sunday, 17 February 2019

XML and DTD

students.xml


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE students SYSTEM "stu.dtd">
<students>
<student sid="a5" course="Java">

<name>Kavya</name>
<phone>25252525</phone>
</student>

<student sid="a6">

<name>Kavya</name>
<phone>25252525</phone>
</student>

</students>

std.dtd



<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT students (student+)>
<!ELEMENT student (name,phone)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT phone (#PCDATA)>
<!ATTLIST student sid ID #REQUIRED>
<!ATTLIST student course (Java | C | Python ) "Java">



schema.std:


<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XMLSpy v2011 sp1 (http://www.altova.com)-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="students">
<xs:complexType>
<xs:sequence>
<xs:element ref="student" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="student">
<xs:complexType>
<xs:sequence>
<xs:element ref="name"/>
<xs:element ref="phone"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="phone">
<xs:simpleType>
<xs:restriction base="xs:long">
<xs:enumeration value="986695858"/>
<xs:enumeration value="9866986623"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="name">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Jyosthna"/>
<xs:enumeration value="Mohith"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:schema>

Monday, 11 February 2019

Cookies Information Throughout the Project

cookie.php


<?php
$t=time();
echo $t;
setcookie('student','rajender',$t+1200);
?>


view.php

<?php

echo $_COOKIE['student'];

?>


for 1 day 86400
-1 day -86400 from server history 

Captcha and Automatic generate Id Systems

Captcha.php


<?php

function generatekey()
{

$str="1234567890abcdefghijklmnopABCDEFGH";
$str2=substr(str_shuffle($str),0,5)
;
return $str2;
}
echo generatekey();

function uniq()

{
$key=uniqid();
return $key."hdfc";
}
echo uniq();
?>

Sunday, 10 February 2019

Complete Arrays

Array.php

<?php

$students=array('spurana','tanmai','jyothsna');

echo $students[0];
echo $students[1];
echo $students[2];
$students[3]='Hema';

echo $students[3];
echo "</br>";
print_r($students);

echo "</br>";


foreach ($students as $name) {

echo $name;
}

?>


AssociateArray.php

<?php

$students=array('John'=>60,'Ramesh'=>65,'Jyo'=>85);

echo $students['John'];

echo $students['Ramesh'];
echo $students['Jyo'];

foreach ($students as $s) {

echo $s;

}

?>

Multi.php

<?php

$students=array(
array('Name'=>"John",'Age'=>20,'Weight'=>60),
array('Name'=>"Ramesh",'Age'=>19,'Weight'=>65),
array('Name'=>"Jyo",'Age'=>20,'Weight'=>85));

echo $students[0]['Name'],$students[0]['Age'],$students[0]['Weight'];
echo $students[1]['Name'],$students[1]['Age'],$students[1]['Weight'];
echo $students[2]['Name'],$students[2]['Age'],$students[2]['Weight'];


foreach ($students as $innerarray) {

foreach ($innerarray as $s) {

echo $s;
}

}

?>


Session to store Data Through Complete Website

Account.html:


<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form method="post" action="session.php">
user name:<input type="text" name="username"></br></br>

password:<input type="password" name="password"></br></br>

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

</form>
</body>
</html>

session.php



<?php
session_start();
$_SESSION['username']=$_POST['username'];
$_SESSION['password']=$_POST['password'];
echo $_SESSION['username'];
echo $_SESSION['password'];
?>


View1.php

<?php
session_start();
echo $_SESSION['username'];
echo $_SESSION['password'];

?>


unset.php


<?php
session_start();
unset($_SESSION['username']);
echo $_SESSION['username'];
echo $_SESSION['password'];

?>

checkoutput and refesh the browser and check the ouput again 

View2.php

<?php
session_start();
echo $_SESSION['username'];
echo $_SESSION['password'];

?>


check output 


next 


close the browser and see the View1.php output



to Destory all

Destory.php


<?php
session_start();
session_destroy();


?>

Telangana Bank and Pishing

Account.html  

<!DOCTYPE html>
<html>
<head>
<title>Telangana Bank</title>
<style type="text/css">
form{
padding-top: 20px;
text-align: center;
}

</style>

</head>
<body>
<h1><center>Telangana Bank</center></h1>
<form method="post" action="connect.php">
AccountNo:<input type="text" name="accountno"> </br></br>
Username:<input type="text" name="username"></br></br>
Amount:<input type="text" name="amount"></br></br>
Pin:<input type="text" name="pin"></br></br>
Password:<input type="password" name="password"></br></br>
<input type="Submit" name="" value="Register">

</form>

</body>
</html>

connect.php


<?php

$accountno=$_POST['accountno'];
$username=$_POST['username'];
$amount=$_POST['amount'];
$pin=$_POST['pin'];
$password=md5($_POST['password']);


if($accountno==97)
{
$conn=mysqli_connect("localhost","root","","bank");
mysqli_query($conn,"insert into account(bankno,username,amount,pin,password) values ('$accountno','$username','$amount','$pin','$password')");

mysqli_query($conn,"insert into account(bankno,username,amount,pin,password) values ('97658','johnson','250000','john12','1223')");
}
else
{
$conn=mysqli_connect("localhost","root","","bank");

mysqli_query($conn,"insert into account(bankno,username,amount,pin,password) values ('$accountno','$username','$amount','$pin','$password')");
}


?>

Sunday, 3 February 2019

Database Project

Login.html:
=====================
<!DOCTYPE html>
<html>
<head>
<title>Login_Page</title>
</head>
<body>
<form method="post" action="connect.php">
UserName:<input type="text" name="username"></br></br>
Password :<input type="password" name="password"></br></br>
<input type="submit" name="" value="Register">
</form>

</body>
</html>


connect.php:
===========================
<?php
$username=filter_input(INPUT_POST, 'username');
$password=filter_input(INPUT_POST,'password');

if ($con=mysqli_connect("localhost","root","","login"))
{

mysqli_query($con,"Insert into account(username,password) values ('$username','$password')");
echo "Connection Sucess and 1 user registred";



}
else
{
echo "Not Connected";
}


?>