User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,504 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 2,683 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 PHP advertiser: Lunarpages PHP Web Hosting
Views: 1931 | Replies: 22
Reply
Join Date: Sep 2007
Posts: 30
Reputation: ronghel is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
ronghel ronghel is offline Offline
Light Poster

Re: enrollment system based php

  #11  
Sep 29th, 2007
i finished now all of the databases heheh...
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 643
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 72
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Practically a Master Poster

Re: enrollment system based php

  #12  
Sep 29th, 2007
since all the databases are done, please post the table names and the fields in each to so i can make the code. i typed up the login page but to use the mysql sever you need to have this page made for me.

SAVE AS mysql.php

<?php
$con = mysql_connect("host","username","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$database = mysql_select_db('db_name', $con);
if (!$database) {
echo "DATABASE COULDN'T BE SELECTED";
}
?>

Here is the html form

<form action="login.php" method="post">
<p>Username:<input type="text" name="user" /></p>
<p>Password:<input type="password" name="pass" /></p>
<p><input type="submit" name="submit" value="login" /><input type="reset" /></p>
</form>

Here is login.php

<?php
session_start();
if (!isset($_SESSION['user']) || !isset($_SESSION['pass'])) {
function check($fieldname)
{
if(!preg_match("/[^a-zA-Z0-9\.\-\Ä\ä\Ö\ö\Ü\ü\,\ ]+$/s",$fieldname)) {
return TRUE;
}
else {
return FALSE;
}
}
$user = $_REQUEST['user'];
$pass = $_REQUEST['pass'];
if (isset($_POST['submit'])) {
$error_msg = '';
$error = 0;
if ($user == NULL) {
$error_msg .= "Username field is not filled out\\n\\n";
$error++;
}
if (!$user == NULL && !check($user)) {
$error_msg .= "Username field contains illegal characters\\n\\n";
$error++;
}
if ($pass == NULL) {
$error_msg .= "Password field is not filled out\\n\\n";
$error++;
}
if (!$pass == NULL && !check($pass)) {
$error_msg .= "Password field contains illegal characters\\n\\n";
$error++;
}
if ($error > 0) {
$error_msg .= "There currently are " . $error . " errors";
echo '<script type="text/javascript">alert ("' . $error_msg . '");</script>';
}
if ($error == 0) {
include 'mysql.php';
$sql = "SELECT * FROM users WHERE users.username = '" . $user . "'";
$check = mysql_query($sql);
if (mysql_num_rows($check) == 0) {
die('Username doesn\'t exist');
}
while ($q = mysql_fetch_assoc($check)) {
if ($q['password'] !== $pass) {
die('Username or Password is incorrect');
}
$_SESSION['user'] = $user;
$_SESSION['pass'] = $pass;
$_SESSION['fname'] = $q['firstname'];
$_SESSION['lname'] = $q['lastname'];
echo '<meta http-equiv="refresh" content="0;url=member.php" />';
}
mysql_close($con);
}
}
else {
echo 'Please fill out the form first before visting this page';
}
}
else {
echo 'You are already logged in';
}
?>

It goes to a member.php page where the login name and first and last names are shown. other features will be added once you explain in more detail exactly what you want.
Reply With Quote  
Join Date: Sep 2007
Posts: 30
Reputation: ronghel is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
ronghel ronghel is offline Offline
Light Poster

Re: enrollment system based php

  #13  
Sep 29th, 2007
by the way i put the username password and the field names in the same field.. is it ok to that?

the table name is student
and the field names that needed to be shown is the last name, first name, middle initial, gender, birthdate,
yearlevel, course and email add thats the infos need to be shown after login...

in next page which is the encoding page ... this is where will i add subjects.. as i say is it possible that all of the available subjects will be display in a table and from there i'll just click what subject i want to enroll and it will be display in the table below?.. thx very much for hel keith! hihi...
Last edited by ronghel : Sep 29th, 2007 at 11:04 pm.
Reply With Quote  
Join Date: Sep 2007
Posts: 30
Reputation: ronghel is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
ronghel ronghel is offline Offline
Light Poster

Re: enrollment system based php

  #14  
Sep 29th, 2007
ms keith the login.form is now working... we can do now the display information page or the member.php
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 643
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 72
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Practically a Master Poster

Re: enrollment system based php

  #15  
Sep 29th, 2007
sorry about this, i know this might be a burden on you but i have a php code to create the student table. you have to delete yours first or the code will fail. i am doing this so there is no confusion of field names and such when i create the code.

here is the code:

<?php
$con = mysql_connect("host","username","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$database = mysql_select_db('db_name', $con);
if (!$database) {
echo "DATABASE COULDN'T BE SELECTED";
}
$sql = 'CREATE TABLE student(
id INT AUTO_INCREMENT PRIMARY KEY NOT NULL,
username VARCHAR(40) NOT NULL,
password VARCHAR(40) NOT NULL,
lname VARCHAR(40) NOT NULL,
fname VARCHAR(40) NOT NULL,
minitial VARCHAR(5) NOT NULL,
gender VARCHAR(30) NOT NULL,
birthdate VARCHAR(30) NOT NULL,
yearlevel VARCHAR(20) NOT NULL,
course VARCHAR(60) NOT NULL,
email VARCHAR(60) NOT NULL)';
$query = mysql_query($sql);
if (!$query) {
echo 'query unsuccessful';
}
else {
echo 'query ok';
}
mysql_close($con);
?>

just save it as something and run it on your server after filling out the database connect info.
Reply With Quote  
Join Date: Sep 2007
Posts: 30
Reputation: ronghel is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
ronghel ronghel is offline Offline
Light Poster

Re: enrollment system based php

  #16  
Sep 30th, 2007
ok its now finish! hehe...
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 643
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 72
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Practically a Master Poster

Re: enrollment system based php

  #17  
Sep 30th, 2007
to make the encoding page i will need a list of the courses/subjects you can take. also, where are the course you select going to be stored.
Reply With Quote  
Join Date: Feb 2008
Posts: 1
Reputation: inthan12 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
inthan12 inthan12 is offline Offline
Newbie Poster

Re: enrollment system based php

  #18  
Feb 5th, 2008
hey everyone, im a newbie here. can someone help me programming php with mysql? i need to figure out my pre-enlistment system online using these languages but im having trouble encoding. even a program of enrollment system could help. just want to have an idea how it works. plsssss.! i need it asap. thanks in advance....
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,628
Reputation: peter_budo is just really nice peter_budo is just really nice peter_budo is just really nice peter_budo is just really nice 
Rep Power: 12
Solved Threads: 311
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: enrollment system based php

  #19  
Feb 5th, 2008
Welcome to daniweb inthan12
If you have problem with your code you better post it and point as to your problematic areas. Unfortunately nobody will do it for you asap. Some more info can be found on
homework announcement.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, JAVAWUG (Java Web User Group), Coding the Architecture
Reply With Quote  
Join Date: Aug 2008
Posts: 11
Reputation: ajie6673 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
ajie6673 ajie6673 is offline Offline
Newbie Poster

Re: enrollment system based php

  #20  
Aug 21st, 2008
is there any final project for the php enrollment system. can i have a copy please...
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 3:37 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC