+ Reply to Thread
Page 1 of 4 123 ... LastLast
Results 1 to 10 of 33

Thread: PHP Login code integrating help....

  1. #1
    rufussweetwater's Avatar
    rufussweetwater is offline x10Hosting Member rufussweetwater is an unknown quantity at this point
    Join Date
    May 2009
    Location
    IN, USA
    Posts
    56

    Question PHP Login code integrating help....

    I have a PHP login system that i need help integrating into my website. The following code is the specific code i need to be integrated into the other following code which is my login section on my site.

    Login code [this is the brains (or insides) of my login code]
    PHP Code:
    <? 
    /** 
    * Main.php 

    * This is an example of the main page of a website. Here 
    * users will be able to login. However, like on most sites 
    * the login form doesn't just have to be on the main page, 
    * but re-appear on subsequent pages, depending on whether 
    * the user has logged in or not. 

    * Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC) 
    * Last Updated: August 26, 2004 
    */ 
    include("include/session.php"); 
    ?> 

    <html> 
    <title>CYK Studios | Home</title> 
    <body> 

    <table> 
    <tr><td> 


    <? 
    /** 
    * User has already logged in, so display relavent links, including 
    * a link to the admin center if the user is an administrator. 
    */ 
    if($session->logged_in){ 
       echo 
    "<h1>Logged In</h1>"
       echo 
    "Welcome <b>$session->username</b> <br><br>" 
           
    ."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] &nbsp;&nbsp;" 
           
    ."[<a href=\"useredit.php\">Edit Account</a>] &nbsp;&nbsp;"
       if(
    $session->isAdmin()){ 
          echo 
    "[<a href=\"admin/admin.php\">Admin Center</a>] &nbsp;&nbsp;"
       } 
       echo 
    "[<a href=\"process.php\">Logout</a>]"

    else{ 
    ?> 

    <h1>Login</h1> 
    <? 
    /** 
    * User not logged in, display the login form. 
    * If user has already tried to login, but errors were 
    * found, display the total number of errors. 
    * If errors occurred, they will be displayed. 
    */ 
    if($form->num_errors 0){ 
       echo 
    "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>"

    ?> 
    <form action="process.php" method="POST"> 
    <table align="left" border="0" cellspacing="0" cellpadding="3"> 
    <tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr> 
    <tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr> 
    <tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>
    <font size="2">Remember me &nbsp;&nbsp;&nbsp;&nbsp; 
    <input type="hidden" name="sublogin" value="1"> 
    <input type="submit" value="Login"></td></tr> 
    <tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr> 
    <tr><td colspan="2" align="left"><br> 
    Not registered? <a href="register.php">Sign-Up</a></td> 
    </tr> 
    </table> 
    </form> 

    <? 


    /** 
    * Just a little page footer, tells how many registered members 
    * there are, how many users currently logged in and viewing site, 
    * and how many guests viewing site. Active users are displayed, 
    * with link to their user information. 
    */ 
    echo "</td></tr><tr><td align=\"center\"><br><br>"
    echo 
    "<b>Member Total:</b> ".$database->getNumMembers()."<br>"
    echo 
    "There are $database->num_active_users registered members and "
    echo 
    "$database->num_active_guests guests viewing the site.<br><br>"

    include(
    "include/view_active.php"); 

    ?> 


    </td></tr> 
    </table> 


    </body> 
    </html>
    login section on my site [this is the design & layout of my login section]
    PHP Code:
    <!--Login Background Starts --> 
    <
    div id="login-bg"
                <!--
    Login Area Starts --> 
                <
    div id="login-area"
                    <
    form action="process.php" method="post" name="Login" id="Login"
                        <
    label>Members Login:</label
                        <
    div align="center"
                          <
    input name="user" type="text" id="user" value="username" maxlength="32" /> 
                          <
    input name="pass" type="password" id="pass" value="password" maxlength="32" /> 
                          <
    input name="Submit" type="submit"  class="login-btn" title="Login" value="Login" src="images/login-btn.gif" alt="Login" /> 
                          <
    br class="spacer" /> 
                      <
    span class="style1">  Remember Me | <a href="forgotpass.php">Forgot Password?</a></span></div
                  </
    form
                </
    div
                <!--
    Login Area Ends --> 
            </
    div
            <!--
    Login Background Ends --> 
    Also i recommend viewing this link [http://cykstudios.exofire.net/] as well, its my header and what i want the design to look like.

    if you dont understand what i am asking for, i want the first code to be integrated [combined] with the second code.


    Any help at all is very much appreciated!!!

    :hahano: Don't Laugh, I'm not a hard gamer... :hahano:

    ................I Know................
    :wavey: $====> CYK Studios <====$ :lockd:
    Movies, Games, Reviews, & More...

  2. #2
    Submariner is offline x10Hosting Member Submariner is an unknown quantity at this point
    Join Date
    Dec 2007
    Location
    TN, USA
    Posts
    44

    Re: PHP Login code integrating help....

    Looks like all you need to do is put the second code block in the else clause of the first. Then if the user is not logged in the second block will be displayed and if the user is logged in the upper section of the if will be displayed.

    Have fun...
    James

  3. #3
    rufussweetwater's Avatar
    rufussweetwater is offline x10Hosting Member rufussweetwater is an unknown quantity at this point
    Join Date
    May 2009
    Location
    IN, USA
    Posts
    56

    Re: PHP Login code integrating help....

    I forgot to mention that I suck at php coding. I understand what your saying, but I don't know how to write/add code blocks. I am new to php coding soo..... Could you help a little bit more?
    Last edited by rufussweetwater; 07-18-2009 at 04:50 PM.

    :hahano: Don't Laugh, I'm not a hard gamer... :hahano:

    ................I Know................
    :wavey: $====> CYK Studios <====$ :lockd:
    Movies, Games, Reviews, & More...

  4. #4
    zapzack is offline x10 Elder zapzack is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    606

    Re: PHP Login code integrating help....

    Ok.. I can do this but I'm sorta confused on what you want.. You want the PHP code integrated with the site?

  5. #5
    rufussweetwater's Avatar
    rufussweetwater is offline x10Hosting Member rufussweetwater is an unknown quantity at this point
    Join Date
    May 2009
    Location
    IN, USA
    Posts
    56

    Re: PHP Login code integrating help....

    if you go to my site [CYK Studios] you see on the top right corner my members login section, this is the second box of code i posted earlier. i want the first box of code combined with the second box of code so i can then copy and paste it into my login section through Dreamweaver. yes it will combine with my page, but ill clone the code later so that it works on multiple pages. Right now i just want the two boxes of codes merged. You're basically doing an organ transplant, you're taking out the junk code that doesn't connect me to the server [from the second code box] and replacing it with the first box of code that does connect me to the server.

    i kinda have a hard time explaining myself so please tell me if im just babbling on about nothing...

    Also please take note that when your viewing my site, the sign up button is not with the other member login section. i will supply you with that code right here.

    Code:
    <!--Navigation Background Part Starts -->
    <div id="navigation-bg">
    	<!--Navigation Part Starts -->
    	<div id="navigation">
    		<ul class="mainMenu">
    			<li><a href="index.html" class="selectMenu">Home</a></li>
    			<li><a href="videos.html">Videos</a></li>
    		  <li><a href="archives.html">Archives</a></li>
    		  <li><a href="http://cykstudios.exofire.net/phpBB3/index.php" target="_parent">Forums</a></li>
    		  <li><a href="podcasts.html">Podcasts</a></li>
    		  <li><a href="downloads.html">Downloads</a></li>
    		  <li class="noBg"><a href="contactus.html">Contact Us</a></li>
    	  </ul>
    		<a href="register.php" class="signup"></a>
    	  <br class="spacer" />
    		<ul class="subNav">
    			<li class="noBg"></li>
    		  <li></li>
    		  <li></li>
    		  <li></li>
    		  <li></li>
    		  <li></li>
    		  <li></li>
    		  <li></li>
    	  </ul>
    		<br class="spacer" />
    	</div>
    	<!--Navigation Part Ends -->
    </div>
    <!--Navigation Background Part Ends -->
    this part here "<a href="register.php" class="signup"></a>" that's the sign up button in the code. if you didnt notice i gave you my entire navbar code to hopefully help you more...

    I thank you soo much for helping me with this. Once again i am not a good PHP coder when it comes to this, and this login system if my first project! so it's kinda stressful trying to look for help and getting crap for answers. But everyone here has helped alot...

    I thank you once again...

    :hahano: Don't Laugh, I'm not a hard gamer... :hahano:

    ................I Know................
    :wavey: $====> CYK Studios <====$ :lockd:
    Movies, Games, Reviews, & More...

  6. #6
    Chrisisrad is offline x10Hosting Member Chrisisrad is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    23

    Re: PHP Login code integrating help....

    Let me see if ive got this right, you want to style your login, to look like your site?
    And only show content to users that are signed up?
    My site http://www.adds0wn.co.cc Is Worth

  7. #7
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: PHP Login code integrating help....

    first of all, you should seriously think of going through a php tutorial if you plan on building yourself your website. Help on the forums is nice, but it may take days to accomplish what you can do in minutes with the right knowledge. I recommend 2 tutorials.

    First one is at w3schools. W3schools is a great resource for any web developer. It's usually the goto place right after the official docs and just before google. There is tons of ressources on this website.
    The other website tutorial I recommend is on Tizag. Tizag is another type of tutorial and provides more hads-on examples. With those two in mind, you should be good for php.
    Always remember that you can use the official php doc for reference.

    Now concerning your php problem. If you want, I can edit your files for you. Simply create a FTP user for me and PM me the info. I will get my hands dirty in the code and I will make your login section work.
    Last edited by xav0989; 07-19-2009 at 02:50 AM.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  8. #8
    rufussweetwater's Avatar
    rufussweetwater is offline x10Hosting Member rufussweetwater is an unknown quantity at this point
    Join Date
    May 2009
    Location
    IN, USA
    Posts
    56

    Re: PHP Login code integrating help....

    Let me see if ive got this right, you want to style your login, to look like your site?
    And only show content to users that are signed up?
    Answer: Yes!!!, I really can't explain myself that well, but that's what i'm after. YES! :laugh:

    first of all, you should seriously think of going through a php tutorial if you plan on building yourself your website. Help on the forums is nice, but it may take days to accomplish what you can do in minutes with the right knowledge. I recommend 2 tutorials.

    First one is at w3schools. W3schools is a great resource for any web developer. It's usually the goto place right after the official docs and just before google. There is tons of ressources on this website.
    The other website tutorial I recommend is on Tizag. Tizag is another type of tutorial and provides more hads-on examples. With those two in mind, you should be good for php.
    Always remember that you can use the official php doc for reference.

    Now concerning your php problem. If you want, I can edit your files for you. Simply create a FTP user for me and PM me the info. I will get my hands dirty in the code and I will make your login section work.
    When i do look to Google for PHP help i do see W3Schools alot but i never went cause no one else whom i asked said anything about them when i asked for a good tutorial, they just told me to stay on the forums and ask for help.

    I will check out both of these tutorials, thank you.


    Now about my PHP problem, i want to wait before i give you access to see what the other two users that posted here can do, cause i'm very cautious when it comes to giving helping strangers my site info [besides my site address].i just want to wait first, before i go straight to you for the problem, nothing personal, it's just internet saftey... :hahano:

    :hahano: Don't Laugh, I'm not a hard gamer... :hahano:

    ................I Know................
    :wavey: $====> CYK Studios <====$ :lockd:
    Movies, Games, Reviews, & More...

  9. #9
    zapzack is offline x10 Elder zapzack is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    606

    Re: PHP Login code integrating help....

    This can be a little complicated when you think about it.. Since you cannot have .html files executing php code.. you would need to change them to .php.. HTML is horrible since you have to update the header file on every page.. A good idea is to make a header.php file and a footer.php file and just move the header and footer there and include them into every php file..

  10. #10
    rufussweetwater's Avatar
    rufussweetwater is offline x10Hosting Member rufussweetwater is an unknown quantity at this point
    Join Date
    May 2009
    Location
    IN, USA
    Posts
    56

    Re: PHP Login code integrating help....

    Okay, what all would i include in my header/footer.php? i know their separate pages, but for my header.php should i have everything up to my navbar or just the header and login system?

    :hahano: Don't Laugh, I'm not a hard gamer... :hahano:

    ................I Know................
    :wavey: $====> CYK Studios <====$ :lockd:
    Movies, Games, Reviews, & More...

+ Reply to Thread
Page 1 of 4 123 ... LastLast

Similar Threads

  1. working with a PHP login system script...
    By rufussweetwater in forum Programming Help
    Replies: 11
    Last Post: 07-01-2009, 08:02 AM
  2. phpMyAdmin not allowing create php code
    By Calystos in forum Free Hosting
    Replies: 2
    Last Post: 11-25-2008, 02:07 AM
  3. Host php code for an adult blog
    By mycamgirl in forum Free Hosting
    Replies: 2
    Last Post: 10-13-2008, 08:27 AM
  4. Replies: 3
    Last Post: 03-10-2008, 12:22 PM
  5. syntax highlighting for PHP code
    By dharmil in forum Graphics & Webdesign
    Replies: 1
    Last Post: 08-03-2006, 05:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers