473,785 Members | 2,363 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Php signup problem

jon
Hey, i've been trying to create a signup page that asks for a
username, password and then to confirm the password. It is suppose to
check how long both of them are, and if the passwords line up, that
went well, but i can't make it check to see if it is being used by
someone else. heres the script, good luck.

/
*************** **********signu p.html********* *************** *************** *************** *************/
<fieldset>
<form method="POST"ac tion="signup.ph p">
Username: <input type="text"name ="user"/><br/>
Password: <input type="password" name="passa"/><br/>
Confirm password: <input type="password" name="passb"/><br/>
<input type="submit"va lue="Submit"/>
</form>
</fieldset>
/
*************** *************** *************** *************** *************** *************** **************/
/
*************** *signup.php**** *************** *************** *************** *************** *************/
<?php
/********Get info********/
$user = $_POST["user"];
$pass_a = $_POST["passa"];
$pass_b = $_POST["passb"];
/*************** **********^^^^^ ^^^^^^********* *************** */
/******Key varibles******/
$flag = "OK";
$msg = "";
$num = "0";
/*************** **********^^^^^ ^^^^^^********* *************** */
/********Validat e Form***/
if(strlen($user ) <6)
{
$msg=$msg."(Ple ase enter username that is more then 6 characters in
length)<br/>";
$flag="NOTOK";
}

if(strlen($pass _a) < 6)
{
$msg=$msg."(Ple ase enter password that is more then 6 characters in
length)<br/>";
$flag="NOTOK";
}

if($pass_a != $pass_b)
{
$msg=$msg."(You r passwords don't line up)<br/>";
$flag="NOTOK";
}

/*********check for username******* */

$file_a = fopen("user.txt ", "r");

$i = 0;
while(!feof($fi le_a))
{
$userA[$i] = fgets($file_a);
$i++;
}

for($n=0; $n<$i; $n++)
{
$num = $num + substr_count($u serA[$n], $user);
}
fclose($file_a) ;

if($num >= 1)
{
$flag = "NOTOK";
$msg=$msg."(You r username has already been taken)<br/>";
}
/*************** **********^^^^^ ^^^^^^********* *************** */
if($flag != "OK")
{
echo "<center>$m sg <br<input type='button' value='Retry'
onClick='histor y.go(-1)'></center>";
}

else
{
$file_a = fopen("user.txt ", "a");
$file_b = fopen("pass.txt ", "a");

fwrite($file_a, "\n,\"$user\"") ;
fwrite($file_b, "\n,\"$pass_a\" );
echo "congrates you have now signed into the secret page<br/>";
fclose($file_a) ;
fclose($file_b) ;
}

?>
/
*************** *************** *************** *************** *************** *************** *************** */
/*************** ************Use r.txt********** **not
real*********** *************** *************** **********/
"blah"
"blank"
"blog"
"bloogg"
/
*************** *************** *************** *************** *************** *************** *************** **/

Feb 2 '07 #1
0 1426

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4999
by: Rudi Ahlers | last post by:
I tried the following: http://intranet/signup.php?Domain=newdomain.com, and it doesn't seem to return any values In my script I have the following: <? print $_POST; $DomainName = $_POST; print $DomainName;
3
2182
by: David | last post by:
hi i have a basic signup POST form, with php on the same page. how do i return to this page with all the entries still present, yet with a message at the top, for when the user enters one invalid entry? cheers dave
3
1654
by: Dustin | last post by:
I am developing a website where users can sign up for a service. They essentially can become a memeber. It will allow anyone to sign up, but I need to make it so only humans can sign up. I need to avoid any automatic scripts that could create tons of bogus accounts. What I believe is the best solution for me is to have an image appear as part of the form they fill out to get the account. In the image will be scrambled text. The user...
2
1461
by: .Net Sports | last post by:
I need to find a script that whereas a user signs up for your website and when he hits submit, an email goes to his email box with a confirmation link (generated by random number) for him to click so to ensure he has a valid email address. Does anyone know of a package or series of scripts that works with this? I'm using CDO mail in ASP. Thanks netsports
6
2642
by: atcohaz | last post by:
Hi everybody, I have a personal server (I learning) with Linux with using Cpanel I only need such script which enables me to create email accounts without logging into cPanel. And in which I can provide our visitors email account facilities with script and User cans signup automatically and I can specific quota, username & password length etc. (and which don’t show my Cpanel username and password to users) I have tried script ...
1
1134
by: siddu | last post by:
Hi .. I am having signup page that contains username,pwd,confpwd,Email,Address and one save button . when user enter his details and press save button it should save details in database. i have done upto here.But my problem is: if Email Entered already Exsists in database then it should display a message that Email already exists in Database. For this what i have to write Code .Pls send me the Code . i want to display user in the...
2
1145
by: fredtbx | last post by:
Using ASP.NET 2.0 Login control and CreateUserWizard Hi, I can't figure out how, when I have the Login control up on Login.aspx and if the user doesn't have an account, to point to Signup.aspx which has the CreateUserWizard on it. I have the site set up so trying to access any page without being authenticated brings you back to Login.aspx. How can I make it so from Login.aspx, if the user doesn't have an account yet, he can click a "Sign...
1
3254
by: kang jia | last post by:
hi when user entered particulars in signuppage and click" signup" button, i will direct them to do_signup.php. if say the NRIC is dupicate in datebase, i will redirect them back to signup page again to re-signup, however, i would like to remain all the correct infromation, and let users re-entered their NRIC. how can i do this. can i use Session, but it seems cant work. any one can help me? my code in signup page is like this: ...
2
1829
by: nazgul42 | last post by:
Ok... this is my third problem today, but here goes: On my signup page for my login system on my website, I have some code that is supposed to check if a username is already taken and give an error if it is. The problem is that I submit a set of values, and it works as expected. Then I submit the same set of values, and it enters them into the database anyways. this is my code: <?php session_name("SIGNUP"); session_start();...
0
10356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10161
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9958
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8986
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7506
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5523
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3662
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2890
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.