educratsweb logo


Php code example for login 

 

Login.php

Create a login.php file where you take input user name and password as shown the figure.
<?php
include("config.php");
session_start();
if($_SERVER["REQUEST_METHOD"] == "POST")
{
// username and password sent from form
$myusername=addslashes($_POST['adminuser']);
$mypassword=addslashes($_POST['adminpass']);
$sql="SELECT * FROM admin WHERE adminuser='$myusername' and adminpass='$mypassword'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
$active=$row['active'];
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1)
{
session_register("myusername");
$_SESSION['login_adminuser']=$myusername;
header("location: index.php");
}
else
{
$error="Your Login Name or Password is invalid";
}
}
?>
<h2>Login</h2>
<form action="" method="post">
  <label>UserName  : </label>
  <br />
  <input type="text" name="adminuser" id="txtbox"/>
  <br />
  <br />
  <label>Password  : </label>
  <br />
  <input type="password" name="adminpass" class="box" id="txtbox" />
  <br/>
  <br />
  <input type="submit" value=" Submit " id="btn"/>
  <br />
</form>
<div style="font-size:11px; color:#cc0000; margin-top:10px"><?php echo $error; ?></div>
</div>

Config.php


Create a configuration file through you connect the mysql databse or any other configuration.
<?php
$mysql_hostname = "localhost";
$mysql_user = "your username ";
$mysql_password = "your password";
$mysql_database = "Your database";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Opps some thing went wrong");
mysql_select_db($mysql_database, $bd) or die("Opps some thing went wrong");
?>

lock.php


<?php
include('config.php');
session_start();
$user_check=$_SESSION['login_adminuser'];
//$ses_sql=mysql_query("select empuser from employeelogin where empuser='$user_check' ");
//$row=mysql_fetch_array($ses_sql);
$login_admin_session=$user_check;
if(!isset($login_admin_session))
{
header("Location: login.php");
}
?>

index.php


after successful login this is your secure page.
<?php
include('lock.php');
?>
<h2>WELCOME in Login Portal</h2> | <a href=’logout.php’>Logo out</a>

logout.php
after successful login this is your secure page.
<?php
session_start();
if(session_destroy())
{
header("Location: login.php");
}
?>
 

Database Structure

Table name : admin
CREATE TABLE `admin` (
  `adminuser` varchar(20) NOT NULL default '',
  `adminpass` varchar(20) NOT NULL default '',
  PRIMARY KEY  (`adminuser`),
  UNIQUE KEY `adminpass` (`adminpass`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


This is a sample login page. You can modify or use it for your project.

educratsweb.com

Posted by: educratsweb.com

I am owner of this website and bharatpages.in . I Love blogging and Enjoy to listening old song. ....
Enjoy this Author Blog/Website visit http://twitter.com/bharatpages

if you have any information regarding Job, Study Material or any other information related to career. you can Post your article on our website. Click here to Register & Share your contents.
For Advertisment or any query email us at educratsweb@gmail.com

RELATED POST
1. Private Sector Participation in Space Sector
Government has created Indian National Space, Promotion &Authorization Centre (INSPACe), under Department of Space to encourage, promote and hand hold the private sector for their participation in Space Sector. Private players will also be able to use ISRO infrastructure through INSPACe.The decision of Government was conveyed to the Members of the scientific community elaborately, and scientific community welcomed the Government decision. The role of New Space India Limited (NSIL) in the po
2. Rajya Sabha passes Indian Institutes of Information Technology Laws (Amendment) Bill, 2020 today
Rajya Sabha passed Indian Institutes of Information Technology Laws (Amendment) Bill, 2020 in New Delhi today. The Indian Institutes of Information Technology Act of 2014 and Indian Institutes of Information Technology (Public-Private Partnership) Act, 2017 are the unique initiatives of the Government of India to impart knowledge in the field of Information Technology to provide solutions to the challenges faced by the country.The Indian Institutes of Information Technology Laws (Amendment) Bill, 2020 wa
3. Tips when hiring a software development company
In an increasingly competitive market, the software and app development company is beginning to be in high demand. New technologies are the future. Society lives surrounded by all kinds of smart devices. As a result of this need, every day more people want to have their own app and/or software. When you have the development of an app or software in mind, you must take a series of steps so that this project ends up being a reality. The first is to think about subcontracting a co
4. Workshop to mark 20 years of Himalayan Chandra Telescope to highlight the science it produced
In the cold, dry desert of Ladakh, 4500 meters above the mean sea level, for two decades, the 2-m diameter optical-infrared Himalayan Chandra Telescope (HCT) at the Indian Astronomical Observatory (IAO) has been scanning the night sky in search of stellar explosions, comets, asteroids, and exo-planets. The telescope remotely operated using a dedicated satellite communication link from the Centre for Research & Education in Science & Technology (CREST), Indian I
5. Prime Minister Narendra Modi to inaugurate the summit Responsible AI for Social Empowerment 2020 on October 5
Ministry of Electronics and Information Technology (MeitY) and NITI Aayog are organizing a Global Virtual Summit on Artificial Intelligence (AI), RAISE 2020- ‘Responsible AI for Social Empowerment 2020,’ from October 5-9, 2020. The Summit will be inaugurated by Prime Minister Shri Narendra Modi in the august presence ofMinister of Electronics & IT, Communications and Law &Justice, Shri Ravi Shankar Prasad, eminent global AI expert Professor R
6. National GIS-Enabled Land Bank System
Government has integrated Industrial Information System (IIS) portal with the GIS System of six States in first phase to provide updates on land availability and plot level information to investors anywhere in the world on real time basis and help them make informed decisions.   For the development of National Land Bank, Government intends to solicit the details of industrial land with plot level information, connectivity thereto, basic facilities, other facilities available and
7. Education Minister virtually attends Diamond Jubilee Celebration of Commission for Scientific and Technical Terminology
Union Minister of Education Shri Ramesh Pokhriyal ‘Nishank’ virtually attended Diamond Jubilee Celebration of Commission for Scientific and Technical Terminology (Department of Higher Education) as Chief Guest today. Union Minister of State for Education Shri Sanjay Dhotre also attended the event through video conferencing as Guest of Honor. The Commission has done important work in the creation and development of Scientific and Technical Terminology for Hindi and other Indi
8. माइक्रोमैक्स की वापसी:- राहुल शर्मा ने इमोशनल वीडियो शेयर करके कहा- चीनी मोबाइल ने मुझे मेरे देश में ही पछाड़ा, अब देश के लिए ला रहा हूं IN मोबाइल
Micromax India ने इन-सीरीज के साथ वापसी का ऐलान कर दिया है। कंपनी नई In Series को 2 नवंबर को लॉन्च कर सकती है।
9. Get Ready to Learn RPA Blue Prism
We are living in the midst of a digital era. Technology can enable us to  automate  business processes using Artificial Intelligence (AI) and software rather than people, wherever possible. A technology for this purpose is Robotic Process Automation (RPA). RPA can have a transformative impact on organizations by lowering costs, increasing reliability, and executing quickly. It can also let IT
10. CSIR-CMERI comes up with High Flow Rate Water Purification Technology for Fluoride and Iron Removal
NEED OF THE TECHNOLOGY: The contamination of fluoride and iron in drinking water is increasing day by day. Iron is the most abundant trace element in human body, responsible for accomplishment of vital biological functions such as gastrointestinal processes and the regulation of body temperature. But when iron level in water is beyond 0.3 ppm (as per WHO guideline), it shows several adverse effects including liver disease, irregular heart rhythm and neuronal disorder etc.
11. Government is implementing several schemes to encourage students/youth of the country towards the field of science and technology: Dr. Harsh Vardhan
It has been a part of Government’s Science and Technology (S&T) policy toencourage the students/youth of the country towards the field of science and technology. The first three key elements of Science, Technology, and Innovation (STI) Policy of 2013 Are: Promoting the spread of scientific temper amongst all sections of society. Enhancing skill for applications of science among the young from all social strata. Making careers in scienc
12. The top Python developers in the United States
Python is a Swiss Army Knife for programmers. It is a veteran programming language present in many applications and operating systems. We can find it running on servers, in iOS, Android, Linux, Windows or Mac applications. This is because it has a moderate learning curve and because its philosophy emphasizes offering a readable code syntax. It is a versatile multiplatform and multiparadigm programming language that stands out for its readable and clean code. On
13. 11 Digital Education Tools For Teachers And Students
The Most Popular Digital Education Tools For Teachers And Learners Hundreds of digital education tools have been created with the purpose of giving autonomy to the student, improving the administration of academic processes, encouraging collaboration, and facilitating communication
14. Department of Science & Technology is having three binational Centres
Presently the Department of Science & Technology, Govt. of India is having three binationalCentres namely Indo-French Centre for Promotional of Advanced Research (IFCPAR)established with France in 1987, Indo-US Science & Technology Forum (IUSSTF) established in2000 with USA and Indo-German Science & Technology Centre (IGSTC) established in 2010under inter-governmental agreements. During last three years, the following new programmes have been launched by these binationalCentres:
15. CSIR-KPIT demonstrates Hydrogen Fuel Cell fitted car
Council of Scientific and Industrial Research (CSIR) and KPIT successfully ran trials of India’s first Hydrogen Fuel Cell (HFC) prototype car running on an indigenously developed fuel cell stack at CSIR-National Chemical Laboratory, Pune. The fuel cell is a low temperature PEM (Proton Exchange Membrane) type Fuel Cell that operates at 65-75 degree centigrade, which is suitable for vehicular applications.
16. Successful Flight Test of SMART
Supersonic Missile Assisted Release of Torpedo (SMART) has been successfully flight tested today 5th Oct 2020 at 1145 hrs from Wheeler Island off the coast of Odisha. All the mission objectives including missile flight upto the range and altitude, separation of the nose cone, release of Torpedo and deployment of Velocity Reduction Mechanism (VRM) have been met perfectly. The tracking stations (Radars, Electro Optical Systems) along the coast and the telemetry stations including down range ships
17. IPFT developes Bio-Pesticide Formulation for insect control in seed spice crops as safe alternative to chemical pesticides
 The institute of Pesticide Formulation Technology  (IPFT ) under the Department of Chemicals and Petrochemicals ,Ministry of Chemicals and Fertilizers in collaboration with ICAR- National Research Center on Seed Spices (NRCSS), Ajmer, Rajasthan has successfully developed new Aqueous Suspension formulation technology of bio-pesticide based on  entomo-pathogenic fungus Verticillium lecanii.  
18. Indian Astronomers discover one of the farthest Star galaxies in the universe.
As a landmark achievement in Space missions, Indian Astronomers have discovered one of the farthest Star galaxies in the universe.
19. Tata Motors Limited to supply 150 Nexon XZ+ electric compact SUVs & Hyundai Motor India Ltd. to supply 100 units of its Kona electric Premium SUVs
Energy Efficiency Services Limited (EESL), a Super Energy Service Company (ESCO) under the administrative control of Ministry of Power, Government of India, will procure 250 electric vehicles from Tata Motors and Hyundai Motor India. The companies were selected through an international competitive bidding process, which was aimed at increased participation. Tata Motors Limited and Hyundai Motor I
20. 321 Free Tools for Teachers - Free Educational Technology
Jacob Lund/Shutterstock.com Free Educational Technology for Teachers Do you support Free Technology for Teachers? If Yes, I highly encourage you to share this Free Educational Technology Reso
21. From Touchless Soap & Water Dispenser, Mechanical Ventilator to Pioneering E-classroom Software or Low-cost Rapid Diagnostic Device and Innovating Air Providing Virus Destroying Mask, Covid 19 has forced Scientists to Seek for Fastest Innovations to Survive, Opine Researchers
Miss Digantika Bose studies in Class XII at Memari V M Institution Unit II, Burdwan. But in her tender age she is very much influenced by the principle of Thomas Alva Edison that ‘To invent, you need a good imagination and a pile of junk’. And as the proverb goes, Necessity is the mother of invention, Digantika has felt the utter helpless- ness of common people in the wake of Covid 19 pandemic to survive and has come up with Air Providing and Virus Destroying Mask which has received the accla
22. Science, Technology and Innovation Policy, 2020
Science, Technology and Innovation Policy, 2020 Science, Technology and Innovation Policy, 2020 Introduction As India and the world reorient in the wake of the COVID-19 crisis, a landmark policy initiative has been flagged by the Government of India. The Science, Technology and Innovation Poli
23. Study showing stars of varied ages can co-exist in open clusters, provides clue to stellar evolution in the Milky Way Galaxy
Study showing stars of varied ages can co-exist in open clusters, provides clue to stellar evolution in the Milky Way Galaxy Stars in our Galaxy are formed from the molecular clouds present in the Galaxy. It is believed that the majority of stars in our Galaxy are formed in the star clusters making them important clues to understand the star formation mechanism. Open star clusters are a system of stars bound by gravity in which stars are born from the same molecular clouds. All the stars in a
24. IACS Kolkata INSPIRE faculty’s work on Black Holes and Gravitational Waves to help understanding fundamentals of our nature
IACS Kolkata INSPIRE faculty’s work on Black Holes and Gravitational Waves to help understanding fundamentals of our nature Dr. Sumanta Chakraborty from School of Physical Sciences and School of Mathematical and Computational Sciences at the Indian Association for the Cultivation of Science (IACS) Kolkata, a recipient of the INSPIRE faculty award instituted by the Department of Science & Technology, Govt of India has provided new ways to look into the thermodynamic properties of bla
25. Prime Minister inaugurates RAISE 2020 - a Mega Virtual Summit on Artificial Intelligence
Prime Minister Shri Narendra Modi  inaugurated RAISE 2020, a Mega Virtual Summit on Artificial Intelligence (AI) today. RAISE 2020 is a global meeting of minds to exchange ideas and chart a course for using AI for social transformation, inclusion and empowerment in areas like Healthcare, Agriculture, Education and Smart Mobility, among other sectors. The Prime Minister praised the organizers for encouraging discussion on Artificial Intelligence. He said Technology has transformed our workp
26 बिहार तकनीकी सेवा आयोग | आयुष चिकित्सा पदाधिकारी की नियुक्ति हेतु विज्ञापान #Bihar 5 Days Remaining for Apply
बिहार तकनीकी सेवा आयोग | आयुष चिकित्सा पदाधिकारी की नियुक्ति हेतु विज्ञापान बिहा ...
27 Research Officer Recruitment in IOCL R&D Centre Faridabad #Jobs 4 Days Remaining for Apply
 Research Officer Recruitment in IOCL R&D Centre Faridabad IOCL-Research Officer Recruitment 2020 Indian Oil Corporation Limited (IOCL), has its Research and Development (R&D) Centre at Faridabad near Delhi. Indian Oil R&D Centre Faridabad is looking for energetic and dedicated PhDs for recruitment as Research Officer/Research Manager in the R&D Centre in various research areas. IOC R&D centre invites online application on prescribed format ...
28 IAV KSCSTE Scientist and Technical Recruitment 2020 Vacancy #Scientist & Research 28 Days Remaining for Apply
Kerala State Council for Science, Technology and Environment (KSCSTE) is an autonomous body under the government of Kerala. Applications on prescribed format are invited for the Recruitment to the Government Job Vacancy posts of Scientist E2, Scientist-C, Technical Officer & Technical Assistant in the Institute of Advanced Virology (IAV), Thonnakal, Thiruvananthapuram (Kerala). ...
29 Educational talent search program, ALLEN academics young talent search program for students | TALLENTEX 2021 #Scholorship 22 Days Remaining for Apply
Educational talent search program, ALLEN academics young talent search program for students | TALLENTEX 2021For student Studying in class 5th, 6th, 7th, 8th, 9th & 10th Stage-1 : Online | Stage-2 : Offline / CBT ...
We would love to hear your thoughts, concerns or problems with anything so we can improve our website educratsweb.com ! visit https://forms.gle/jDz4fFqXuvSfQmUC9 and submit your valuable feedback.
Save this page as PDF | Recommend to your Friends

http://educratsweb(dot)com http://www.educratsweb.com/content.php?id=667 http://educratsweb.com educratsweb.com educratsweb