Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Login and Registration Script help.
Old 02-05-2009, 06:21 AM Login and Registration Script help.
xKroNiiK's Avatar
Novice Talker

Posts: 9
Trades: 0
Hey, this may be a newb question, but i ain't really experienced with PHP and was hoping someone could help me out.

I have a Login and Registration script, 6 files to be exact. They are;

Registration
Login
Confirm
Confirm_Pass
Forgot_Pass
Level_Access

I have uploaded them to my Host, created the MySQL DB and all. But the problem is, how do i link that to my actual webpages? So that the login shows, and works, under my Member Access content box?

If this is advertising, sorry. Please remove the link or ask and i will, but i just would like to show what i mean.

http://www.nowaii-iitz-anime.net

See the member access area on the right column? How do i enable that to actually work?

Hope someone can clear this up for me.

Thanks,
Gaz.
xKroNiiK is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-05-2009, 11:01 AM Re: Login and Registration Script help.
spyderwebtech's Avatar
Skilled Talker

Posts: 51
Trades: 0
To get your form to post the variables to your script you need to change your "action" attribute in your form to the name of the script... say for this case "Login.php"

Right now you action is set to nothing...so it will do nothing.

That is all the advise I can give you because we do not know the nature of the script you are trying to use. However, I will say this, you have a lot scripts to manage the logging process.

Research "Sessions" which is a way of tracking variables from page to page. Most likely you could manage all these senarios with only a few lines of code in one script.
spyderwebtech is offline
Reply With Quote
View Public Profile
 
Old 02-05-2009, 01:39 PM Re: Login and Registration Script help.
xKroNiiK's Avatar
Novice Talker

Posts: 9
Trades: 0
Do you mean i could have a secure login and registration system with the email verification and forgot password features, in just a few lines of script? oO How?

To be honest, i have NO idea what to do. xD

This is the code i have for my form under my Member Login area, is there anything wrong with it? How do i make it so this form actually works? And if the visitor isnt a member, i can transfer them to a registration form?

PHP Code:
<form action="" method="post">
    <fieldset>
    <?php
if (isset($_POST['submitted'])) {
    
    
// Validate the email address:
    
if (empty($_POST['email'])) {
        echo 
'<p class="error">enter your email!</p>';
    }
    }
    
?>    
    <p><b>Email Address:</b> 
      <input type="text" name="email" size="20" maxlength="40" />
    </p>
    
    <?php
if (isset($_POST['submitted'])) {

// Validate the password:
    
if (empty($_POST['pass'])) {
        
        echo 
'<p class="error">Enter your password!</p>';
    }

// End of VALIDATING.
?>


    <p><b>Password:</b> <input type="password" name="pass" size="20" maxlength="20" /></p>
    <div align="center"><input type="submit" name="submit" value="Login" /></div>
    <input type="hidden" name="submitted" value="TRUE" />
    </fieldset>
</form>
Thanks.
xKroNiiK is offline
Reply With Quote
View Public Profile
 
Old 02-05-2009, 03:39 PM Re: Login and Registration Script help.
spyderwebtech's Avatar
Skilled Talker

Posts: 51
Trades: 0
Where in the world did you get this script? It has to be really old! No one uses PHP to validate a username or password anymore. Most people use either straight javascript or an AJAX library.

but if you insist on using these scripts... change the following:

the "action" attribute in the form
Code:
<form action="HERE" method="post">
    <fieldset>
has got to be set to your login script file name, which I am assuming is Login.php or something like that.

I also noticed that your file name is not index.php but index.html.... if you want PHP code to run it must have a .php file extention (unless you change it in your server configuration). I hate to even ask... are you running PHP?

type the following code into a new file named test.php, upload, and run from your server
Code:
<?php

echo phpinfo();
?>
Do you see anything?

good luck... you will most likely need it.
spyderwebtech is offline
Reply With Quote
View Public Profile
 
Old 02-05-2009, 05:57 PM Re: Login and Registration Script help.
xKroNiiK's Avatar
Novice Talker

Posts: 9
Trades: 0
Oh. I tried the .PHP extension and also didn't work. =/ Yes, i am running PHP.

Forget that then. Do you know of any good, or recommended Login/Registration scripts that are easy to apply to me website?

Sorry for the "newbiness." xD

Thanks.
xKroNiiK is offline
Reply With Quote
View Public Profile
 
Old 02-05-2009, 07:22 PM Re: Login and Registration Script help.
Defies a Status

Posts: 1,606
Trades: 0
Not all of us agree with the opinions expressed by spyderwebtech.

I copied your code above and will look at it in the morning.

I will post what I find after I do.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 02-06-2009, 07:41 AM Re: Login and Registration Script help.
spyderwebtech's Avatar
Skilled Talker

Posts: 51
Trades: 0
Quote:
Originally Posted by colbyt View Post
Not all of us agree with the opinions expressed by spyderwebtech.

I copied your code above and will look at it in the morning.

I will post what I find after I do.

Hey that is the great thing about these forums.... everyone's got an opinion.

Personally, I think it is a waste of bandwidth to submit a form to a separate PHP file, just to have it use more bandwidth to re-download the entire page after it "figures out" that you have no user name or password.

Why not use the client's resources to do that work?

But to each it's own... there are a million ways to skin the same cat in web programming.
spyderwebtech is offline
Reply With Quote
View Public Profile
 
Old 02-06-2009, 08:25 AM Re: Login and Registration Script help.
xKroNiiK's Avatar
Novice Talker

Posts: 9
Trades: 0
Well, I really need a login and registration script, and as I said, I'm a newb to all this. xD

So any help would really be appreciated.

Thanks!
xKroNiiK is offline
Reply With Quote
View Public Profile
 
Old 02-06-2009, 10:26 AM Re: Login and Registration Script help.
Defies a Status

Posts: 1,606
Trades: 0
Your form as it was written was not working and it really isn't validating anything except that an entry was made. I posting a working copy below. When you copy the source from this board paste it into notepad to kill the VB formatting. Then you can save it.

Your confirm password and email sequence (comparing them to a DB entry or where ever you have them stored should go where I have //start action here and must be inside the closing } for the isset conditional. There is really no need to have 6 scripts to do this job.

Code:
<?php
 
 
if (isset($_POST['submitted'])) {
    // Validate the email address:
    if (empty($_POST['email'])) {   echo '<p class="error"> Go back and enter your email!</p>'; exit;  }
    // Validate the password:
    if (empty($_POST['pass'])) {  echo '<p class="error">Go back and enter your password!</p>'; exit;    }
    Echo "You have  validated an entry for email and password"; //debug only
    echo "<br >Now you put your action sequence below";
    // End of VALIDATING.
   // Start action do whatever you want 
 
 
 
 
  // End action exit is needed to keep the form from showing again
 exit;
 } //closing brace for (isset($_POST['submitted']))i
 
 
if (!isset($_POST['submitted'])) {
?> 
<!----html form below  -->
<form action="" method="post">
    <fieldset>
    <p><b>Email Address:</b> 
      <input type="text" name="email" size="20" maxlength="40" />     </p>
    <p><b>Password:</b> <input type="password" name="pass" size="20" maxlength="20" /></p>
 
    <div align="center"><input type="submit" name="submit" value="Login" /></div>
    <input type="hidden" name="submitted" value="TRUE" />
    </fieldset>
 </form>
<!--End --html form below  -->
 
 
 
<?php 
} // closing brace for (!isset($_POST['submitted']))
?>
Java would allow you to validate the syntax of what was entered but learning two things at one time may be more than you care to do. This will do the job for you and unless your site is very busy server load is minimal.

Happy Scripting.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 02-06-2009, 11:32 AM Re: Login and Registration Script help.
xKroNiiK's Avatar
Novice Talker

Posts: 9
Trades: 0
Eh.. Thank's.

So i put that where i want the form on my index page? :S
xKroNiiK is offline
Reply With Quote
View Public Profile
 
Old 02-06-2009, 01:24 PM Re: Login and Registration Script help.
Defies a Status

Posts: 1,606
Trades: 0
The php code has to be on the page and the form does also. You will want to enclose the form in a div or table to control the size of it. Right now it is full width.

Then you have to figure out where the usename and password are stored and then compare them to what is entered. That might be a database either musql or flatfile. If everyone is going to share the same UN and pass it could be really simple.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 02-06-2009, 03:26 PM Re: Login and Registration Script help.
xKroNiiK's Avatar
Novice Talker

Posts: 9
Trades: 0
Ok. So i put the form you gave me on my main page under the member access area (http://nowaii-iitz-anime.net ; to the right.)

This is the MySQL i currently have;

Code:
CREATE TABLE users (
user_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
first_name VARCHAR(20) NOT NULL,
last_name VARCHAR(40) NOT NULL,
email VARCHAR(80) NOT NULL,
pass CHAR(40) NOT NULL,
user_level TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
active CHAR(32),
registration_date DATETIME NOT NULL,
PRIMARY KEY (user_id),
UNIQUE KEY (email),
INDEX login (email, pass)
);
Correct?

Also, how about if a visitor wants to join, how do i redirect them to a working registration form?

Cheers.
xKroNiiK is offline
Reply With Quote
View Public Profile
 
Old 02-06-2009, 04:15 PM Re: Login and Registration Script help.
Defies a Status

Posts: 1,606
Trades: 0
The code above is your sql insert information.

You need to wrtite a query to insert the information from the form into the database,

But

You also need to sanitize that input before you allow it to be inserted. You need to study striptags() and addslashes() and mysql_escape before you allow the general public to insert stuff into a database.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 02-06-2009, 06:10 PM Re: Login and Registration Script help.
xKroNiiK's Avatar
Novice Talker

Posts: 9
Trades: 0
Eh.. Forget it. I have no idea what you are going on about.

Thanks anyway i guess.

All i really want to know is how to set up a secure Login and Registration system, that allows visitors to either login with the quick login box on my mainpage (if they're an existing member,) or allow them to click a link that redirects them to a registration page that requires them to choose a username, valid email (which will send them email validation upon completing registration,) and a password. Also with a forgot password feature, which sends them a temp pass via email. Once they become a member, they can also edit they're profile.

As i said, i have basically no knowledge of PHP, and i understand it'll take quite some time before i have enough to do this. Hence why i am asking here. I hope someone can help me.

Thank's.

Last edited by xKroNiiK; 02-07-2009 at 09:10 AM..
xKroNiiK is offline
Reply With Quote
View Public Profile
 
Old 02-07-2009, 11:10 AM Re: Login and Registration Script help.
xKroNiiK's Avatar
Novice Talker

Posts: 9
Trades: 0
Something like this; http://www.myspace.com/

The login box on the homepage with a link that redirects you to a registration page.

Sorry for the double post. x_x

Edit: Does this look any good? http://www.awesomephp.com/?Membership-2

Last edited by xKroNiiK; 02-07-2009 at 12:42 PM..
xKroNiiK is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Login and Registration Script help.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.45972 seconds with 12 queries