Duthie Posted December 30, 2011 Share Posted December 30, 2011 Ok im only new to PHP and Im trying to setup my own porfolio website using PHP,CSS,HTML5 and other bits. Iv downloaded WAMP and im tryin to get my website workin offline first. Well im just trying to get a section in my site in the top right corner for a login and register area similar to this website (membership section) iv bein following some online video tuts and completed them right but Im not sure how to integrate it into my existing home page,/ index.html page. I want to have it so that it says login or registered and it works through php. all the tuts I followed seem to have this done on one index.php page and im getting confused as to how I can have a small section on my home page just for registering if yano what I mean..... Maybe its a silly question....im still learning....Any help be gratefull Quote Link to comment https://forums.phpfreaks.com/topic/254062-registration-formlogin-setup/ Share on other sites More sharing options...
Muddy_Funster Posted December 30, 2011 Share Posted December 30, 2011 rename your index.html page to index.php, add the <form>...</form> code to the div where you want it and, assuming the code is designed for same page loading, copy it into the page (making sure to bring the <?php and ?> tags with you, and you should be good to go. Quote Link to comment https://forums.phpfreaks.com/topic/254062-registration-formlogin-setup/#findComment-1302492 Share on other sites More sharing options...
jamesjmann Posted December 30, 2011 Share Posted December 30, 2011 I'm going to tell you what I wish someone had told me when I first started out in PHP...DO NOT COPY/PASTE. Seriously, when I first started out I resorted to copying/pasting others' scripts hoping that they would just magically work once on my already existing website. But I learned that doing this only makes everything that much more complicated. If I were you, I would take a look at php.net and get familiar with basic functions and syntax. Then go through the tutorials on it for tips. PHP is a language based on logic. It is how some of the best applications today are made. If you don't have it or intend to hone it then you might as well give it up and take up American Idol as an alternative past time lol. But assuming you take my advice and start from the ground up (which is always best with any application), I say you start by creating a basic html form and save it in a file called "blahblahblah" with the ".php" extension. Once you've got that down, simply set up a "process" function that checks the inputs the user entered. But in order to be able to do any of this, you'd first need a table that holds all your members and, of course, a registration script. Here's one I found really useful: http://www.tutorialcode.com/php/registration-script/ Any questions, feel free to ask. I don't mind throwing in a helping hand when I can =) Quote Link to comment https://forums.phpfreaks.com/topic/254062-registration-formlogin-setup/#findComment-1302497 Share on other sites More sharing options...
Muddy_Funster Posted December 30, 2011 Share Posted December 30, 2011 I'm going to tell you what I wish someone had told me when I first started out in PHP...DO NOT COPY/PASTE. Seriously, when I first started out I resorted to copying/pasting others' scripts hoping that they would just magically work once on my already existing website. But I learned that doing this only makes everything that much more complicated. If I were you, I would take a look at php.net and get familiar with basic functions and syntax. Then go through the tutorials on it for tips. PHP is a language based on logic. It is how some of the best applications today are made. If you don't have it or intend to hone it then you might as well give it up and take up American Idol as an alternative past time lol. But assuming you take my advice and start from the ground up (which is always best with any application), I say you start by creating a basic html form and save it in a file called "blahblahblah" with the ".php" extension. Once you've got that down, simply set up a "process" function that checks the inputs the user entered. But in order to be able to do any of this, you'd first need a table that holds all your members and, of course, a registration script. Here's one I found really useful: http://www.tutorialcode.com/php/registration-script/ Any questions, feel free to ask. I don't mind throwing in a helping hand when I can =) good info, but for the fact the the OP alreadt stated they wrote the code themselves following video tutorials... Quote Link to comment https://forums.phpfreaks.com/topic/254062-registration-formlogin-setup/#findComment-1302499 Share on other sites More sharing options...
jamesjmann Posted December 30, 2011 Share Posted December 30, 2011 I'm going to tell you what I wish someone had told me when I first started out in PHP...DO NOT COPY/PASTE. Seriously, when I first started out I resorted to copying/pasting others' scripts hoping that they would just magically work once on my already existing website. But I learned that doing this only makes everything that much more complicated. If I were you, I would take a look at php.net and get familiar with basic functions and syntax. Then go through the tutorials on it for tips. PHP is a language based on logic. It is how some of the best applications today are made. If you don't have it or intend to hone it then you might as well give it up and take up American Idol as an alternative past time lol. But assuming you take my advice and start from the ground up (which is always best with any application), I say you start by creating a basic html form and save it in a file called "blahblahblah" with the ".php" extension. Once you've got that down, simply set up a "process" function that checks the inputs the user entered. But in order to be able to do any of this, you'd first need a table that holds all your members and, of course, a registration script. Here's one I found really useful: http://www.tutorialcode.com/php/registration-script/ Any questions, feel free to ask. I don't mind throwing in a helping hand when I can =) good info, but for the fact the the OP alreadt stated they wrote the code themselves following video tutorials... Oh, lol. I thought he found a script somewhere and just "plugged" it into his site, which, if that were the case, I'd have strongly advised against it. But that's just my take from my own experience with this wonderful language. Quote Link to comment https://forums.phpfreaks.com/topic/254062-registration-formlogin-setup/#findComment-1302505 Share on other sites More sharing options...
Duthie Posted December 30, 2011 Author Share Posted December 30, 2011 Thanks for your replies, had a good nights sleep there and gonna go at it again tonight with a fresh head And yea I wrote all the code myself from following and online video on youtube. Iv a fair idea what most ov the code does but your right I still wouldnt have bein fit to do it all myself. But say for example this website, when registering it requires you to click an account ativation link sent to your email address(which seems to be the method setup with most sites I use) Is this way more advanced to setup?Or is that something I would setup later with my online hosting company? And so I think the problem I was getting confused with is that I can add multiple php code snippets into my home page?Anyways im gonna batter away at it for the next few hours thanks and I hate American Idol Quote Link to comment https://forums.phpfreaks.com/topic/254062-registration-formlogin-setup/#findComment-1302695 Share on other sites More sharing options...
PFMaBiSmAd Posted December 30, 2011 Share Posted December 30, 2011 In its simplest form, to make a dynamically produced php page, you place all the php 'business' logic as the first thing on the page. The php code determines what the page should contain and produces the content that you want (in php variables.) Then you output the content by simply echoing each php variable where you want each piece of content to be on the page. For something like the login/register/logged-in section on the page and the specific menus/navigation that change depending on if you are logged in or logged out, the php code would produce the correct content for those regions and then simply output/echo the content at the correct point in the HTML markup of the page layout. More specifically, if the current visitor is not logged in, the login form and registration link would be produced by the logic. If the current visitor is logged in, his username and log out link would be produced and all the navigation specific to a logged in person would be produced. If the login form is submitted, the form submits to the same page (read the next paragraph for how that would be handled in the logic.) If the submitted username/password is correct, the user is marked as being logged in and the remainder of the php logic produces the correct content for a logged in user. If the registration link is clicked, the page produces the necessary output needed for the registration process. This forum software (SMF) uses what is referred to as a page controller (google for that to find what it is and for the many code examples of the different ways, simple to complex, of implementing it), where there is one index.php page and an action= attribute on the end of the URL. The php logic on the page uses the action= value to determine what the page should do. Quote Link to comment https://forums.phpfreaks.com/topic/254062-registration-formlogin-setup/#findComment-1302702 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.