Watch Anime - ID badge - Herbal Supplements - Find jobs - Indian television shows news

PDA

View Full Version : Need Help with PHP


Pixel T.
Apr 26th 2009, 12:49 pm
Hey guys,

I'm trying to learn php while making some pretty cool scripts, I think. So for this script, I'm kind of stuck.

The script requires a user to log in. I got that part down. Next, they have to add their domain to their profile. How can I set up the Database so that when they add the domains, it can easily be shown in their private profiles but only theres and no one elses.

Its hard to explain but I hope someone understands what I am trying to do here.

Thanks,

mfscripts
Apr 26th 2009, 1:43 pm
You'll need to setup a db (such as MySQL) with a domains table (or similar). Then when the user adds a domain, store it within this table and also their userid/username. That way you can run a query to pull only their domains within their account.

cosminx2003
Apr 26th 2009, 2:00 pm
You must use MySQL database, if you don't know how read this great tutorial (http://www.tizag.com/mysqlTutorial/index.php).
After you learn the basics of mysql, you should create a database which contains 2 rows :
1. user - account
2. password - account's password
3. domain - the domain for specific account
Then if the user wants to see his domain, he must to log in through your script.
I suppose you make a $_SESSION variable (in your script) after the user logs in, for example $_SESSION['login']=1; (if the user and the password were correctly inserted).
Then make a page which users can see their domains. You should verify first if they are logged in :

if($_SESSION['login']) {
// show the domain
}

and then grab from the mysql database the domain for the specific username.

I think that's you need, but first you must learn the basics of mysql (create,insert,select,update).

Pixel T.
Apr 26th 2009, 2:51 pm
Ok, that answers it.

Thanks,