Results 1 to 10 of 10

Thread: [Post a page that won't return to the home/index page]

  1. #1
    Join Date
    May 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default [Post a page that won't return to the home/index page]

    I am trying to create a page on my website in which, if a user logs in to the secured part of the page, he/she will not be able to return to the home (index) page even if he/she is using their own computer. I have seen this done on other sites and want to be able to do it for my own site. The page after the index page will display all pertinent information for my site. Please help!

  2. #2
    Join Date
    Mar 2011
    Location
    N 11° 19' 0.0012 E 142° 15' 0
    Posts
    1,529
    Thanks
    41
    Thanked 89 Times in 88 Posts
    Blog Entries
    3

    Default

    Google php login tutorials. Build a login system and after that we'll be able to help you with the rest. You are going to need a server with php and mysql.

    This is quite a complex subject and you'll probably need some experience with php before undertaking it.

    You could do this with asp (another server-side language) but I suggest php...

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    If you don't know how to do this yourself (or even where to start) and you need it quickly, you might want to consider hiring someone. Of course you can learn it if you want, but it might take some time. You can post in our "paid work requests" section if you do want to consider hiring someone.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Apr 2012
    Location
    Chester, Cheshire
    Posts
    329
    Thanks
    7
    Thanked 35 Times in 35 Posts

    Default

    Are you using PHP or ASP.NET?

    In .NET you can do something like:

    HTML Code:
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head runat="server">
            <!-- Start Meta Block -->
            <meta content="text/html; charset=iso-8859-1" http-equiv="content-type" />
            <meta content="Login View Example" name="description" />
            <meta content="login, view, example" name="keywords" />
            <meta content="all,index,follow" name="robots" />
            <meta content="noodp" name="msnbot" />
            <meta content="global" name="distribution" />
            <!-- End Meta Block-->
            <title>Login View Example</title>
        </head>
    
        <body>
            <form id="pageForm" runat="server">
                <div>
                    <!-- Whatever HTML is here will be visible to everyone -->
                </div>
                <asp:LoginView ID="lgvMain" runat="server">
                    <AnonymousTemplate>
                        <!-- Whatever HTML is here will only be visible to anonymous users -->
                    </AnonymousTemplate>
                    <LoggedInTemplate>
                        <!-- Whatever HTML is here will only be visible to logged in users -->
                    </LoggedInTemplate>
                    <RoleGroups>
                        <asp:RoleGroup Roles="Administrator">
                            <ContentTemplate>
                                <!-- Whatever HTML is here will only be visible to logged in administrators -->
                            </ContentTemplate>
                        </asp:RoleGroup>
                    </RoleGroups>
                </asp:LoginView>
            </form>
        </body>
    </html>
    With this, you can create different views on the same page for different authorisation levels. You can also ajax enable it by wrapping the whole LoginView tag in an UpdatePanel with ChildrenAsTriggers enabled.

  5. #5
    Join Date
    May 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for the help with this task... Could you possibly provide a sample of the .html that would be plugged in so that I can see how the form will look once I put it on my site? Thanks!

  6. #6
    Join Date
    Apr 2012
    Location
    Chester, Cheshire
    Posts
    329
    Thanks
    7
    Thanked 35 Times in 35 Posts

    Default

    There are some important things of note about ASP.NET. You will need Windows hosting service, and you'll need to download Visual Studio 2010 Express.

    This is a very basic example. Of course, most of this would be on the Master Page (a template like a more powerful version of Dreamweaver's .dwt template files).

    default.aspx

    HTML Code:
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <!-- Start Meta Block -->
        <meta content="text/html; charset=iso-8859-1" http-equiv="content-type" />
        <meta content="Login View Example" name="description" />
        <meta content="login, view, example" name="keywords" />
        <meta content="all,index,follow" name="robots" />
        <meta content="noodp" name="msnbot" />
        <meta content="global" name="distribution" />
        <!-- End Meta Block-->
        <title>Login View Example</title>
    </head>
    <body>
        <form id="pageForm" runat="server">
            <div id="siteWide">
                <div id="header_wrapper">
                    <div id="logo">
                        <img src="mylogo.png" title="Login View Example" alt="Login View Example" />
                    </div>
                    <div id="navMenu">
                        <ul id="mainMenu">
                            <li>
                                <asp:HyperLink runat="server" ID="homeLink" NavigateUrl="~/default.aspx" AccessKey="1">Home</asp:HyperLink></li>
                            <li>
                                <asp:HyperLink runat="server" ID="aboutLink" NavigateUrl="~/about/default.aspx" AccessKey="2">About</asp:HyperLink></li>
                            <li>
                                <asp:HyperLink runat="server" ID="contactLink" NavigateUrl="~/contact/default.aspx"
                                    AccessKey="3">Contact</asp:HyperLink></li>
                            <asp:LoginView ID="livNavMenu" runat="server">
                                <LoggedInTemplate>
                                    <li>
                                        <asp:HyperLink runat="server" ID="accountLink" NavigateUrl="~/profile/default.aspx"
                                            AccessKey="4">My Account</asp:HyperLink></li>
                                </LoggedInTemplate>
                            </asp:LoginView>
                        </ul>
                    </div>
                    <div id="loginPanel">
                        <asp:LoginView ID="livLogin" runat="server">
                            <AnonymousTemplate>
                                <asp:Login ID="loginBox" runat="server" DestinationPageUrl="~/default.aspx">
                                </asp:Login>
                            </AnonymousTemplate>
                            <LoggedInTemplate>
                                <span>Welcome,
                                    <asp:LoginName ID="userName" runat="server" />
                                </span>
                            </LoggedInTemplate>
                        </asp:LoginView>
                    </div>
                </div>
                <div id="content_wrapper">
                    <asp:LoginView ID="contentPanel" runat="server">
                        <AnonymousTemplate>
                            <div class="center emphasis">
                                <p>
                                    Welcome, Guest. This site requires you to log in to continue browsing.</p>
                                <p>
                                    Please login or register a new account.</p>
                            </div>
                        </AnonymousTemplate>
                        <LoggedInTemplate>
                            <div class="mainContent">
                                <p>
                                    <asp:LoginName ID="loggedInUser" runat="server" />
                                    , welcome to my website. Thank you for making an account with us. You can now explore
                                    our full range of products and services.
                                </p>
                            </div>
                        </LoggedInTemplate>
                    </asp:LoginView>
                </div>
            </div>
        </form>
    </body>
    </html>
    Learning ASP.NET is a daunting task and can take a long time to master. I still find it far easier than PHP to use though and some of the features in Visual Studio make it much easier. There is seamless intellisense for Javascript, HTML and VB/C#; drag and drop "toolbox" style HTML elements and Widgets, code snippets, and code blocks; Ctrl + K, Ctrl + D keyboard shortcut for code tidying (this becomes second nature to use and it's annoying it's not a feature in all IDE's).

    All this said however, ASP.NET seems to be shunned by the majority of WebDevs. I think, although I may be wrong, there is still a lot of stigma about using Microsoft products. There are not many options online for free Windows Hosting, I still have yet to find a useable host.

    ----------

    There are two other options: PHP is the most standard, although the methods for producing the same in PHP would not be a simple two minute write up like the one above. The language is a lot more convoluted than ASP.NET in my experience and assumes a much higher prior knowledge of coding practice.

    SSI is the other option, which is mainly used by Dreamweaver to create their equivalent to Master Pages. This is, again, very convoluted in it's use and doesn't offer an amazing amount of flexibility.

    Unless you're hosting your own site, if you want simple coding which is hard to host, use ASP.NET. If you want difficult coding that is easy to host, use PHP. If you are hosting your own site then you can install IIS from the Windows Features section of Add/Remove Programs in Control Panel. Once that's installed just run through the My First Website tutorial for setting up your first ASP.NET website.
    Last edited by ApacheTech; 05-28-2012 at 07:55 PM.

  7. #7
    Join Date
    Mar 2011
    Location
    N 11° 19' 0.0012 E 142° 15' 0
    Posts
    1,529
    Thanks
    41
    Thanked 89 Times in 88 Posts
    Blog Entries
    3

    Default

    Quote Originally Posted by ApacheTech View Post
    If you want difficult coding that is easy to host, use PHP.
    I have to disagree with you Apache Tech. I've been using php for a couple of years now, and I find it realitivly easy to use. Neither of us can give a non-biased opinion on asp of php as they are the languages of our choice. Only someone who has tonnes of experience in both could give informed information.

    One plus side to php, is that because it is more comenly used, you will be able to find a lot more tutorials/help with it.

  8. #8
    Join Date
    Apr 2012
    Location
    Chester, Cheshire
    Posts
    329
    Thanks
    7
    Thanked 35 Times in 35 Posts

    Default

    By more difficult, I meant you'd have to code everything yourself. ASP.NET has a huge amount of inbuilt modules like:

    HTML Code:
    <asp:Login ID="loginBox" runat="server" DestinationPageUrl="~/default.aspx">
    </asp:Login>
    That reduce the difficulty level drastically. PHP tends to be more for accomplished programmers more than WebDevs... from a beginners persepective. ASP.NET is more about the markup, PHP is more about the code. I started programming with BASIC, then Visual Basic, now VB.NET, so I never really learned the C style of programming until I started learning JavaScript. Prior to JS, I'd never used a curly brace.

    ASP.NET has a huge amount of tutorials, video tutorials, forums and such to help beginners and experts alike. The MSDN is a much better community than it used to be in the days of VB6. A lot of Microsoft Developers now run open source projects to produce addons and modules and libraries for ASP.NET that both rival and in a surprising amount of circumstances overtake PHP's abilities.

  9. #9
    Join Date
    Mar 2011
    Location
    N 11° 19' 0.0012 E 142° 15' 0
    Posts
    1,529
    Thanks
    41
    Thanked 89 Times in 88 Posts
    Blog Entries
    3

    Default

    Hmmmm, interesting points... I conceed that ASP isn't as bad as I thought (never really bovered to try it ). I still think php is better but this isn't the reight place to have such a debate as in the end, it is up to the thread starter to decide which they want to use depending on their own specific circumstances...

  10. #10
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    There is no need to turn this into a debate, but as a PHP programmer for years, I want to defend it a bit: writing the code yourself is pretty easy in PHP. It gives you flexibility, and many programmers would argue that's the right way to do it. Secondly, PHP has a very wide array of built-in functions that do things for you, in all domains from various tricks with arrays to handling image manipulation. So I think that does count for shortcuts. And even if you do need to "do it yourself", it's not difficult, and it IS very easy to host. It's widely supported, and it's open source. It's also works on Windows (in addition to Linux). The alternative is ASP, which is proprietary to Microsoft, works (well) only on Windows and really is only popular for professional designers, and many of them still use PHP. For casual things and especially for availability of 3rd party resources, PHP is a great option-- take a look at this forum, for example.
    This says nothing against ASP (except that it is closed source and less popular so therefore less available and less supported by the web design community, especially with free projects), but please take that into consideration.

    As a side point, which really isn't very important, DD has always been a PHP-centric community, because most of our members use PHP if they use a serverside language. Having someone who uses ASP here is not a bad thing. In fact, it's something we've been lacking. But try not to think of ASP as the only option for these things.


    Now, rkguyden, we can't provide you with the HTML. This is NOT HTML. You need a serverside language for this. I hope the tangential discussions in this thread have not been too confusing, and I'll try to clarify. HTML just presents information to the user, nothing more. You can't do a login system, conditional ("if"-based) content, etc. For that, you need one of two things:
    1. Javascript is a clientside language that allows you to do some interaction and things like "if" statements. But the problem is that it works within the page, within the browser, and it's not secure (it's on the user's computer). It's good for interactive fun things, but not really for the sort of thing you're describing.
    2. PHP, ASP, CGI, Perl, and many other languages are serverside languages. This means that their entire job is to generate HTML. They don't "do" anything on the webpage. That's the job of HTML (and even JS and CSS) that they generate. But they DO generate HTML in many interesting ways, including things like interacting with a database and even storing information from the user into the database. Logins, conditional content and many other things are possible using a serveside language.

    So the short answer to your question is: whatever HTML you want, although one part of it must contain a form with the right login elements (username, password). ApacheTech's script is one option, but there are other options as well. Does your server allow ASP? PHP? It should allow at least one of them. If not, find a better server (it shouldn't be more than $5/mo for a basic [entirely sufficient] one).
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •