•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 423,396 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,603 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 705 | Replies: 2
![]() |
•
•
Join Date: Jul 2007
Posts: 106
Reputation:
Rep Power: 2
Solved Threads: 2
Hey
I'm having a bit of trouble. I am currently learning php and mysql to access my servers database and collect data. In which i want to use a username and password form. However in the meen time i would like to create one using plain html and javascript. I am quite experienced with javascript, although i have forgotten how to load variables from an external .txt file. Otherwise my users would simply be able to view my source code and see the username and password they need to type.
Any help on this is greatly appreciated
thanks
I'm having a bit of trouble. I am currently learning php and mysql to access my servers database and collect data. In which i want to use a username and password form. However in the meen time i would like to create one using plain html and javascript. I am quite experienced with javascript, although i have forgotten how to load variables from an external .txt file. Otherwise my users would simply be able to view my source code and see the username and password they need to type.
Any help on this is greatly appreciated
thanks
Well, you would probably have better luck asking this over in the javascript forum, as this one is just Java.
From the php standpoint though, here is a simple login form and verification for a small site I put together for a local grayhound group. Maybe it will help you along:
File: index.php
File: loginck.php
From the php standpoint though, here is a simple login form and verification for a small site I put together for a local grayhound group. Maybe it will help you along:
File: index.php
php Syntax (Toggle Plain Text)
<html> <title>Greyhound Adoptions</title> <LINK REL="StyleSheet" HREF="default.css" TYPE="text/css"> <body> <center> <h1>Greyhound Adoptions</h1><BR> <form action='loginck.php' method=post> <table border='0' cellspacing='0' cellpadding='0' align=center> <tr id='cat'> <tr><td><font face='verdana, arial, helvetica' size='2' align='center'> Login ID </font></td> <td align='center'><font face='verdana, arial, helvetica' size='2'><input type ='text' name='userid' ></font></td> </tr> <tr><td><font face='verdana, arial, helvetica' size='2' align='center'> Password</font></td> <td align='center'><font face='verdana, arial, helvetica' size='2'><input type ='password' class='bginput' name='password' ></font></td> </tr> <tr><td colspan='2' align='center'><font face='verdana, arial, helvetica' size='2' align='center'> <input type='submit' value='Submit'> <input type='reset' value='Reset'></font></td> </tr> <tr> <td colspan='2' align='center'><font face='verdana, arial, helvetica' size='2' align='center'> </font></td> </tr> </table> </form> </center> </body> </html>
File: loginck.php
php Syntax (Toggle Plain Text)
<?php session_start(); include "dbConn.php"; $userid = $_POST['userid']; $password = $_POST['password']; $userid=mysql_real_escape_string($userid); $password=mysql_real_escape_string($password); $password = md5($password); if($rec=mysql_fetch_array(mysql_query("SELECT * FROM users WHERE name='$userid' AND pwd = '$password'"))){ if(($rec['name']==$userid)&&($rec['pwd']==$password)){ $_SESSION['id']=session_id(); $_SESSION['userId']=$userid; header("Location: viewDogs.php"); } } else { session_unset(); echo "<font face='Verdana' size='2' color=red>Wrong Login. Use your correct Userid and Password and Try <br><center><input type='button' value='Retry' onClick='history.go(-1)'></center>"; session_destroy(); } ?>
Last edited by Ezzaral : Sep 7th, 2007 at 4:51 pm. Reason: messed up code tags
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Error Loading operating System (Windows NT / 2000 / XP / 2003)
- Very slow loading Windows XP Pro...HELP! (Windows NT / 2000 / XP / 2003)
- problem with fstream (C++)
- Loading and accessing 2 Dimensional tables (C++)
- Problems loading websites (Web Browsers)
- Loading CPU (Windows 9x / Me)
- error loading operating system (Windows NT / 2000 / XP / 2003)
- Loading Bar Problem (Web Browsers)
- IE 6.0 freeze while loading (Web Browsers)
- Error Linking KeyLogger.exe (C++)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: IQ question
- Next Thread: Help regarding comparison of String in JS



Linear Mode