Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 22, 2012, 02:32 PM   #1
floh
macrumors 6502
 
Join Date: Nov 2011
Location: Stuttgart, Germany
Simple website with user accounts

Hey everyone!

So, I want to create a simple website, and I have never done this (well, yes, but very basic and a long time ago). The website is supposed to have the following features:

- People can create user names (captcha?) and log in with them.
- They can submit some data (just a number and maybe the submission date)
- They can view a graph of their own numbers and an average of everybody else's
- They can log out

Now these features are very basic and don't need to be fancy. The number of users will probably stay below 100. Not knowing anything, I would have gone about it with PHP and a mySQL database, but I have never really used either. I have a lot of coding experience in C and some in Python and am generally not afraid of computers and editors. I own Rapidweaver (because it was included in a software bundle once) but have never used it.

My questions to you are:

1. Are PHP and mySQL the way to do this? Is there a better or easier way?

2. What would you use to draw and show graphs of some data on the website?

3. Would you recommend doing this with Rapidweaver? Can Rapidweaver easily manage a database, logins and a graph, or would I have to manually code the PHP and mySQL part anyways? Or would you recommend to use Rapidweaver for a layout and then edit the resulting pages by hand?

4. Do you (by chance) have any great tipps where I can get examples or pre-coded site sketches like this? It seems to me like many people would want this (a site with accounts), and I don't want to re-program the wheel. This is supposed to be a "could you just quickly code this"-project... as always...

Thanks, and I hope I didn't insult you all with my complete newbie questions.

Floh
floh is offline   0 Reply With Quote
Old Nov 22, 2012, 06:24 PM   #2
Hansr
macrumors 6502a
 
Join Date: Apr 2007
1) Pretty much
2) Highcharts or Flot
3) No
4) You could buy this and use it as a starting place: http://codecanyon.net/item/php-login...nagement/49008
Hansr is offline   1 Reply With Quote
Old Nov 22, 2012, 06:34 PM   #3
floh
Thread Starter
macrumors 6502
 
Join Date: Nov 2011
Location: Stuttgart, Germany
Quote:
Originally Posted by Hansr View Post
1) Pretty much
2) Highcharts or Flot
3) No
4) You could buy this and use it as a starting place: http://codecanyon.net/item/php-login...nagement/49008
This was a very short, but perfectly helpful answer. Thanks a lot.
floh is offline   0 Reply With Quote
Old Nov 23, 2012, 04:46 AM   #4
ghellquist
macrumors regular
 
Join Date: Aug 2011
Location: Stockholm Sweden
Wordpress

Suggestion.
Look at the wordpress system. It solves a number of the things more or less directly (creating users, logging in) and there is a lot of ready plugins available that might already solve what you are planning to do. It will as well allow you to host the site without cost.

// Gunnar
ghellquist is offline   2 Reply With Quote
Old Nov 23, 2012, 05:09 AM   #5
floh
Thread Starter
macrumors 6502
 
Join Date: Nov 2011
Location: Stuttgart, Germany
Quote:
Originally Posted by ghellquist View Post
Look at the wordpress system. It solves a number of the things more or less directly (creating users, logging in)
Thanks, Gunnar. I know the wordpress system (my institute uses it for the webpage we distribute our simulation software through) and it is very convenient.

However, I see three small hickups with that:

1. It does not allow a user to easily create his own account, does it? The way I got to know it, accounts can only be created by an admin user. I would like to avoid that. But I could be wrong here.

2. The database connectivity isn't great. Users in wordpress are supposed to be users that can or can't view certain pages or that have editing capabilities. Basically setting the "page rights" like for users in Unix filesystems. The users are not supposed to be entries in a database, with editable data points associated with their account. I would probably have to hack a lot to get this working and could as well go with PHP directly.

3. Free webspace is great, but I already have that, because I work at a university.

Thanks anyways, and I may actually be wrong about these points.
floh is offline   0 Reply With Quote
Old Nov 23, 2012, 07:08 AM   #6
rdas7
macrumors regular
 
Join Date: Nov 2002
Location: London, England
I'm in precisely the same situation *extensive experience in front-end code, but little hands-on with server-side (beyond accessing APIs that I usually have a hand in architecting, but not coding).

Look into PaaS and SaaS solutions such as Parse.com *might be just what you're looking for! There are several other similar services.
rdas7 is offline   0 Reply With Quote
Old Nov 25, 2012, 12:46 AM   #7
ghellquist
macrumors regular
 
