How to create login and registration page
Connect.php
<?php$conn = mysqli_connect("localhost", "root", "","login");
/*if($conn) {
echo "connect successfully";
}
else {
echo "not connected";
}*/
//$db = mysql_select_db("login");
/*if($db) {
echo "db connect successfully";
}
else {
echo "db not connected";
}*/
?>
Register.php
<?php include('connect.php'); ?>
<?php
if(isset($_POST['psw'])){
$email = $_POST['email'];
$pass = md5($_POST['psw']);
$repeat_pass = md5($_POST['psw-repeat']);
if($pass == $repeat_pass ) {
$sql ="insert into user (username, password) values ('$email','$pass')";
mysqli_query($conn,$sql);
}
else {
echo "password did not match";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
/* Full-width input fields */
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
/* Set a style for all buttons */
button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
/* Extra styles for the cancel button */
.cancelbtn {
padding: 14px 20px;
background-color: #f44336;
}
/* Float cancel and signup buttons and add an equal width */
.cancelbtn,.signupbtn {
float: left;
width: 50%;
}
/* Add padding to container elements */
.container {
padding: 16px;
}
/* Clear floats */
.clearfix::after {
content: "";
clear: both;
display: table;
}
/* Change styles for cancel button and signup button on extra small screens */
@media screen and (max-width: 300px) {
.cancelbtn, .signupbtn {
width: 100%;
}
}
</style>
</head>
<body>
<form action="#" method="post" enctype="multipart/form-data">
<div class="container">
<label><b>Email</b></label>
<input type="text" placeholder="Enter Email" name="email" >
<label><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" >
<label><b>Repeat Password</b></label>
<input type="password" placeholder="Repeat Password" name="psw-repeat" >
<div class="clearfix">
<button type="button" class="cancelbtn">Cancel</button>
<button type="submit" name="subbuton" class="signupbtn">Sign Up</button>
</div>
</div>
</form>
</body>
</html>
Login.php
<!DOCTYPE HTML>
<?php include('connect.php'); ?>
<?php
if(isset($_POST['user'])){
$username = $_POST['user'];
$password = $_POST['pass'];
$sql="select * from user where username='".$username."' and password='".md5($password)."'";
$result=mysqli_query($conn,$sql);
$count=mysqli_num_rows($result);
if ($count>0){
echo "welcome user";
}
else {
echo "user name and password is wrong";
}
}
?>
<html>
<head>
<title>Sign-In</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body id="body-color">
<div id="Sign-In">
<fieldset style="width:30%"><legend>LOG-IN HERE</legend>
<form method="post" action="#">
User <br><input type="text" name="user" size="40"><br>
Password <br><input type="password" name="pass" size="40"><br>
<input id="button" type="submit" name="submit" value="Log-In">
</form>
</fieldset>
</div>
</body>
</html>
===============End===============================================
connection & select query
=============================
<?php
$conn = mysql_connect("localhost","root","");
mysql_select_db("neuralin_EMS");
if($conn) {
echo "connect successfully";
}
else {
echo "Could not connect:". mysql_error();
}
$sql= "select * from projectmaster";
$query = mysql_query($sql);
while ($result= mysql_fetch_array($query)){
echo $result['projectName'].'<br>'. $result['ProjectID'].'<br>';
}
?>
*****************************************
call dynamic TITLE & HEADING
*****************************************
save in configuration.php & call(include) in any page as <?php include("configuration.php"); ?>
Show title-<?php echo TITLE; ?>
---------------------------------------------------------------------------
<?php
define("TITLE","HOME | ENQUIRY MANAGEMENT SYSTEM");
define("PROJECTNAME","Enquiry Management System");
?>
*************************************************************
INCLUDE ONLY ONE TIME
***************************************************************
<?php include_once"menu/menu.html";?>
***********************************************************************
INCLUDE ONLY ONE TIME
***************************************************************
<?php include_once"menu/menu.html";?>
***********************************************************************
SQL CONNECTION
**************************************************************
db.php
------------------------------------------------------------------------
<?php$sql = mysql_connect('localhost','root','') or die('connection failed');
mysql_select_db('enquiry',$sql) or die('db not select');
?
*********************************************************
INDEX.PHP
*********************************************************
<?php include("configuration.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="wrapper" align="center">
<div class="header" align="center">
<div class="logo"><img width="150px;" src="../../lalit/cms/wordpress/hitechcomputer/Untitled-1.png" alt="wrong image"/></div>
<div class="clear"></div>
<div class="menu"><?php echo PROJECTNAME; ?></div>
</div>
<div class="main">
<div class="right" style=" margin: 65px; width: 500px; float:left"></div>
<div class="left" style="border: 0px solid #fff; margin: 65px; height: 250px; width: 500px; float:left">
<form name="frm" method="post" action="check.php">
<h1> Login </h1>
<ul>
<label>User Name:</label>
<label><input type="text" name="userName" placeholder="Enter Your Name!" required="required"/></label>
</ul>
<ul>
<label>Password:</label>
<label><input type="password" name="password" placeholder="Enter Your Password!" required="required"/ /></label>
</ul>
<ul>
<label><input type="submit" name="login" value="Login" /></label></ul>
</form>
<?php if($_GET['error']==1) { echo '<font color="#FF0000">Error</font>'; } ?>
</div>
</div>
<div class="footer" style="">Created By LALIT TIWARI.</div>
</div>
</body>
</html>
-----------------------------------------------------------------------
add(insert).php
---------------------------------------------------------------------------
<?php
include('db.php');
if(isset($_POST['add'])){
$name = $_POST['nm'];
$Phone = $_POST['phn'];
$Address = $_POST['address'];
$Purpose = $_POST['pur'];
$Email = $_POST['eml'];
$In = $_POST['intm'];
$Out = $_POST['outm'];
$insert = "insert into system (Name,Phoneno,Address,Purpose,Email,InTime,OutTime) values ('$name','$Phone','$Address','$Purpose','$Email','$In','$Out')";
mysql_query($insert);
//ADD VALUE & BACK TO HOME PAGE
------------------------------------------------------
//header('location: newdashboard.php');
?> OR
<script type="text/javascript" language="javascript">
window.location="newdashboard.php";
</script>
<?php
}
?>
****************************************************
INSERTED VALUES :SELECT IN DB QUERY
------------------------------------------------------
<table>
<div class="add"><a href="add.php">Add</a></div>
<thead>
<tr>
<th>Id:</th>
<th>Name:</th>
<th>Phone no:</th>
<th>Address:</th>
<th>Purpose:</th>
<th>Email:</th>
<th>In Time:</th>
<th>Out Time:</th>
<th>Actions:</th>
</tr>
</thead>
<tbody>
<?php
$sql = "select * from system";
$query =mysql_query($sql);
while($result = mysql_fetch_array($query)){
?><tr>
<td><?php echo $result['Id']; ?></td>
<td><?php echo $result['Name']; ?></td>
<td><?= $result['Phoneno']; ?></td>
<td><?= $result['Address']; ?></td>
<td><?php echo $result['Purpose']; ?></td>
<td><?php echo $result['Email']; ?></td>
<td><?= $result['InTime']; ?></td>
<td><?= $result['OutTime']; ?></td>
<td><a href="update.php?id=<?php echo $result['Id']; ?>">Update</a> | <a href="delete.php?id=<?php echo $result['Id']; ?>">Delete</a></td>
</tr>
<?php }
?>
</tbody>
</table>
****************************************************
UPDATE.PHP
****************************************************
<?php
include('db.php');
$select = "select * from system where Id='".$_REQUEST['id']."'";
$query= mysql_query($select);
$result = mysql_fetch_array($query);
if(isset($_POST['update'])){
$name = $_POST['nm'];
$Phone = $_POST['phn'];
$Address = $_POST['address'];
$Purpose = $_POST['pur'];
$Email = $_POST['eml'];
$In = $_POST['intm'];
$Out = $_POST['outm'];
$insert = "update system set Name='".$_REQUEST['nm']."', Phoneno='".$_REQUEST['phn']."', Address='".$_REQUEST['address']."', Purpose='".$_REQUEST['pur']."', Email='".$_REQUEST['eml']."', InTime='".$_REQUEST['intm']."', OutTime='".$_REQUEST['outm']."' where Id='".$_REQUEST['id']."'";
mysql_query($insert);
//header('location: newdashboard.php');
?>
<script type="text/javascript" language="javascript">
window.location='newdashboard.php';
</script>
<?php
}
?>
<form name="frm" method="post">
<table align="center" width="500px;" border="2px solid black;">
<tr>
<td>Name:</td>
<td><input type="text" name="nm" value="<?php echo $result['Name']; ?>" /></td>
</tr>
<tr>
<td>Phone no:</td>
<td><input type="text" name="phn" value="<?php echo $result['Phoneno']; ?>" /></td>
</tr>
<tr>
<td>Address:</td>
<td><input type="text" name="address" value="<?php echo $result['Address']; ?>" /></td>
</tr>
<tr>
<td>Purpose:</td>
<td><input type="text" name="pur" value="<?php echo $result['Purpose']; ?>" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="eml" value="<?php echo $result['Email']; ?>" /></td>
</tr>
<tr>
<td>In Time:</td>
<td><input type="text" name="intm" value="<?php echo $result['InTime']; ?>" /></td>
</tr>
<tr>
<td>Out Time:</td>
<td><input type="text" name="outm" value="<?php echo $result['OutTime']; ?>" /></td>
</tr>
<tr>
<td><input type="submit" name="update" value="update" /></td>
</tr>
</table>
</form>
******************************************************
DELETE.PHP
****************************************************
<?php
include('db.php');
$sql = "delete from system where Id='".$_REQUEST['id']."'";
mysql_query($sql);
//header('location: list.php');
?>
<script type="text/javascript" language="javascript">
window.location='newdashboard.php';
</script>
**************************************************
LOGOUT.PHP
*******************************************************
<?php
ob_start();
session_start();
session_destroy();
header("location: index.php");
?>
**************************************************
CHECK.PHP
**************************************************
<?php
include("db.php");
if(isset($_POST['login']))
{
$userName = $_POST['userName'];
$password = $_POST['password'];
//echo $userName.' | '.$password.'<br>';
$sql = "select * from admin where status=1";
$query = mysql_query($sql);
while($result=mysql_fetch_array($query))
{
$usernameD = $result['username'];
$passwordD = $result['password'];
//echo $usernameD.' | '.$passwordD.'<br>';
if($userName==$usernameD && $password==$passwordD)
{
$_SESSION['userNameS']=$result['username'];
?>
<script type="text/javascript" language="javascript">
window.location='newdashboard.php';
</script>
<?php
}
else
{
?>
<script type="text/javascript" language="javascript">
window.location='index.php?error=1';
</script>
<?php
}
}
}
else
{
?>
<script type="text/javascript" language="javascript">
window.location='index.php?error=1';
</script>
<?php
}
?>
=====================================================================
How to change admin site title
===============================================================
go to config.php and change site title
===================================================================
CALL DYNAMIC IMAGE
==================================================================
<?php $img = pageImage(5); ?>
<?php if($img!="") { ?>
<img alt="" width="981" height="269" src="admin/pageImage/<?php echo $img; ?>"/>
<?php } ?>
=====================================================================
How to change admin site title
===============================================================
go to config.php and change site title
===================================================================
CALL DYNAMIC IMAGE
==================================================================
<?php $img = pageImage(5); ?>
<?php if($img!="") { ?>
<img alt="" width="981" height="269" src="admin/pageImage/<?php echo $img; ?>"/>
<?php } ?>
======================================================================
CALL MAP
======================================================================
<iframe width="980" height="320" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Central+Park,+New+York,+NY,+USA&aq=0&sll=14.093957,1.318359&sspn=69.699334,135.263672&vpsrc=6&ie=UTF8&hq=Central+Park,+New+York,+NY,+USA&ll=40.778265,-73.96988&spn=0.033797,0.06403&t=m&output=embed"></iframe>
==================================================================
CALL FACEBOOK LIKEBOX
==================================================================
<iframe src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2FEcolAgroVenture&width=180&height=290&colorscheme=light&show_faces=true&header=true&stream=false&show_border=true&appId=698612683499956" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:184px; height:290px;" allowTransparency="true"></iframe>
======================================================================
CALL SIDEBAR MARQUEE NEWS
==================================================================
<p style="font-family: 'Scada', sans-serif; color:#034ea2; border-bottom:1px dashed #797b7d; padding-bottom:10px; margin:0px 0 0 12px; font-size:16px; text-transform: upercase; width: 88%;">News</p>
<marquee height="200px" width="183px" scrollamount="4" onmouseout="start()" onmouseover="stop()" direction="up">
<ul>
<li>Price Distribution on 16 Dec 2013</li>
<li>Offer anouncement on 16 Dec 2013</li>
<li>Sevices for Customers 15 Nov 2013</li>
<li>Offers for Temples on 17 Jun 2013</li>
<li>2% Tax Included on 12 sep 2013</li>
</ul>
</marquee>
=======================================================================
CALL SIDEBAR SERVICES
=======================================================================
<p style="font-family: 'Scada', sans-serif; color:#034ea2; border-bottom:1px dashed #797b7d; padding-bottom:10px; margin:7px 12px 0; font-size:16px; text-transform: upercase; width: 88%;">Services</p>
<ul>
<li><a href="solidwastemgnt.php">Solid Waste</a></li>
<li><a href="#">Waste Water</a>
<ul style="width:274px;">
<li><a href="effluenttreatment.php">Treatment</a></li>
<li><a href="bio.php">Bio-Remediation </a></li>
<li><a href="refinery.php">Refinery Oily</a></li>
</ul>
</li>
<li><a href="cat2.php">Agro and Food </a></li>
<li><a href="foulOdourGreenGases.php">Foul Odour </a></li>
<li><a href="cat1.php">Mushroom Farming</a>
<ul style="width:277px;">
<li><a href="quickcomposting.php">Composting </a></li>
<li><a href="quickcasing.php">Quick Casing </a></li>
</ul>
</li>
<li><a href="agriculture.php">Agriculture</a></li>
<li><a href="effluentTreatmentSolidWastePlant.php">Solid Waste Plant</a></li>
</ul>
=======================================================================
USE THIS CODE WHEN YOU WANT THIS PAGE====================================================================
<div class="left_sidebar">
<?php include('include/service.php'); ?>
</div>
===================================================
CALL PAGECONTENT DYNAMIC
==========================================
<?php echo pageContent(34) ;?>
================================================
CALL PAGE TITLE DYNAMIC
===================================================
<title><?php echo pageTitle('34'); ?> | EcolAgro Venture Pvt. Ltd.</title>
=================================================
<?php include("connect.php"); ?>
<?php include('include/header.php'); ?>
<?php include('include/footer.php'); ?>
**********************************************************************************
ENQUIRY.PHP
***********************************************************************************
Db.php
****************************************************************************
<?php$sql = mysql_connect('localhost','root','') or die("connection failed");
mysql_select_db('query',$sql) or die("connection failed");
?>
**************************************************************************
insert.php
***************************
<?php include('db.php');
if(isset($_POST['add'])){
$name = $_POST['nm'];
$mobile = $_POST['mob'];
$email = $_POST['email'];
$insert = "insert into student (Name,Mobile,Email) values ('$name','$mobile','$email')";
$result = mysql_query($insert);
//echo "value submitted successfully";
header('location: list.php');
}
?>
<form name="frm" method="post">
<table align="center" width="500px" border="2px solid black">
<tr>
<td>Name:</td>
<td> <input type="text" name="nm" value=""/>
</td>
</tr>
<tr>
<td>Mobile:</td>
<td> <input type="text" name="mob" value=""/>
</td>
</tr>
<tr>
<td>Email:</td>
<td> <input type="text" name="email" value=""/>
</td>
</tr>
<tr>
<td> <input type="submit" name="add" value="submit"/>
</td>
</tr>
</table>
</form>
******************************************
select.php
***********************
<?php
include('db.php');
$select = "select * from student";
$result = mysql_query($select);
while( $results = mysql_fetch_array($result))
{ ?>
<tr>
<td><?php echo $results['Name']; ?></td></br>
<td><?= $results['Mobile']; ?></td>
</tr>
<?php }
?>
*************************************************************
update.php
**************************************
<?php include('db.php');
$select = "select * from student where id='".$_REQUEST['id']."'";
$result = mysql_query($select);
$results = mysql_fetch_array($result);
if(isset($_POST['update'])){
$name = $_POST['nm'];
$mobile = $_POST['mob'];
$email = $_POST['email'];
$sql = "update student set Name='".$_REQUEST['nm']."', Mobile='".$_REQUEST['mob']."', Email='".$_REQUEST['email']."' where id='".$_REQUEST['id']."'";
mysql_query($sql);
//echo "value submitted successfully";
//header('location: list.php');
?>
<script type="text/javascript" language="javascript">
window.location='list.php';
</script>
<?php }
?>
<form name="frm" method="post">
<table align="center" width="500px" border="2px solid black">
<tr>
<td>Name:</td>
<td> <input type="text" name="nm" value="<?= $results['Name']; ?>" />
</td>
</tr>
<tr>
<td>Mobile:</td>
<td> <input type="text" name="mob" value="<?= $results['Mobile']; ?>" />
</td>
</tr>
<tr>
<td>Email:</td>
<td> <input type="text" name="email" value="<?= $results['Email']; ?>" />
</td>
</tr>
<tr>
<td> <input type="submit" name="update" value="submit"/>
</td>
</tr>
</table>
</form>
**************************************************
view.php
***********************************
<?php include('db.php');
$select = "select * from student where id='".$_REQUEST['id']."'";
$result = mysql_query($select);
$results = mysql_fetch_array($result);
?>
<table align="center" width="500px" border="2px solid black">
<tr>
<td>Name:</td>
<td> <?= $results['Name']; ?>
</td>
</tr>
<tr>
<td>Mobile:</td>
<td> <?= $results['Mobile']; ?>
</td>
</tr>
<tr>
<td>Email:</td>
<td> <?= $results['Email']; ?>
</td>
</tr>
<tr>
<td>
<a href="list.php">back</a>
</td>
</tr>
</table>
======================================================================
dbconnect.php
======================================================================
db.php
******************************************************************************
<?php
$sql = mysql_connect('localhost','root','') or die('connection failed');
mysql_select_db('lalit',$sql) or die('db not select');
?>
***********************************************************************************
list.php
***********************************************************************************
<?php include('db.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table align="center" border="1px solid black;" width="500px">
<a href="add.php">Add New</a>
<tr>
<td>Id</td>
<td>Name</td>
<td>Email</td>
<td>Message</td>
<td>Actions</td>
</tr>
<?php
$sql = "select * from emp ";
$query = mysql_query($sql);
while($result = mysql_fetch_array($query)){
?><tr>
<td><?php echo $result['id']; ?></td>
<td><?php echo $result['name']; ?></td>
<td><?= $result['email']; ?></td>
<td><?= $result['message']; ?></td>
<td><a href="update.php?id=<?php echo $result['id']; ?>">Update</a> | <a href="delete.php?id=<?php echo $result['id']; ?>">Delete</a> | <a href="view.php?id=<?php echo $result['id']; ?>">View</a></td>
</tr>
<?php }
?>
</table>
</body>
</html>
***********************************************************************************
insert(add).php
**********************************************************************************
<?php
include('db.php');
if(isset($_POST['add'])){
$name = $_POST['nm'];
$email = $_POST['eml'];
$message = $_POST['msg'];
$insert = "insert into emp (name,email,message) values ('$name','$email','$message')";
mysql_query($insert);
header('location: list.php');
}
?>
<form name="frm" method="post">
<table align="center" width="500px;" border="2px solid black;">
<tr>
<td>Name</td>
<td><input type="text" name="nm" value="" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="eml" value="" /></td>
</tr>
<tr>
<td>Message</td>
<td><input type="text" name="msg" value="" /></td>
</tr>
<tr>
<td><input type="submit" name="add" value="add" /></td>
</tr>
</table>
</form>
******************************************************************************
select.php
*******************************************************************************
<?php
$sql = "select * from emp";
$query = mysql_query($sql);
while($result = mysql_fetch_array($query)){
?><tr>
<td><?php echo $result['nm']; ?></td>
<td><?= $result['eml']; ?></td>
<td><?= $results['msg']; ?></td>
</tr>
<?php }
?>
***********************************************************************************
update.php
**********************************************************************************
<?php
include('db.php');
$select = "select * from emp where id='".$_REQUEST['id']."'";
$query= mysql_query($select);
$result = mysql_fetch_array($query);
if(isset($_POST['update'])){
$name = $_POST['nm'];
$email = $_POST['eml'];
$message = $_POST['msg'];
$insert = "update emp set name='".$_REQUEST['nm']."', email='".$_REQUEST['eml']."', message='".$_REQUEST['msg']."' where id='".$_REQUEST['id']."'";
mysql_query($insert);
header('location: list.php');
}
?>
<form name="frm" method="post">
<table align="center" width="500px;" border="2px solid black;">
<tr>
<td>Name</td>
<td><input type="text" name="nm" value="<?php echo $result['name']; ?>" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="eml" value="<?php echo $result['email']; ?>" /></td>
</tr>
<tr>
<td>Message</td>
<td><input type="text" name="msg" value="<?php echo $result['message']; ?>" /></td>
</tr>
<tr>
<td><input type="submit" name="update" value="update" /></td>
</tr>
</table>
</form>
******************************************************************************
view.php
*************************************************************************
<?php
include('db.php');
$insert = "select * from emp where id='".$_REQUEST['id']."'";
$query = mysql_query($insert);
$result = mysql_fetch_array($query);
?>
<form name="frm" method="post">
<table align="center" width="500px;" border="2px solid black;">
<tr>
<td>Name</td>
<td><?php echo $result['name']; ?></td>
</tr>
<tr>
<td>Email</td>
<td><?php echo $result['email']; ?></td>
</tr>
<tr>
<td>Message</td>
<td><?php echo $result['message']; ?></td>
</tr>
<tr>
<td><a href="list.php">Back</a></td>
</tr>
</table>
</form>
*********************************************************************************
delete.php
******************************************************************************
<?php
include('db.php');
$sql = "delete from emp where id='".$_REQUEST['id']."'";
mysql_query($sql);
header('location: list.php');
?>
**********************************************************************
HOW TO PRINT CURRENT DATE & UPCOMING DATE
==================================================================
<?php echo "Today Is :"." ".date("l")." ".date("Y-m-d")."<br>";
$da = date("l");
//$da = "Saturday";
if(($da === 'Monday') || ($da === 'Tuesday')){
echo " Your first delivery will arrive on the Next Monday "." ".date('Y-m-d', strtotime('next monday'));
}
elseif(($da === 'Wednesday') || ($da === 'Thursday')){
echo " Your first delivery will arrive on the Next Wednesday"." ".date('Y-m-d', strtotime('next wednesday')) ;
}
elseif(($da === 'Friday') || ($da === 'Saturday') || ($da === 'Sunday')){
echo " Your first delivery will arrive on the Next Friday"." ".date('Y-m-d', strtotime('next friday')) ;
}
?>
------------------------------------------------------------------------------------------
SOME IMP CODE FOR PRINT DATE
<?php //echo date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())); ?>
<?php //echo $weekBeginning = date('Y-m-d', Mage::getModel('core/date')->timestamp(strtotime('last monday')));
?>
<?php //echo "tody is" . date("l"); ?>
J QUERY
-----------------
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Date();
</script>
***********************************************************************
Mail.PHP(attach mail in html site without database)
-------------------------------------------------------------------
<?php
$email = $_POST['email'];
$mess = 'Name :'.$_POST['name'].'<br> Phone No. :'.$_POST['phone'].'<br> Company Name :'.$_POST['company'].'<br>Message : '.$_POST['message'];
$to = 'info@abitsingapore.com';
$subject = 'the subject';
$message = $mess;
$headers = 'From: $email ' . "\r\n" .
'Reply-To: $email ' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
***********************************************************************
SET DYNAMIC MENU USING SESSION
-------------------------------------------------------------------
INDEX.PHP
-----------------------------------
<?php session_start(); ?>
<?php
$_SESSION['nav'] = 1;
?>
-------------------------------------------------------------
MENU.PHP
----------------------------------------------
where current-menu-item is active class name
<ul id="main_menu" class="sf-js-enabled"><!--<li id="magic-line" style="left: 0px; width: 81px;"></li>-->
<li class="<?php if($_SESSION['nav'] ==1){echo 'current-menu-item';} ?>">
<a href="index.php"><span>Home</span></a> </li>
<li class="<?php
if($_SESSION['nav'] ==2){
echo 'current-menu-item';
}
?>">
<a href="portfolio.php"><span>Portfolio</span></a> </li></ul>
==========================================================
send_mail.php
------------------------------------------------------------
<?php
if(isset($_POST['submit'])){
$to = "tiwarilalit0027@gmail.com"; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$name = $_POST['name'];
$number = $_POST['number'];
$message = $_POST['message'];
$subject = "Message From ABBP";
$subject2 = "Thanks For ABBP ";
$message = $name . " " . $number . " wrote the following:" . "\n\n" . $_POST['message'];
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message,$headers2); // sends a copy of the message to the sender
echo "Mail Sent. Thank you " . $name . ", we will contact you shortly."; ?>
<script>window.location.href='contact.php';
</script>
<?php
}
?>
---------------------------------------------------------------------------------------
contact_us.php
---------------------------------
<form method="post" action="send_mail.php">
<div class="row clearfix">
<div class="col-md-4 col-sm-12 col-xs-12 form-group">
<input type="text" name="name" placeholder="Name *" required="">
</div>
<div class="col-md-4 col-sm-6 col-xs-12 form-group">
<input type="email" name="email" placeholder="Email *" required="">
</div>
<div class="col-md-4 col-sm-6 col-xs-12 form-group">
<input type="text" name="number" placeholder="Phone *">
</div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 form-group">
<textarea name="message" placeholder="Message"></textarea>
</div>
<div class="col-lg-12 text-center col-md-12 col-sm-12 col-xs-12 form-group">
<button class="theme-btn btn-style-one" type="submit" name="submit" value="submit">Submit</button>
</div>
</div>
</form>
*****************************************************
MY CRUD in PHP (Developed by self 8/30/22)
------------------------------------
folder name ->crud-demo
1- First create Database, tables and connection.php
2- Create Insert form and data inserted here
first include connection.php every page
3- View.php
4- update.php
5- Delete.php
---------------------
------connection.php--------------
<?php
$host="localhost";
$username="root";
$password="";
$db="crud_demo";
$con= mysqli_connect($host,$username,$password,$db);
// Create connection
//$conn = mysqli_connect('localhost','root','','dbtest');
if($con){
//echo "DB Connected Successfully";
}
else {
echo "DB not connected. Please check";
}
?>
--------------index.php--------------
<?php include("connection.php"); ?>
<html>
<head>
<title> PHP Crud Demo</title>
</head>
<body>
<div>
<form action="" method="post">
<input type="text" name="first_name" Placeholder="Enter your First Name"> <br><br>
<input type="text" name="last_name" Placeholder="Enter your Last Name"> <br><br>
<input type="number" name="age" Placeholder="Enter your Age"> <br><br>
<input type="submit" name="save_btn" value="Save">
<button> <a href="view.php">View</a></button>
</form>
</div>
<?php
if (isset($_POST['save_btn'])) {
$fname=$_POST['first_name'] ;
$lname=$_POST['last_name'];
$age=$_POST['age'];
$query="INSERT INTO student (firstname,lastname,age) VALUES('$fname','$lname','$age')";
$data=mysqli_query($con,$query);
if($data){
?>
<script>
alert('Data Inserted Successfully');
window.open("http://abc/crud-demo/view.php", "_self")
</script>
<?php
}
else {
?>
<script>
alert('Data Not Inserted. Please try again');
</script>
<?php
}
}
if (!isset($_POST['save_btn'])) {
?>
<script>
alert('Data Not Inserted. Please try again');
</script>
<?php
}
?>
</body>
</html>
--------view.php--------------
<?php include('connection.php'); ?>
<a href="index.php">Home</a>
<html>
<head>
<title> PHP Crud Demo</title>
</head>
<body>
<table border="1px solid #000" cellpadding='10px' cellspacing="0">
<tr>
<th>ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Age </th>
<th>Actions </th>
<th><a href="index.php">Add</a> </th>
</tr>
<?php
$query="SELECT * FROM student";
$data=mysqli_query($con,$query);
$result=mysqli_num_rows($data);
if($result > 0 ) {
echo "record found";
While($row=mysqli_fetch_array($data)) {
?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['firstname']; ?></td>
<td><?php echo $row['lastname']; ?></td>
<td><?php echo $row['age']; ?></td>
<td><a href="update.php?id=<?php echo $row['id']; ?>">Edit</a> | <a onclick="return confirm('Are you sure, you want to delete?')" href="delete.php?id=<?php echo $row['id']; ?>">Delete</a></td>
</tr>
<?php
}
}
else {
echo "record not found";
}
?>
</table>
</body>
</html>
----------------update.php--------------
<?php include("connection.php");
$id= $_GET['id'];
//echo $id
$query="SELECT * FROM student WHERE id='$id'";
$data=mysqli_query($con,$query);
$row=mysqli_fetch_array($data);
?>
<div>
<form action="" method="post">
<input type="text" name="first_name" value="<?php echo $row['firstname'] ?>" Placeholder="Enter your First Name"> <br><br>
<input type="text" name="last_name" value="<?php echo $row['lastname'] ?>" Placeholder="Enter your Last Name"> <br><br>
<input type="number" name="age" value="<?php echo $row['age'] ?>" Placeholder="Enter your Age"> <br><br>
<input type="submit" name="update_btn" value="Update">
<button> <a href="view.php">Back</a></button>
</form>
<?php
if( isset($_POST['update_btn']) ) {
$fname=$_POST['first_name'];
$lname=$_POST['last_name'];
$age=$_POST['age'];
$update="UPDATE student SET firstname='$fname', lastname='$lname', age='$age' WHERE id='$id'";
$data=mysqli_query($con,$update);
if($data){
?>
<script>
alert('Data Updated Successfully');
window.open("http://abc/crud-demo/view.php", "_self");
</script>
<?php
}
else {
?>
<script>
alert('Data Not Updated. Please check & try again');
</script>
<?php
}
}
?>
</div>
--------------delete.php--------------
<?php include("connection.php");
$id=$_GET['id'];
//echo $id;
//exit();
$delete="DELETE FROM student WHERE id='$id'";
$data=mysqli_query($con,$delete);
if($data) {
?>
<script>
alert("Data Deleted Successfully");
window.open("http://abc/crud-demo/view.php", "_self")
</script>
<?php
}
else {
?>
<script>
alert("Data Not Deleted. Please check & try again");
</script>
<?php
}
?>
********************************************************************************
-----MYSQL QUERYIES---------------------
$con= mysqli_connect($host,$username,$password,$db);
// Create connection
//$conn = mysqli_connect('localhost','root','','dbtest');
----------------------------------------
$query="INSERT INTO student (firstname,lastname,age) VALUES('$fname','$lname','$age')";
$data=mysqli_query($con,$query);
------------------------------------
$query="SELECT * FROM student";
$data=mysqli_query($con,$query);
$result=mysqli_num_rows($data);
While($row=mysqli_fetch_array($data)) {
------------------------------------------------
$id= $_GET['id'];
//echo $id
$query="SELECT * FROM student WHERE id='$id'";
if( isset($_POST['update_btn']) ) {
$fname=$_POST['first_name'];
$lname=$_POST['last_name'];
$age=$_POST['age'];
$update="UPDATE student SET firstname='$fname', lastname='$lname', age='$age' WHERE id='$id'";
}
-------------------------------------------------------------
$delete="DELETE FROM student WHERE id='$id'";
$data=mysqli_query($con,$delete);
=============================================================
php file upload size limit validation in xampp
-----------------------------------------------------------------------------------------------------
Try increasing the following values in php.ini, for example:
memory_limit = 1024M
upload_max_filesize = 56M
post_max_size = 128Mto phpmyadmin/config.inc.php
And Change php.ini and my.ini
- post_max_size = 750M
- upload_max_filesize = 750M
- max_execution_time = 5000
- max_input_time = 5000
- memory_limit = 1000M
- max_allowed_packet = 200M (in my.ini)
If you are xampp please go to
xampp\phpMyAdmin\libraries\config.default.php
Search for : $cfg[‘ExecTimeLimit’] = 600;
You can change ‘600‘ to any higher value, like ‘6000‘.
Maximum execution time in seconds is (0 for no limit).
=========================================================
Problem changing from PHP 5.6 to PHP 7.2
Fatal error: Declaration of NTN_Walker_Nav::start_el(&$output, $item, $depth, $args) must becompatible with Walker_Nav_Menu::start_el(&$output, $item, $depth = 0, $args = null, $id = 0)in H:\xampp\htdocs\wp\abc\wp-content\themes\abc-theme\inc\class-extends.php on line 14 --------------------------------------------------------Search the theme files for the function definition of start_el() inside the description_walker class. The line of code should look similar to this:
function start_el( $output, $item, $depth, $args ) {
Changing this line to the following should make the warning disappear:
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
=============================================================
Important Links
----------------------------------------------------------------------------------
http://www.bccfalna.com/website-vs-blog-short-sweet-and-simple-difference/
http://www.slideshare.net/vineetkumarsaini?utm_source=uploader_profile&utm_medium=ssemail&utm_campaign=upload_digest
Important Links
----------------------------------------------------------------------------------
http://www.bccfalna.com/website-vs-blog-short-sweet-and-simple-difference/
http://www.slideshare.net/vineetkumarsaini?utm_source=uploader_profile&utm_medium=ssemail&utm_campaign=upload_digest
https://www.geekyshows.com/
https://www.youtube.com/watch?v=n0xJk4iGO78&list=PLozpfQW4uw21RcDXeUTrAf1_-P7cP6HmL&index=4
php https://www.youtube.com/watch?v=QsAVoLPqkRQ&list=PLWCLxMult9xfYlDRir2OGRZFK397f3Yeb
Mobile app https://www.youtube.com/watch?v=aG9ssTDve94
Material design form
https://www.youtube.com/watch?v=rZ-aB10tLVQ
https://material.io/develop/web/getting-started