Using PHP and MYSQL to make logins and profiles for my site?

For the discussion of Perl, Python, Ruby, and PHP and other interpreted languages.

Using PHP and MYSQL to make logins and profiles for my site?

Post by chrisx16x2008 on Tue Jan 20, 2009 11:28 pm
([msg=16700]see Using PHP and MYSQL to make logins and profiles for my site?[/msg])

hey I'm new to php and MYSQL but read some tutorials because i wanted to let my website users log in and make their own profiles, but I'm completely lost. I don't know where to go from here; From what i read i don't see how it applies to what i need to use it for. Can someone point me in the right direction or explain to me the starting steps to put log ins and profiles on my site?
chrisx16x2008
New User
New User
 
Posts: 36
Joined: Tue Jan 13, 2009 9:53 pm
Blog: View Blog (0)


Re: Using PHP and MYSQL to make logins and profiles for my site?

Post by comperr on Wed Jan 21, 2009 9:49 am
([msg=16714]see Re: Using PHP and MYSQL to make logins and profiles for my site?[/msg])

User avatar
comperr
Poster
Poster
 
Posts: 373
Joined: Mon Apr 07, 2008 6:52 pm
Location: /dev/null
Blog: View Blog (0)


Re: Using PHP and MYSQL to make logins and profiles for my site?

Post by chrisx16x2008 on Wed Jan 28, 2009 4:00 pm
([msg=17009]see Re: Using PHP and MYSQL to make logins and profiles for my site?[/msg])

that's a good tutorial, but i have another question. Once my users go through the registration process how do i have the server create a page for them. For example, on myspace you register then you automatically have a page waiting for you to fill out and you also have the option of making a sub URL like myspace.com/whatever_you_choose
chrisx16x2008
New User
New User
 
Posts: 36
Joined: Tue Jan 13, 2009 9:53 pm
Blog: View Blog (0)


Re: Using PHP and MYSQL to make logins and profiles for my site?

Post by kiyoura on Wed Jan 28, 2009 8:54 pm
([msg=17033]see Re: Using PHP and MYSQL to make logins and profiles for my site?[/msg])

If you mean a profile, then think up a html template you want for them all to look like. Then fill in the user information with a mysql data array containing that persons specific data. Finally, write this template with all information specified.

for example a basic profile creation could be:
Code: Select all
<?php
// mysql connection and session information goes here
// be sure to sanitize all variables before hand

$query = mysql_query("SQL GOES HERE");
$create = mysql_fetch_assoc($query);

$file = fopen($create['username'].".php",w);

// This is a heredoc of the template (very basic)
$profile = <<< PROFILE
<html>
<head>
    <title>My profile</title>
</head>
<body>
    <div>Id: {$create['id']}</div>
    <div>Name: {$create['name']}</div>
    <div>Picture: <img src="{$create['picture_url']}"</div>
</body>
</html>
PROFILE;

// this writes the profile to the actual file
if (!fwrite($file,$profile))
     die ("Profile creation terminated");

fclose($file);
?>


You would want to use more than one file and include them whenever needed.
E.g, template.php can be included into create.php.
-
Image
-
kiyoura
New User
New User
 
Posts: 24
Joined: Sun May 04, 2008 7:56 pm
Blog: View Blog (0)


Re: Using PHP and MYSQL to make logins and profiles for my site?

Post by chrisx16x2008 on Thu Feb 05, 2009 3:53 pm
([msg=17426]see Re: Using PHP and MYSQL to make logins and profiles for my site?[/msg])

So if i understand kiyouras' code then all that code he wrote would be the actual profile of the person and the
"mysql_query("SQL GOES HERE")" would fetch the users info that i have already submitted to the database through a register page?
chrisx16x2008
New User
New User
 
Posts: 36
Joined: Tue Jan 13, 2009 9:53 pm
Blog: View Blog (0)


Re: Using PHP and MYSQL to make logins and profiles for my site?

Post by kiyoura on Fri Feb 06, 2009 3:53 am
([msg=17454]see Re: Using PHP and MYSQL to make logins and profiles for my site?[/msg])

Yes. All the code inside $profile would be the actual profile. You could do this every time someone registers.
-
Image
-
kiyoura
New User
New User
 
Posts: 24
Joined: Sun May 04, 2008 7:56 pm
Blog: View Blog (0)



Return to Interpreted Languages

Who is online

Users browsing this forum: No registered users and 0 guests