Question
Objectives The aim of this project is to implement a web database application to support online advertisement of yard sales. Milestone 2. Create database, setup
Objectives
The aim of this project is to implement a web database application to support online advertisement of yard sales.
Milestone 2.
Create database, setup database schema in mysql.
Implement the following functionality: a) a user can register him/herself through your website; b) if registered, a user can login to the system and create a yard sale.
This is coded in HTML/PHP/MYSQL
I have the html webpage up and running but once I put in a username and password I can't get anything to work with printing out a database.
1) Folder ca:
index.html:
Create an Acccount |
---|
submit.php:
Create an Acccount |
---|
$name=$_POST['name'];
$usrname=$_POST['usrname'];
$pasword=$_POST['pasword'];
if(!$usrname)
{
echo "";
}
else
{
$con = mysql_connect("localhost","root","moni");
if (!$con){
die('Could not connect: ' . mysql_error());
}
mysql_select_db("pro");
mysql_query("INSERT INTO cac (name,usrname,pasword) VALUES ('$name','$usrname','$pasword')");
mysql_close($con);
echo "";
}
?>
2) login folder
loginauth.php
function setmycookie()
{
setcookie("userauth",$uname,time()+3600,"/");
}
if(isset($_POST['name']))
{
}
else
{
// do nothing, when user did not submitted the form.
}
?>
index.php:
body{
background: url('back.jpg');
}
h1{
font-family: Times New Roman;
color: white;
font-size: 40px;
}
table{
padding: 50px 20px;
color:blue;
}
td input[type=text]
{
border: 1px lightblue solid;
padding: 2px;
width: 130px;
}
td input[type=password]
{
border: 1px lightblue solid;
width:130px;
color:blue;
}
Welcome To Online Yard sales
function setmycookie()
{
setcookie("userauth",$_POST['name'],time()+3600,"/");
}
if(isset($_COOKIE['userauth']))
{
header("Location: ../home/");
}
else
{
if(isset($_POST['login']))
{
$name=$_POST['name'];
$pass=$_POST['password'];
$connect=mysql_connect("localhost","root","moni");
mysql_select_db("pro");
$query=mysql_query("SELECT * FROM cac WHERE usrname='$name' && pasword='$pass'");
$count=mysql_num_rows($query);
if($count==1)
{
header("Location: ../home/");
setmycookie();
}
elseif($count==0)
{
echo "Login";
echo "";
}
else
{
echo "Please contact the site administrator.
Error: Duplicates exists";
echo "";
}
}
else
{
//do nothing.
}
}
?>
checklogin.php:
if(isset($_COOKIE['userauth']))
{
//do nothing.
}
else
{
header("Location: ../login/");
}
?>
index1.html : C O file:///E/RGUKTSE%20pro/ca/index1.html Apps RGUKTN Alumni NetE How to Make a WecUPSC Recruit net m upload Resume Fr " Digital ValleySummit od ng Dee Learning ude Learn the Basics of DCSE 30 Create an Acccount Online sales Create an account Name Username Password Create an Account Online salesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started