Page 3 of 5
Re: Enhanced register page.
Posted: Fri Aug 21, 2009 12:53 am
by Torniquet
ok all i could find regarding that parse error is to many else's.
looking at the code i have posted there doesnt seem to be anything wrong (and there shouldnt be as its a direct copy from my working one)
what its basically telling you is that your code is structured something like......
Code: Select all
if(.....){
}else if(....){
}else{
}else{
}
or something similar.
in order for it to react like that.... you need to have edited the code in some places. (removed the else if's and replaced them with else's or slapped another else on the end.)
make sure there is not more than ONE else command in your if sequences. if you stil cant find the problem. post the entire code up
enjoy xx
Re: Enhanced register page.
Posted: Sat Aug 29, 2009 10:06 pm
by devil777777
really nice guide, it helped me out more than having a good login. I am currently learning php and when i was reading about the strlen and strpos fuctions i didn't unstand what and when they would be used for. I was thinking wth would i want to search for a word or figure out how long a string is, until i was reading through your script and saw it being used in action

(it immediately went from seeming useless to a cool useful tool) anyways, thanks a ton for this
Re: Enhanced register page.
Posted: Sat Aug 29, 2009 10:57 pm
by Torniquet
you are more than welcome
im usually in the same boat as you lol. i dont understand soemthings use untill i see it in action. then it makes perfect sense
my site is gettin there slowly. so once i have got it to a more functionable stage i will look through and see what other code i can explain and release for yall to adapt and learn from.
will do a pming system with multi receivers (more than one recepiant :p) so once i have figured that out i will deffo be puttin that up here

has a nice little feature in it i am dying to try out lol
xx
Re: Enhanced register page.
Posted: Sun Aug 30, 2009 3:50 am
by devil777777
cant wait for that one ;] havent seen a game yet with a multiple recipient mailing system (or whatever you would call it!)
and the site i am learning everything from gives me stupid examples of how everything is so it does help alot to see a script for what i want to do (pretty much where i am learning it from only shows an example of how to write your own name 10,000 times using functions, arrays and everything else to write the sentences ;[ pretty lame, lol)
Re: Enhanced register page.
Posted: Sun Aug 30, 2009 6:59 am
by Noctrine
devil777777 wrote:cant wait for that one ;] havent seen a game yet with a multiple recipient mailing system (or whatever you would call it!)
There is a reason for that.
Re: Enhanced register page.
Posted: Sun Aug 30, 2009 11:19 am
by Torniquet
Noctrine wrote:devil777777 wrote:cant wait for that one ;] havent seen a game yet with a multiple recipient mailing system (or whatever you would call it!)
There is a reason for that.
care to share? lol
Re: Enhanced register page.
Posted: Sun Aug 30, 2009 5:30 pm
by ModOps
devil777777 wrote:cant wait for that one ;] havent seen a game yet with a multiple recipient mailing system (or whatever you would call it!)
There is quite a few I know tbh.
It works really well and saves hell loads of time.
Re: Enhanced register page.
Posted: Thu Sep 03, 2009 2:23 am
by Torniquet
Noctrine wrote:devil777777 wrote:cant wait for that one ;] havent seen a game yet with a multiple recipient mailing system (or whatever you would call it!)
There is a reason for that.
i am still awaiting an answer to why you say there is a reason that games dont have a mass mailing system 0.o ( im sure there are some out there as i think i have seen them)
there is no reason why a game cant have one. forumshave them... and they are coded with php and mysql