Join Date: Aug 2011
Location: Stockholm Sweden
Quote:
Originally Posted by floh View Post
1. It does not allow a user to easily create his own account, does it? The way I got to know it, accounts can only be created by an admin user. I would like to avoid that. But I could be wrong here.

2. The database connectivity isn't great. Users in wordpress are supposed to be users that can or can't view certain pages or that have editing capabilities. Basically setting the "page rights" like for users in Unix filesystems. The users are not supposed to be entries in a database, with editable data points associated with their account. I would probably have to hack a lot to get this working and could as well go with PHP directly.
Hi.
I am in no way an expert, have only dabbled a bit on the corners with wordpress. I find it to be one (of probably many) shortcuts to solve things that otherwise would take a lot of my (not bugfree) code.
1. There are several plugins allowing users to register themselves with more or less security checks. Check this one as an example (buddypress). http://testbp.org
2. Agree on that part. But I believe that if you have already verified the user and has his name in a PHP variable (wordpress does that) it would be easy to access the MySql database to store stuff.

Anyway, beeing a lazy programmer, I personally try to steal as much as possible.
// Gunnar
ghellquist is offline   0 Reply With Quote
Old Nov 27, 2012, 07:32 AM   #8
TechnologyLasts
macrumors newbie
 
Join Date: Oct 2011
Quote:
Originally Posted by floh View Post
1. It does not allow a user to easily create his own account, does it? The way I got to know it, accounts can only be created by an admin user. I would like to avoid that. But I could be wrong here.
Users can create an account themselves with Wordpress. You don't even have to install any plugins; it's native to Wordpress. It's a checkbox in the settings of the Wordpress site, called "anyone can register". Just check that box and you're good to go.
TechnologyLasts is offline   0 Reply With Quote
Old Nov 27, 2012, 08:27 AM   #9
floh
Thread Starter
macrumors 6502
 
Join Date: Nov 2011
Location: Stuttgart, Germany
Quote:
Originally Posted by TechnologyLasts View Post
Users can create an account themselves with Wordpress. You don't even have to install any plugins; it's native to Wordpress. It's a checkbox in the settings of the Wordpress site, called "anyone can register". Just check that box and you're good to go.
Thanks everyone, not just you!

I'll consider using Wordpress in the future, it seems like a great option for many tasks.

Since I ended up planning to do a lot of database stuff anyways for this page, I just learned CSS, PHP, mySQL and Javascript (using flot for my plots) in one day and did the whole thing from scratch in another day (there goes my weekend). Yeah, these languages are amazingly simple, it's just the communication between them that took some effort and getting used to for me. So, if you stumble across this thread and you ever need to do something like this, I'll gladly send you my project. It's not perfect, but it seems to do what I wanted.

Thanks again for all the fast and kind replies.
floh is offline   0 Reply With Quote
Old Jul 9, 2013, 01:47 PM   #10
crow33
macrumors newbie
 
Join Date: Jul 2013
Quote:
Originally Posted by floh View Post
Thanks everyone, not just you!

I'll consider using Wordpress in the future, it seems like a great option for many tasks.

Since I ended up planning to do a lot of database stuff anyways for this page, I just learned CSS, PHP, mySQL and Javascript (using flot for my plots) in one day and did the whole thing from scratch in another day (there goes my weekend). Yeah, these languages are amazingly simple, it's just the communication between them that took some effort and getting used to for me. So, if you stumble across this thread and you ever need to do something like this, I'll gladly send you my project. It's not perfect, but it seems to do what I wanted.

Thanks again for all the fast and kind replies.
Floh: Any chance you could send me the project? I'm looking for something similar and am getting ready to start a weekend of fun.
crow33 is offline   0 Reply With Quote
Old Jul 9, 2013, 01:58 PM   #11
floh
Thread Starter
macrumors 6502
 
Join Date: Nov 2011
Location: Stuttgart, Germany
Quote:
Originally Posted by crow33 View Post
Floh: Any chance you could send me the project? I'm looking for something similar and am getting ready to start a weekend of fun.
Sure, I just sent you a PM for exchange information.

In case anyone is interested, this is what the final project looked like:
http://zefrank.fahrenbergers.de/

