emopoops Posted May 24, 2009 Share Posted May 24, 2009 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! Quote Link to comment https://forums.phpfreaks.com/topic/159516-solved-how-do-i-fwrite-a-user-profile-aka-an-entire-php-page/ Share on other sites More sharing options...
MadTechie Posted May 25, 2009 Share Posted May 25, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/159516-solved-how-do-i-fwrite-a-user-profile-aka-an-entire-php-page/#findComment-841434 Share on other sites More sharing options...
emopoops Posted November 19, 2009 Author Share Posted November 19, 2009 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) Quote Link to comment https://forums.phpfreaks.com/topic/159516-solved-how-do-i-fwrite-a-user-profile-aka-an-entire-php-page/#findComment-960561 Share on other sites More sharing options...
MadTechie Posted November 19, 2009 Share Posted November 19, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/159516-solved-how-do-i-fwrite-a-user-profile-aka-an-entire-php-page/#findComment-960573 Share on other sites More sharing options...
emopoops Posted November 19, 2009 Author Share Posted November 19, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/159516-solved-how-do-i-fwrite-a-user-profile-aka-an-entire-php-page/#findComment-960579 Share on other sites More sharing options...
MadTechie Posted November 19, 2009 Share Posted November 19, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/159516-solved-how-do-i-fwrite-a-user-profile-aka-an-entire-php-page/#findComment-960592 Share on other sites More sharing options...
emopoops Posted November 19, 2009 Author Share Posted November 19, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/159516-solved-how-do-i-fwrite-a-user-profile-aka-an-entire-php-page/#findComment-960613 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.