my game has one :p limits to 10 recipients, only players over a certain level can send mass pms, and dont send to non existant players.
Re: Enhanced register page.
Posted: Tue Apr 06, 2010 5:55 pm
by alexander19
Congratulations on the tutorial man,its very good.
The thing is that I tried to use the email verification part into hall's reguser.php script and it worked well(after registering I was able to recieve the verification email) but it had a small problem...in the verification link the id didnt appear but only the pass ,so it was something like :
http://www.worldofbattle.co.cc/activati ... d52ed113dc ....so there is no id number,I've checked the code numerous times but had no ideea where the problem is.
I'll post the reguser.php code :
Code: Select all
<?php
include_once 'connect.php';
if(!isset($_SESSION['id'])){
if(isset($_COOKIE['idCookie'])){
$id = $_COOKIE['idCookie'];
$_SESSION['id'] = $id;
header("Location: http://www.netrixnetwork.com/centralCommand.php");
exit();
}
}else if(isset($_SESSION['id'])){
header("Location: http://www.netrixnetwork.com/centralCommand.php");
exit();
}
$player=$_POST['player'];
$password=$_POST['password'];
$pass2=$_POST['pass2'];
$player=strip_tags($player);
$email=$_POST['email'];
$email=strip_tags($email);
$classchoice=$_POST['classchoice'];
if ($email == "")
{
echo "You didn't enter a email address!<br>";
echo " <A href='register.php'>Go back</a>";
exit;
}
if ($password==$pass2)
{
$isplayer="SELECT * from players where name='$player'";
$isplayer2=mysql_query($isplayer) or die("Could not query players table");
$isplayer3=mysql_fetch_array($isplayer2);
if(!$_POST['password'] || !$_POST['pass2'])
{
print "You did not enter a password<br>";
echo " <A href='register.php'>Go back</a>";
exit;
}
else if($isplayer3 || strlen($player)>21 || strlen($player)<1)
{
print "There is already a player of that name or the name you specified is over 16 letters or less than 1 letter";
echo " <A href='register.php'>Go back</a><br>";
exit;
}
else
{
$isaddress="SELECT * from players where email='$email'";
$isaddress2=mysql_query($isaddress) or die("not able to query for password");
$isaddress3=mysql_fetch_array($isaddress2);
if($isaddress3)
{
print "There is already a player with that e-mail address";
echo " <A href='register.php'>Go back</a><br>";
exit;
}
else
{
$password=md5($password);
$classquery="SELECT * from classes where name='$classchoice'";
$classquery2=mysql_query($classquery) or die("Could not query classes");
$classquery3=mysql_fetch_array($classquery2);
$SQL = "INSERT into players(id, name, password, email, level, exper, attack, defense, hpoints, maxhp, spoints, maxspoints,pclass,gold,sign_up_date) VALUES ('$id','$player','$password','$email','1','0','$classquery3[attack]','$classquery3[defense]','$classquery3[hpoints]','$classquery3[hpoints]','$classquery3[spoints]','$classquery3[spoints]','$classquery3[name]','100',now())";
mysql_query($SQL) or die("could not register");
print "Thank you for registering!";
$to = "$email";
$from = "admin@worldofbattle.co.cc";
$subject = "Complete World of Battle registration";
//Begin HTML Email Message
$message = "Hi $player,
Complete this step to activate your login identity at World of Battle.
Click the line below to activate when ready.
http://www.worldofbattle.co.cc/activation.php?id=$id&sequence=$password
If the URL above is not an active link, please copy and paste it into your browser address bar
Login after successful activation using your:
Username: $player
Password: $pass2
See you on the site!
admin@worldofbattle.co.cc";
//end of message
$headers = "From: $from\r\n";
$headers .= "Content-type: text\r\n";
mail($to, $subject, $message, $headers);
$msgToUser = "<h2>One Last Step - Activate through Email</h2><h4>OK $player, one last step to verify your email identity:</h4><br />
In a moment you will be sent an Activation link to your email address.<br /><br s/>
<br />
<strong><font color=\"#990000\">VERY IMPORTANT:</font></strong>
If you check your email with your host providers default email application, there may be issues with seeing the email contents. If this happens to you and you cannot read the message to activate, download the file and open using a text editor. If you still cannot see the activation link, contact site admin and briefly discuss the issue.<br /><br />
";
exit();
}
}
}
else
{
print "Your password didn't match or you did not enter a password";
echo " <A href='register.php'>Go back</a><br>";
exit;
}
echo " <A href='index.php'>Login Page</a><br>";
?>
Re: Enhanced register page.
Posted: Tue Apr 06, 2010 9:57 pm
by Torniquet
ok for a start you are not accually setting the id...
this should be an auto incrament collumn in your database...
so you dont need to insert it.
$SQL = "INSERT into players(name, password, email, level, exper, attack, defense, hpoints, maxhp, spoints, maxspoints,pclass,gold,sign_up_date) VALUES ('$player','$password','$email','1','0','$classquery3[attack]','$classquery3[defense]','$classquery3[hpoints]','$classquery3[hpoints]','$classquery3[spoints]','$classquery3[spoints]','$classquery3[name]','100',now())";
mysql_query($SQL) or die("could not register");
that is what you want.
also i have noticed that the insertid() command dont always work...
so to get the newly created id run this query
$newID = mysql_fetch_assoc(mysql_query("SELECT id FROM players WHERE name='$player' LIMIT 1"));
$id = newID['id'];
that should work (y)