edgarasm Posted November 7, 2013 Share Posted November 7, 2013 Hi there php freaks im looking at hiding a login form at the index page ,so once the user logs in if he decides to click on home/index page ,he wont see login form again untill he logs out my index page code <?php include 'header.php'; ?> <link rel=”apple-touch-icon” href="http://www.tugapay.com/webicon.png" <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/> <link rel="apple-touch-startup-image" href="/startup.png"> <meta name="apple-mobile-web-app-capable" content="yes" /> <div id="content"> <div class="container inner"> <form action="/account/index.php" method="POST" enctype="multipart/form-data"> <form action="loginprocess.php" method="POST"> <form action="/account/register.php" method="POST" enctype="multipart/form-data"> <div class="one_third"> <label>Email Address: </label> <input type="text" id="login_email" name="login_email" spellcheck="false"> </div> <div class="one_third"> <label>Password: </label> <input type="password" id="login_password" name="login_password" spellcheck="false"> </div> <div class="one_third" style="padding-top: 0px;"> <td><a href="../account/loginprocess.php"<input type="submit" id="login_submit" name="login_submit" style="background: light_blue;" class="button" value="Login to Account">Login to Accounts</a></td> </div> <div class="one_third" style="padding-top: 0px;"> <td><a href="/account/register.php" id="login_submit" name="login_submit" input type="submit" style="background: light_blue;" class="button" value="Register">Register</a></td> </div> </form> </div> </div> <div id="slider" class="flexslider"> <ul class="slides"> <li> <img src="/assets/images/blog/pic.jpg" alt=""> <div class="inner"> <h2 class="flex-caption" style="bottom: 60px;">Want to send money Quick & Easy?</h2> <h3 class="flex-caption" style="bottom: 20px;">Join Us today to see how its done</h3> </div> </li> </ul> <script type="text/javascript"> /* <![CDATA[ */ $(window).load(function(){ $('.flexslider').flexslider({ //smoothHeight: true, controlNav: false, animation: "slide", start: function(slider){ $('body').removeClass('loading'); } }); }); /* ]]> */ </script> </div> <div id="content"> <div class="container inner"> <div class="one_third"> <i class="icon-time large left"></i> <div class="column"> <h2>Easy & Secure</h2> <p>Our Payment System is User friendly and Most Secure to ensure your identity and money is secure .</p> <a href="#" class="button large">Read More</a> </div> </div> <div class="one_third"> <i class="icon-magic large left"></i> <div class="column"> <h2>Fast</h2> <p>Sending and Receiving money is fast and almost instant and covered almost everywhere around the globe.</p> <a href="#" class="button large">Read More</a> </div> </div> <div class="one_third"> <i class="icon-bar-chart large left"></i> <div class="column"> <h2>Grow Your Business</h2> <p>With Our Payment Solution you can make your business income increase rapidly using our tools .</p> <a href="#" class="button large">Read More</a> </div> </div> </div> <div class="separated"> <div class="inner"> <div class="container"> <div class="highlight"> <h2>Solutions that you need</h2> <p>With <strong>TugaPay</strong> Your business will only grow and your profits will only maximize very rapidly and make your business a success . Other payment solutions can be difficult to understand and register for, but our payment solutions are one of the best out there. </p> <p>So why not try it Today?</p> </div> </div> </div> </div> </div> <?php include 'footer.php'; ?> And this is my loginprocess code <?php $email = $_POST('login_email'); $pass = md5($_POST['password']); $query = mysql_query("SELECT * FROM users WHERE login_email = '$email' AND login_password = '$pass' AND activation IS NULL"); $data = mysql_fetch_assoc($query); if mysql_num_rows($query) ?> Also another problem im getting is when i click to login it redirects me to another login page which is in another folder which i have and i want it to redirect me to dashboard anyone out there could help me with this nonsense? Quote Link to comment Share on other sites More sharing options...
OOP Posted November 7, 2013 Share Posted November 7, 2013 Hi edgarasm, Is your HTML code complete? I am a bit confused as I can see three open form tags each pointing to different php script. One more thing, it is not secure to use user provided inputs directly in your SQL statement. Quote Link to comment Share on other sites More sharing options...
edgarasm Posted November 7, 2013 Author Share Posted November 7, 2013 yes this is my php code for the main page and then a process page for the login and afterwards it redirects me to my secondary login screen .what you would suggest about sql statement ? thanks Quote Link to comment Share on other sites More sharing options...
edgarasm Posted November 7, 2013 Author Share Posted November 7, 2013 what would i have to do to rewrite all my queries in pdo ? Quote Link to comment Share on other sites More sharing options...
scuttzz Posted November 8, 2013 Share Posted November 8, 2013 Have you thought about instead of hiding the form replace it with text that says something like logged in(as this may be unclear to the user) or a unordered list with user accounts settings and logout links ect..This can be easily achieve by making a global function for the logged in session, something along the lines of this function logged_in() { return (isset($_SESSION['user_id'])) ? true : false; } I personally make the login form within a include php file, and then within that file I reference to files, loggedin.php(holds the div that has user settings and logout functionality) and login.php that obviously holds the login form and other php scripts for the login itself. The file that will hold all those included files is normally the same that checks the session. Ill give an example using the logged_in function included.. <div class="login"> <?php if (logged_in() == true) { include 'includes/loggedin.php'; } else { include 'includes/login_form.php'; } ?> </div> This is a very simple example so excuse me if its very roughly drafted. Hope this helps Quote Link to comment Share on other sites More sharing options...
edgarasm Posted November 11, 2013 Author Share Posted November 11, 2013 I deleted the form ,hovewer i want to hide register and login buttons if session is active ,anyone could direct me into a good path on how to hide the buttons if the $session has id .and once the session has no id the buttons appear Quote Link to comment 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.