<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Building Browsergames - Latest Comments in Building Browsergames: The Registration Page (PHP)</title><link>http://bbgames.disqus.com/</link><description></description><atom:link href="https://bbgames.disqus.com/building_browsergames_the_registration_page_php/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 30 Oct 2014 08:25:26 -0000</lastBuildDate><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-1660960582</link><description>&lt;p&gt;I am newbie, I have sucessfully set up an online database for a game i am trying to make. Then i saved this php code as a .php file and then i imported it in my server, but it isn't working. Do i need to change any part of this code to make it work?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Tahmid Hossain</dc:creator><pubDate>Thu, 30 Oct 2014 08:25:26 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-1437395710</link><description>&lt;p&gt;So, after I figure out which my data go where ($dbhost,  $dbuser,  $dbpass and  $dbname - I THINK I did it right coz before I got error connecting to MySQL, and now I dont get that error), I got msg: Congratulations, you registered successfully! &lt;br&gt;but my page stays at register, and data wasnt send to db "users". So I guess I didnt conect to MySQL or I do something wrong. MAybe my dbname is wrong? Should that be my "users" table in phpMyAdmin? Or something else? Coz I put code like this:&lt;br&gt;dbhost is "localhost"&lt;br&gt;dbuser is "name I have where I created database in phpmyadmin&lt;br&gt;dbpass is "pass I connect to server and basicly to all else"&lt;br&gt;dbname is "so I put just "users" for tabel at phpmyadmin"&lt;br&gt;Do you see where I go wrong? Im self learner and english is not my native language so it is double hard for me -.-"&lt;br&gt;Please help =) TY!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ScarFaceCRO</dc:creator><pubDate>Mon, 16 Jun 2014 04:03:24 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-1305360740</link><description>&lt;p&gt;Hullo Maruz,&lt;/p&gt;&lt;p&gt;sorry for my English - I'm foreign. I find that idea with storing a unique salt value in the database interesting, I will try it in my next project. :)&lt;br&gt;I also want to add my idea as well... :) I chop the password through the middle and put the salt between the two parts... which places I change. &lt;br&gt;md5($passwordpart2.SALT.$passwordpart1);&lt;/p&gt;&lt;p&gt;Have a nice day,&lt;br&gt;Pandora&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Pandora</dc:creator><pubDate>Thu, 27 Mar 2014 02:36:37 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-1247503080</link><description>&lt;p&gt;I am getting issues with the &lt;span&gt; portions showing up in my page immediately after loading it. I have the page saved in my server www directory, checked, double checked, and even quadruple checked the code with everything everyone has posted. I still can't get it to go away until after "Register!" is clicked. Please help!&lt;/span&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stephen M.</dc:creator><pubDate>Sun, 16 Feb 2014 23:03:44 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-856185435</link><description>&lt;p&gt;But how to use php code just when I click on register button ? Sorry for bad English&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Serbia</dc:creator><pubDate>Mon, 08 Apr 2013 05:16:11 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-439515799</link><description>&lt;p&gt;Great ...... thank you very much&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">saeed albairaq</dc:creator><pubDate>Wed, 15 Feb 2012 00:43:21 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-375869350</link><description>&lt;p&gt;This  is my huge happiness to visit your site and to like your excellent post. Continue on posting and thanks for sharing this .&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Telugu Movie</dc:creator><pubDate>Wed, 30 Nov 2011 09:42:01 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-369345817</link><description>&lt;p&gt;Healthy and interesting, have a hard deciding what I really think of it all.&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.newbanglamovie.com/" rel="nofollow noopener" target="_blank" title="http://www.newbanglamovie.com/"&gt;bangla natok&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">bangla movie</dc:creator><pubDate>Mon, 21 Nov 2011 09:43:31 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-203479604</link><description>&lt;p&gt; You need to put your server information between $dbhost= 'HERE' and all the other...&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rokas Rimkevicius</dc:creator><pubDate>Sat, 14 May 2011 04:15:06 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-197772957</link><description>&lt;p&gt;Hey - so I'm trying to create the Query on the 'Users' table (the &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Benjamin Vangeel</dc:creator><pubDate>Thu, 05 May 2011 12:03:17 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-31350274</link><description>&lt;p&gt;Perfect Marius! It works! Thankyou so much for this.&lt;/p&gt;&lt;p&gt;I am baffled though, why didn't the original code 'work out of the box'? Is it something wrong with Wamp? Should I be using something else to do these tutorials with?&lt;/p&gt;&lt;p&gt;Thanks again.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Kismet</dc:creator><pubDate>Tue, 26 Jan 2010 01:19:44 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-31273592</link><description>&lt;p&gt;Yeah, delete the following two lines:&lt;/p&gt;&lt;p&gt;list($count) = mysql_fetch_row($result);&lt;br&gt;if($count &amp;gt;= 1) { ?&amp;gt;&lt;/p&gt;&lt;p&gt;Move the following line:&lt;/p&gt;&lt;p&gt;&lt;span&gt;Error: that username is taken.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;to go inside my if block:&lt;/p&gt;&lt;p&gt;if($result) { ?&amp;gt;&lt;br&gt;&lt;span&gt;Error: that username is taken.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Error: that username is taken.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Congratulations, you registered successfully!&lt;/span&gt;&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marius</dc:creator><pubDate>Mon, 25 Jan 2010 14:28:05 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-31231501</link><description>&lt;p&gt;Thankyou so much Marius. I've tried to implement your new code as best I can. And this is what my register.php looks like now:&lt;/p&gt;&lt;p&gt;--------------------------------&lt;/p&gt;&lt;p&gt;&lt;span&gt;Error: Passwords do not match!&lt;/span&gt;&lt;br&gt;= 1) { ?&amp;gt;&lt;br&gt;&lt;span&gt;Error: that username is taken.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;Congratulations, you registered successfully!&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;lt;form method="post" action="register.php"&amp;gt;Username: &amp;lt;input type="text" name="username"/&amp;gt;&lt;br&gt;&lt;br&gt;Password: &amp;lt;input type="password" name="password"/&amp;gt;&lt;br&gt;&lt;br&gt;Confirm Password: &amp;lt;input type="password" name="confirm"/&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;input type="submit" value="Register!"/&amp;gt;&lt;br&gt;&amp;lt;/form&amp;gt;&lt;br&gt;------------------------------&lt;/p&gt;&lt;p&gt;The error message has changed, now it says 'Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\wamp\www\BBG\register.php on line 22'.&lt;/p&gt;&lt;p&gt;Line 22 is this one: list($count) = mysql_fetch_row($result);&lt;/p&gt;&lt;p&gt;I know I've done something wrong, but I feel I'm very close to getting this working. Can you see where I've messed up?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Kismet</dc:creator><pubDate>Mon, 25 Jan 2010 11:44:02 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-31144710</link><description>&lt;p&gt;Yeah, I dropped the "count" approach and did this instead:&lt;/p&gt;&lt;p&gt;$query = sprintf("SELECT * FROM users WHERE username = '%s'", mysql_real_escape_string($_POST['username'])));&lt;br&gt;$result = mysql_fetch_array(mysql_query($isuser));&lt;/p&gt;&lt;p&gt;Then I use a simple if statement to check if I got any data or not:&lt;br&gt;if($result) {&lt;br&gt;// User already exists&lt;br&gt;} else {&lt;br&gt;// User does not exist, safe to register if all input validates&lt;br&gt;}&lt;/p&gt;&lt;p&gt;$result is an array, and if the user exists in the DB I have data there and the if check returns true, if no data enters the array is empty and the if check returns false and runs the else statement instead.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marius</dc:creator><pubDate>Mon, 25 Jan 2010 03:46:11 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-31142301</link><description>&lt;p&gt;I couldn't say what's breaking for you, and you'll want to look at the&lt;br&gt;line just before the one where the error's being thrown - somehow,&lt;br&gt;your $result variable is being set to a boolean value instead of a&lt;br&gt;mysql resource.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Luke</dc:creator><pubDate>Mon, 25 Jan 2010 02:32:19 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-31136136</link><description>&lt;p&gt;Duh! I'm so dumb! You're right Luke, I needed to change the configuration file to match my Wamp info:&lt;/p&gt;&lt;p&gt;Now it's working, but I'm getting a new error:&lt;/p&gt;&lt;p&gt;Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\wamp\www\BBG\register.php on line 19&lt;/p&gt;&lt;p&gt;This is line 19: list($count) = mysql_fetch_row($result);&lt;/p&gt;&lt;p&gt;I see that Marius had the same problem and managed to solve it, but he didn't post his solution :(.&lt;/p&gt;&lt;p&gt;Anybody have any ideas?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Kismet</dc:creator><pubDate>Mon, 25 Jan 2010 00:23:10 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-31073329</link><description>&lt;p&gt;That error message means that your PHP script is unable to connect to&lt;br&gt;your MySQL database - try making sure all of your credentials are&lt;br&gt;correct, and then continuing from there.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Luke</dc:creator><pubDate>Sun, 24 Jan 2010 14:25:15 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-31031728</link><description>&lt;p&gt;I get this error when I try to register:&lt;/p&gt;&lt;p&gt;Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'user'@'localhost' (using password: YES) in C:\wamp\www\BBG\register.php on line 12&lt;br&gt;Error connecting to mysql&lt;/p&gt;&lt;p&gt;I'm very new to this, so I'm not sure what I've done wrong.&lt;/p&gt;&lt;p&gt;This is what I've done so far, I'm using Wamp, so I created a new project folder in  C:\wamp\www called BBG.&lt;/p&gt;&lt;p&gt;In phpMyAdmin I've created 3 tables "items, users and user_inventory".&lt;/p&gt;&lt;p&gt;I'm using ConTEXT as my editor so I copied and pasted the whole code into it and saved it as register.php.&lt;/p&gt;&lt;p&gt;But I get the above error message when I try to register. What have I done wrong?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Kismet</dc:creator><pubDate>Sun, 24 Jan 2010 03:07:08 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-30033211</link><description>&lt;p&gt;Thanks for the reply Maruz. Interesting stuff!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Red</dc:creator><pubDate>Sat, 16 Jan 2010 04:50:41 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-29755616</link><description>&lt;p&gt;If you use a random salt value, you'd have to store that value to later validate the password. It can't be random each time the user tries to log in, then he will never be able to log in again.&lt;/p&gt;&lt;p&gt;A random salt could be the md5 value of a random number.&lt;/p&gt;&lt;p&gt;$salt = md5(rand(11111, 99999));&lt;br&gt;$password = md5($password.$salt);&lt;/p&gt;&lt;p&gt;Be sure to store the $salt value in your db for later use, and to match the users password using that same salt every time.&lt;/p&gt;&lt;p&gt;For better security (as you store the random salt probably next to each user in your db) you could also have a fixed $salt2 stored in a non-accessible php file, and add that to every password:&lt;/p&gt;&lt;p&gt;include "non-accessible php file";&lt;br&gt;$salt2 = "some-random-salt";&lt;/p&gt;&lt;p&gt;$password = md5($password.$salt.$salt2);&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Maruz</dc:creator><pubDate>Thu, 14 Jan 2010 03:45:29 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-29714484</link><description>&lt;p&gt;I would like to see  an example of the MD5 function in combination with a random "salt" value.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Red</dc:creator><pubDate>Wed, 13 Jan 2010 23:22:08 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-27108560</link><description>&lt;p&gt;1. You can use a drop down menu in a &amp;lt;form&amp;gt; tag. ex:&lt;/p&gt;&lt;p&gt;&amp;lt;form action="thispage.php" method="POST"&amp;gt;&lt;br&gt;&amp;lt;select name="yourvab"&amp;gt;&lt;br&gt;&amp;lt;option value="postedname"&amp;gt;Option 1&amp;lt;/option&amp;gt;&lt;br&gt;&amp;lt;option value="postedname"&amp;gt;Option 2&amp;lt;/option&amp;gt;&lt;br&gt;&amp;lt;/select&amp;gt;&lt;br&gt;&amp;lt;input type="submit"/&amp;gt;&lt;br&gt;&amp;lt;/form&amp;gt;&lt;/p&gt;&lt;p&gt;If you now submit the variables $_POST['yourvab'] value will be "postedname".&lt;/p&gt;&lt;p&gt;2. %s means "string" and is declared after the ",&lt;br&gt;This method is used to get rid of coding differences between the input in php and mysql.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">welon</dc:creator><pubDate>Wed, 23 Dec 2009 16:21:10 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-27035828</link><description>&lt;p&gt;Exactly :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Luke</dc:creator><pubDate>Tue, 22 Dec 2009 18:11:17 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-27029883</link><description>&lt;p&gt;ah right, so first I need to get my server running then, can I set up a local server and use it &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Lawrence</dc:creator><pubDate>Tue, 22 Dec 2009 17:29:57 -0000</pubDate></item><item><title>Re: Building Browsergames: The Registration Page (PHP)</title><link>http://buildingbrowsergames.com/2008/04/17/building-browsergames-the-registration-page-php/#comment-27025122</link><description>&lt;p&gt;PHPMyAdmin is software that you run on your server - it doesn't matter&lt;br&gt;what operating system the computer you're developing on is running.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Luke</dc:creator><pubDate>Tue, 22 Dec 2009 16:10:38 -0000</pubDate></item></channel></rss>