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
Old 09-01-2005, 12:07 PM sign up page
Novice Talker

Posts: 8
Trades: 0
hi everyone
i am currently making a clan site and need to make a join page. to do this i need i need to make a simple customizable page (as in the graphics and explanation text) which has 3 things to fill in, username password and info. i need the password box to be hashed.

this isnt a very important thing, and the password will just be used to get onto the server. so it would be ideal if the input text was saved to a text file and not some database.

so does anyone know of any premade scripts or have any advice on how to do this?

thanks
James001 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-01-2005, 02:38 PM
Novice Talker

Posts: 8
Trades: 0
Bump.
James001 is offline
Reply With Quote
View Public Profile
 
Old 09-01-2005, 03:52 PM
SpottyDog's Avatar
Skilled Talker

Posts: 82
Trades: 0
my advice is...............Dont be lazy!

Get out there and find a decent tutorial and learn how to do it.
Much better than copying sum1 elses script
SpottyDog is offline
Reply With Quote
View Public Profile
 
Old 09-01-2005, 06:16 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
I would suggest just making a start on it, with the help of a tutorial or a good book. If you have a specific problem or question once you get going, don't hesitate to ask.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 09-01-2005, 06:59 PM
Novice Talker

Posts: 8
Trades: 0
i dont plan on making php, i am just making a html site, and require 1 page to do this. do you know of any automated or premade php things that would work?
James001 is offline
Reply With Quote
View Public Profile
 
Old 09-01-2005, 08:11 PM
Novice Talker

Posts: 8
Trades: 0
you see i dont want to become a PHP programmer, i just need a simple php page which does this. any freeware stuff/premade scripts will do
James001 is offline
Reply With Quote
View Public Profile
 
Old 09-02-2005, 02:43 AM
lothop's Avatar
Ultra Talker

Posts: 303
Trades: 0
Have you searched at google yet?

Fooor, php member login?

Something along those lines.
OR
http://www.hotscripts.com/PHP/Script...uthentication/
__________________
Websites Created;
warscope.com
ratepayers.org.nz
lothop is offline
Reply With Quote
View Public Profile
 
Old 09-02-2005, 06:41 AM
Novice Talker

Posts: 8
Trades: 0
well from what i can see (and understand) all of those seem to rely on a 'login' system. i only want the details entered to be saved to a text file, which i have searched for and found nothing

do you know of any very basic scripts which would allow someone to enter in say 3 things (one of which was hashed), then when they press ok, it goes into a text file?
James001 is offline
Reply With Quote
View Public Profile
 
Old 09-02-2005, 06:50 AM
asm
Extreme Talker

Posts: 217
Location: UK.Lancashire(true)
Trades: 0
Quote:
i am just making a html site, and require 1 page to do this.
To convert the password with the md5() and then save it to a file it will have to use php (or some server side language).

Any script that writes to a file will do and then it can be modified to suit your purpose. Personally I never write to file I only use a database so I cannot help you with a script.
asm is offline
Reply With Quote
View Public Profile Visit asm's homepage!
 
Old 09-02-2005, 06:29 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
Using a database requires alittle extra setting up (not much) and is much more reliable and easier once you get started. Using files would get messy very quickly. If you still want to try it, look at the filesystem functions.

A rough way to go about this would be to build an html form which submits the signup details, process the form to make the details fit in one line of text, write that to the file. When someone logs in you can search the file and compare the details:

register.php:
PHP Code:
<?php
function display_form() { ?>
<form action="<?= $_SERVER['PHP_SELF'?>" method="POST">
<input type="text" name="username" />
<input type="text" name="realname" />
<input type="password" name="password" />
<input type="submit" name="submit" value="Submit the Form" />
</form>
<? }

function 
process_form() {
$str $_POST['username']. " " $_POST['realname'] . md5($_POST['password']);
$fp fopen("yourtextfile.txt","a"); // a is for 'append mode'
fwrite($fp,$str);
fclose($fp);
}

if( !isset(
$_POST['submit']) ) {
  
process_form();
}
else {
  
display_form();
}
login.php:
PHP Code:
<?php

function display_login() { ?>
<form action="<?= $_SERVER['PHP_SELF'?>" method="POST">
<input type="text" name="username" />
<input type="password" name="password" />
<input type="submit" name="submit" value="Login" />
</form>
<? }

function 
process_login() {
$lines file("yourtextfile.txt");

$found false;

foreach(
$lines as $value) {
  
$bits explode(" ",$value);
  
$username $bits[0];
  if(
$username != $_POST['username']) continue;
  
$found true;
  
$realname $bits[1];
  
$hpassword $bits[2];
  if(
md5($_POST['password']) == $hpassword)) {
     echo 
"correct, log the guy in";
  }
  else {
    echo 
"Incorrect password";
  }    
}
if(!
$found) echo "Username not found";
}
if( !isset(
$_POST['submit']) ) {
  
process_login();
}
else {
  
display_login();
}

Important functions for file handling:

fopen(filename,access type)

access type is "r" for read "w" for write and "a" for append, they can also be combined. See the PHP reference for more. Returns a file pointer.

fwrite(file pointer, text)

Writes a line to a file. If in append mode, puts the new line at the end.

fclose(file pointer)

Closes the file once you are done - remember to do this.

$array = file(filename)

Reads an entire file into an array, with one line in each element


Also useful is:
explode(separator, text)
Splits up a string into an array. In this case I use it to split apart the pieces of info on one line in the file.


This example gives you a rough idea I hope. A proper script would have to do more checks, like to check that the username is not blank, or maybe a 'retype the password' box in the form to make sure it was typed ok.

EDIT: I haven't tested the above, could have made some silly mistake.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)

Last edited by 0beron; 09-02-2005 at 06:32 PM..
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 09-03-2005, 09:05 PM
Novice Talker

Posts: 8
Trades: 0
You see this is the thing, I don't need a login, just a page which saves the details to either a log, or easily accesible file. I don't really know much about this, so could someone elaborate about how this would work?
James001 is offline
Reply With Quote
View Public Profile
 
Old 09-04-2005, 07:30 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
I that case you can ignore the second half of my post above, and just write the register page. Call it a guestbook if you want.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 09-05-2005, 06:55 AM
Novice Talker

Posts: 8
Trades: 0
ok i have put the first piece of code into the body of html. is there a piece of PHP which needs to be added so that it will be saved to the text file?
James001 is offline
Reply With Quote
View Public Profile
 
Old 09-06-2005, 02:49 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
This is what I posted originally:
PHP Code:
<?php
function display_form() { ?>
<form action="<?= $_SERVER['PHP_SELF'?>" method="POST">
<input type="text" name="username" />
<input type="text" name="realname" />
<input type="password" name="password" />
<input type="submit" name="submit" value="Submit the Form" />
</form>
<? }

function 
process_form() {
$str $_POST['username']. " " $_POST['realname'] . md5($_POST['password']);
$fp fopen("yourtextfile.txt","a"); // a is for 'append mode'
fwrite($fp,$str);
fclose($fp);
}

if( !isset(
$_POST['submit']) ) {
  
process_form();
}
else {
  
display_form();
}
It is designed to be put all on one page. First time you view it you see the form. Fill it in, submit the form, and the same page loads but it notices it has form data and so does not display the form - instead it calls process_form() to add to the text file.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Reply     « Reply to sign up page
 

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.67205 seconds with 12 queries