Jump to content

Recommended Posts

show the users.php file you made, you can't output anything before a header redirect.

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>
    <title>Fledge Press - Login</title>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <link rel="stylesheet" type="text/css" href="/fledge_styles.css">  
    <style type="text/css">
    </style>
</head>

<body>

<?php include("nav_ads.php"); ?>

<div id="main">

<h4>Login:</h4>

<?php include("login.php"); ?>

<h4>Or register a new account:</h4>

<?php include("register.php"); ?>

<h4>Why register?</h4>

<p>Registry is required in order for you to access downloadable content. It doesn't cost you anything - unless you want to become a supporter!</p>

</div>

<?php include("bottom.php"); ?>

</body>

</html>

 

as for the duplicate entry, that username is already registered in the database

 

I deleted the row in phpMyAdmin and tried again, and still got the same error.

your ads outputs data, so must not be first, in register and also login there are header redirects

 

you are also including both login and register in the same form

 

place href links to them instead, thats the way it's set up and to do redirections

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>
    <title>Fledge Press - Login</title>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <link rel="stylesheet" type="text/css" href="/fledge_styles.css">  
    <style type="text/css">
    </style>
</head>

<body>

<?php include("nav_ads.php"); ?>

<div id="main">

<h4><a href="login.php">Login</a></h4>

<h4>Or <a href="register.php">Register</a> a new account:</h4>

<h4>Why register?</h4>

<p>Registry is required in order for you to access downloadable content. It doesn't cost you anything - unless you want to become a supporter!</p>

</div>

<?php include("bottom.php"); ?>

</body>

As a note..if you want the login to be on another page..you can just make a form that leads to the login page.

 

Now as for your problem.

 

Are you using all of these exact files in this post?

http://www.phpfreaks.com/forums/index.php?topic=338735.msg1596372#msg1596372

the others were different

 

Did you drop the table and create a new one with these values?

CREATE TABLE dbUsers
(
id int NOT NULL AUTO_INCREMENT,
username varchar(32) Unique,
password char(32),
email varchar(32),
PRIMARY KEY (id)
)

 

I assure you everything works as expected, besides better error messages on a few items.

Make sure there are no spaces before you opening <?php tag.  That should take care of the header error.  The other is because the db table's username column is set to a unique key.  Which means it will only store a username IF it doesn't already exist.  This is a good thing, because you don't want two people with the same name.  If that error shows up, then it is because the database is working correctly.

CREATE TABLE IF NOT EXISTS `dbusers` (
  `id` int(11) NOT NULL auto_increment,
  `username` varchar(32) collate utf8_unicode_ci default NULL,
  `password` char(32) collate utf8_unicode_ci default NULL,
  `email` varchar(32) collate utf8_unicode_ci default NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

Make sure there are no spaces before you opening <?php tag.  That should take care of the header error.  The other is because the db table's username column is set to a unique key.  Which means it will only store a username IF it doesn't already exist.  This is a good thing, because you don't want two people with the same name.  If that error shows up, then it is because the database is working correctly.

 

"Invalid login" is not the error for duplicate data, is it? And I'm getting it when I submit login information, not registry information.

Make sure there are no spaces before you opening <?php tag.  That should take care of the header error.  The other is because the db table's username column is set to a unique key.  Which means it will only store a username IF it doesn't already exist.  This is a good thing, because you don't want two people with the same name.  If that error shows up, then it is because the database is working correctly.

 

"Invalid login" is not the error for duplicate data, is it? And I'm getting it when I submit login information, not registry information.

 

Sorry, X out my whole post, as I didn't see "page 2".  Oh, the eyes are getting to old.

Although I feel this is an ok registration system if wanted to add custom items to it, but still lacking many features.

 

You could try this one perhaps using jquery

http://tutorialzine.com/2009/10/cool-login-system-php-jquery/

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.