Jump to content

Self-propagating arrays


WSparrow

Recommended Posts

Hi all,

 

I'm building a site with session based logins.  I'm trying to setup a php file like the following:

<?php

$users = array(

"username" => "password",

"anothername" => "theirpass"

);

?>

 

The idea being that this file can be called and the login can be validated with array_key_exists.  But how do I setup that php file so that new users are automatically added when they register?

 

And yes I admit I'm a noob.  :)

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/223035-self-propagating-arrays/
Share on other sites

I'm using MySQL to aquire and store all the user account data.  Where I'm having trouble is figuring out how to load it into a php file without having to do it manually many times a day.

 

However, if you know of a better way to setup session based logins, I'm open to suggestions.

Don't know why nobody has laid this out fro you instead of pointing out the obvious or asking questions you clearly will not understand.

 

Trouble here is that you should be using a database. $users = array() should be $users = mysql_query() which will then query the database for the user. You need to read up on some basic user management, mysql, and sessions in php:

 

http://www.wikihow.com/Create-a-Secure-Login-Script-in-PHP-and-MySQL

 

It's quite simple stuff but what is more important right now is that you see how you are approaching this is fundamentally wrong.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.