Jump to content

Recommended Posts

i made a registration script right and it makes the user  a directory and an indexfile so they can have their own profile. so does anyone have any info on how to fwrite and entire php page?

cause i need it for making user profiles to be at socialemo.com/username

like myspace.

but i dont know how to fwrite anything other than ":hy this us yo profile fool"

seriously guys i need some helpo techguy isn answering either is dreamin code.

please help just some info maybe a link would be greatly appreciated .

i want u to all know im not asking for a script here im just asking for help with how to do this. fwrite thing/ as i stated above i already have it to make the directory and the page and write hey this is your profile kind of thing but i need to create a whole page not just text. it has to be index.php not .txt and it has to be able to have  some PHP in it as well...

because the page cant be accessable to anyone until they are logged in and i have to use require to require another page. i will also need to fwrite this profile page to have an included stylesheet. please help me with fwrite!

you would use

fwrite($fp, '<strong>Hello</strong> MadTechie');

just as you would do

echo  '<strong>Hello</strong> MadTechie';

But thats not how myspace do it, or any "good" websites do it

the data is held in a database and the page is built dynamically,

ie

<?php
//connect to DB etc
$SQL = sprintf("SELECT * FROM users WHERE user='%s' LIMIT 1",mysql_real_escape_string($_GET['user']));
$query = mysql_query($SQL) or die(mysql_error());
$user = mysql_fetch_array($query);
echo "<strong>Hello</strong> ".$user['UserName'];
?>

 

then use an apache rewrite to redirect /profile/MadTechie to profile.php?user=MadTechie

  • 5 months later...

i actually ended up using templates for this. as in :

$documentroot = $_SERVER['DOCUMENT_ROOT'];

$dir = $documentroot . '/' . $username;
if (!file_exists ($dir)){
if(mkdir($documentroot ."/". $username , 0755))
{
$profile = $documentroot ."/". $username ."/index.php" ;
$filegettingcopied = $documentroot ."/xxxxx/index.php" ;
if (copy($filegettingcopied, $profile))
{

 

which copied the file which contained the php include(template.php)

 

No offence intended BUT..

Your be better of using my first example, and a mod rewrite

the mod rewrite could redirect domain.com/MadTechie to profile.php?user=MadTechie that would yield the same results.

i have free hosting i dont know what a mod rewrite is also. i want the url to have the username in it because yeah its the same thing its just a few lines of code to include the template in each file. i dont see HOW it would be better to use the mod rewrite. i dont want to redirect to profilebalhh. i want it to be the persons username

a mod rewrite would show up (in the URL) as domain.com/MadTechie but would infact be this page profile.php?user=MadTechie

 

3 simple reason why it would be better,

system standardisation

easier maintainable

less resource

 

these happen to the 3 things I think about when writing any system,

 

but with that said being comfortable with the system you have is also high on my list

ok sure. but how is it those three things? what does this have to do with resorces? i really dont understand why i should change it to mod rewrite NOR do i know if my free hosting lets me use things like mod rewrites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.