It's nothing special, but I thought it would complete this thread. You'll have to create an account though to see the Javascript parts of it...
floh is offline   0 Reply With Quote
Old Jul 19, 2013, 06:30 AM   #12
hharan
macrumors newbie
 
Join Date: Jul 2013
Hi Floh: I'm trying to learn PHP and this would be perfect. Can you share your code?

Thanks,
Hari
hharan is offline   0 Reply With Quote
Old Jul 21, 2013, 02:36 PM   #13
floh
Thread Starter
macrumors 6502
 
Join Date: Nov 2011
Location: Stuttgart, Germany
Quote:
Originally Posted by hharan View Post
Can you share your code?
Alright, I'll share it publicly. Just didn't want to spam the forum... maybe it helps someone.

Here is the code:
http://downloads.fahrenbergers.de/we...ss_tracker.zip

And here is the eMail I wrote the first guy who asked for it, for some explanations and help:

Quote:
So, here is the ZIP of my website files. I took out my database name,
user name, and password from "db.inc.php", other than that it is left
unchanged. Unfortunately, that means that there are very few comments in
there, since I programmed the site rather quickly in the end.

Some general (helpful?) thoughts:

The files "db.inc.php" and "session.inc.php" can be included at the very
top of a page to make sure it is only visible for logged in users and to
hide the database access files from the public for security. Still, with
this unprofessional code I would make sure that your database is only
accessible from the server itself, not externally, which can usually be
set in your provider's settings.

The file "plotdata.php" is a good example for connection of the
different languages: It contains a bunch of PHP code to calculate graph
data, including some calls to the mySQL database, and then a Javascript
part. Variables from the PHP part can be read via "json", with a line like:
var my_java_variable = <?php echo json_encode($my_php_variable); ?>;

If you are mainly interested in the PHP account creation/login part,
take a look at the file "createaccount.php", which is just called from
"createaccount.htm" via a submit form with data. If you do this, make
sure to hand the data at least a little more securely like "method=post"
(line 65 in the .htm file), and not within the URL.
The most crucial parts of the .php files that might be hard to
understand are:

>From "createaccount.php":
* lines 63-69: The variables given are escaped properly so they can
contain no commands that might mess up your database.
* line 104: The password is never saved in readable clear text. Instead,
a so-called "salt" is generated that is long and contains strange random
characters. This salt is then used as a base to encrypt the password so
the original string can not (well, hardly) be recovered. The encrypted
password and the salt are saved in your database, and you can easily
check if a password entered, combined with the salt of the username,
will create the same encrypted string. There is just no way to read out
the password.
* lines 51-60: This is a function to generate a "salt" that will make
the crypt function use the pretty secure "blowfish" algorithm for
encryption.
* line 106: This is the actual insertion of the new user into the
database. mySQL is very powerful, and I only scratched the surface of
it, but be sure to escape (with \"{$varname}\") strings that you want to
hand over and not escape numbers (like {$varname}). I think I ran into
some trouble with that...

>From "login.php":
* line 53 and 56 are a good example how to search the database and read
data from it. Be aware that line 53 alone does not yet read any data, it
only searches the database and stores a content handle with which you
can get the data.
* line 55 is a simple check if the username exists.
* line 63 is crucial to mark the user as "logged in".

"mailme.php" is a very simple way to have a user (if they entered a
valid eMail address) reset their password to something random if they
forgot it.

The rest of the files are pretty specific and you will probably not
learn a lot from them.

Good luck and have fun programming! )

Floh
floh is offline   0 Reply With Quote
Old Jul 26, 2013, 08:22 PM   #14
hharan
macrumors newbie
 
Join Date: Jul 2013
Thanks! That was very helpful!
hharan is offline   0 Reply With Quote

Reply
MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Tags
accounts, database, rapidweaver

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
2 user accounts seem to slow me down RinkoWingMan MacBook Pro 1 Nov 16, 2013 05:55 AM
New to mac - user accounts? aartoodeetoo OS X 2 Jun 29, 2013 09:34 AM
User accounts jon8214 OS X Mavericks (10.9) 1 Jun 12, 2013 10:58 AM
User accounts on iPad crazyman3005 iOS 6 19 Dec 7, 2012 10:36 AM
Switching user accounts Benbikeman OS X 10.8 Mountain Lion 0 Jul 28, 2012 05:57 AM

Forum Jump

All times are GMT -5. The time now is 05:19 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC