Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Lionsanime Directory   Improve your ranking, submit to directories   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 10-30-2007, 10:57 AM   #1 (permalink)
Inactive
 
Join Date: 10-30-07
Posts: 4
iTrader: 0 / 0%
Latest Blog:
None

djp_phillips is liked by many
member area

I followed this tutorial
http://www.trap17.com/index.php/php-...ial_t7887.html

And found it quite simple and easy, but I am having a problem, on the register part i find a problem that I don't understand, when I register on this page:

http://www.euroherp.com/register.php

and click ok, I get an error message telling me an error occured on line 56, which is the line saying:

"Header("Location: register.php?op=thanks"); "

So I don't understand, can someone help me?

Also, when I look at my database, the user I just submitted is there, and when I go to the "login page" (http://www.euroherp.com/login.php) and login with the inofrmation that is in my database, I get told "Sorry, could not log you in. Wrong login information."
djp_phillips is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 10-31-2007, 04:49 AM   #2 (permalink)
Inactive
 
Join Date: 10-30-07
Posts: 4
iTrader: 0 / 0%
Latest Blog:
None

djp_phillips is liked by many
This is my code on the registration page (http://www.euroherp.com/register.php), that after a success ful registration i get this error message
===
Warning: Cannot modify header information - headers already sent by (output started at /home/content/d/a/n/danielphillips/html/01euroherp/register.php: in /home/content/d/a/n/danielphillips/html/01euroherp/register.php on line 56
===
Where line 56 is to do with this:

===
Code:
else { // Redirect to thank you page. Header("Location: register.php?op=thanks"); } } // end if
===

Here is the page code:

Code:
<?php // dbConfig.php is a file that contains your // database connection information. This // tutorial assumes a connection is made from // this existing file. include ("dbConfig.php"); //Input vaildation and the dbase code if ( $_GET["op"] == "reg" ) { $bInputFlag = false; foreach ( $_POST as $field ) { if ($field == "") { $bInputFlag = false; } else { $bInputFlag = true; } } // If we had problems with the input, exit with error if ($bInputFlag == false) { die( "Problem with your registration info. " ."Please go back and try again."); } // Fields are clear, add user to database // Setup query $q = "INSERT INTO `dbUsers` (`username`,`password`,`email`) " ."VALUES ('".$_POST["username"]."', " ."PASSWORD('".$_POST["password"]."'), " ."'".$_POST["email"]."')"; // Run query $r = mysql_query($q); // Make sure query inserted user successfully if ( !mysql_insert_id() ) { die("Error: User not added to database."); } else { // Redirect to thank you page. Header("Location: register.php?op=thanks"); } } // end if //The thank you page elseif ( $_GET["op"] == "thanks" ) { echo "<h2>Thanks for registering!</h2>"; } //The web form for input ability else { echo "<form action=\"?op=reg\" method=\"POST\">\n"; echo "Username: <input name=\"username\" MAXLENGTH=\"16\"><br />\n"; echo "Password: <input type=\"password\" name=\"password\" MAXLENGTH=\"16\"><br />\n"; echo "Email Address: <input name=\"email\" MAXLENGTH=\"25\"><br />\n"; echo "<input type=\"submit\">\n"; echo "</form>\n"; } // EOF ?>

Also after verifying in mySQL the registration, and finding it successful, I go to the login page (http://www.euroherp.com/login.php)
and I already have these error messages:

===
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/content/d/a/n/danielphillips/html/01euroherp/login.php: in /home/content/d/a/n/danielphillips/html/01euroherp/login.php on line 9

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/content/d/a/n/danielphillips/html/01euroherp/login.php: in /home/content/d/a/n/danielphillips/html/01euroherp/login.php on line 9
===

And when I enter my correct login info, I get refused

Here is my code for the login page:

===
Code:
<?php session_start(); // dBase file include "dbConfig.php"; if ($_GET["op"] == "login") { if (!$_POST["username"] || !$_POST["password"]) { die("You need to provide a username and password."); } // Create query $q = "SELECT * FROM `dbUsers` " ."WHERE `username`='".$_POST["username"]."' " ."AND `password`=PASSWORD('".$_POST["password"]."') " ."LIMIT 1"; // Run query $r = mysql_query($q); if ( $obj = @mysql_fetch_object($r) ) { // Login good, create session variables $_SESSION["valid_id"] = $obj->id; $_SESSION["valid_user"] = $_POST["username"]; $_SESSION["valid_time"] = time(); // Redirect to member page Header("Location: members.php"); } else { // Login not successful die("Sorry, could not log you in. Wrong login information."); } } else { //If all went right the Web form appears and users can log in echo "<form action=\"?op=login\" method=\"POST\">"; echo "Username: <input name=\"username\" size=\"15\"><br />"; echo "Password: <input type=\"password\" name=\"password\" size=\"8\"><br />"; echo "<input type=\"submit\" value=\"Login\">"; echo "</form>"; } ?>
===

Last edited by djp_phillips : 10-31-2007 at 04:58 AM.
djp_phillips is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Members Area OzeTigerman Web Design Lobby 3 09-18-2007 06:34 AM
Dropdown area City Aggregation Coding Forum 29 05-24-2007 10:55 PM
text area andybhoy Web Design Lobby 19 05-14-2007 02:14 AM
Lyrics script + admin area + member + db(128k songs) for sale rightinpoint SEO Forum 4 12-27-2004 10:51 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 09:48 PM.
© Copyright 2008 V7 Inc