Jump to content

registration not working HELP


Ethandvv

Recommended Posts

I'm making a chat website for some friends and I've tried multiple types of registration pages but, i can't figure it out. Please Help.

This is what I have so far:

<div id="body contents">	<div align="center" id="form_holder">  	<form id="form_placement">    		Username:<input type="text" id="UN" name="UN" autocomplete="on" runat="server" />     	<br/>    		Password:<input type="password" id="PW1" autocomplete="off" runat="server" name="PW1" />    		<br/>    		Confirm:<input type="password" id="PW2" autocomplete="off" runat="server" name="PW2" />     	<br/>     	<input type="button" runat="server" id="submit_form" name="form_submition" onclick="saveFile()" value="Submit" />   	</form> 	</div> <h6 id="results" runat="server"></h6> </div> <div id="script contents"> <script type="text/javascript"> function saveFile() { var userid; userid=document.getElementById('UN'); var passid; passid=document.getElementById('PW1'); var confirmid; confirmid=document.getElementById('PW2');  if (passid.name == confirmid.name)  {  document.getElementById('reults').innerHTML= "File save as "+ userid +" and "+ passid +".";  alert('Saved file succesfully.')  if (userid.name === 0)   {   fopen('users.txt').mkdir(userid.name ++ passid.name);   fclose()   }  } else  {  alert('Sorry Username or Password is taken, or is incorrect.');  } } </script>

Any suggestions?

Link to comment
Share on other sites

Should I simplify it? Like this: ( I got messed up in the making and got myself confused, sorry )

function saveFile(){var userid;userid=document.getElementById('userid');var passid;passid=document.getElementById('passid');var passwordConfirm;passwordConfirm=document.getElementById('confirm'); if (passid == passwordConfirm) { /* Then some how save the userid and passid to external file, then close it */ }else { alert('Sorry, Passwords do not match.'); }}

Thats better i think

Edited by Ethandvv
Link to comment
Share on other sites

You won't be able to do that with Javascript, nor would you want to, since you would only be doing that on the clients machine. You will need a server side language, like PHP, and ideally a database.

  • Like 1
Link to comment
Share on other sites

I would start by reviewing some tutorials on PHP like the ones offered by w3schools as a way to ease into the material and get familiar with the syntax and the nature of server side languages in general. Then I would look for registration/login tutorials on the web, as well as familiarizing yourself with this post

http://w3schools.invisionzone.com/index.php?showtopic=12509

 

Regarding your Mac, I'm not sure what the issue. I use OSX full time for development and have not had any issues when it came to installing or configuring anything. My reference is based on setting up a similar environment on my CentOS rackspace server. I found either environments more or less the same in regards to setup and maintenance.

Link to comment
Share on other sites

Thanks, tons! JS wasn't working and now i know why, lol. I've read into the PHP a little and have a Question for you:

When (after the user has submited the form), the PhP script starts if I use the $file=mkdir(fname == 'username') would i use that to make a new directory with the users 'username' or not?

Link to comment
Share on other sites

You can use mkdir($username), assuming that $username is a valid directory name for the operating system. That will make the directory inside the current working directory (usually the directory of the script that is running). If you want to make it somewhere else then use the entire path.

Link to comment
Share on other sites

look up the documentation for mkdir

http://www.w3schools.com/php/func_filesystem_mkdir.asp

http://us2.php.net/mkdir

 

your current syntax wouldn't work.

Edited by thescientist
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...