Jump to content

JellyFishBoy

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Everything posted by JellyFishBoy

  1. Realised I had too many div positioning tags which conflicted. Ended up using the above tool linked, worked a treat! Thanks for the help
  2. Tried inputing include: <div style="position:absolute; left:467px; top:684px; width:286px; height:154px; z-index:1;"> <div id="frag_3" style="text-align:left;"> <?php if(isset($_SESSION['user'])) { echo "<p class='Body-text-P'><span class='Body-text-T'>You are now logged in, <b>".$_COOKIE['firstname']." ".$_COOKIE['lastname']."</b></p></span>"; } else { include 'lform.html'; echo '<p class="Body-text-P"><span class="Body-text2-T">You are not logged in at this current time. Please login or register.</p></span>'; } ?> <><> But still now show, however when you look at page source the form html data is there, so im puzzled as to why there is no show o.O lform.html has this inside... <html> <body> <form id="form_1" name="login1" onSubmit="return validate_form_1(this)" action="logged.php" method="post" target="_self" enctype="application/x-www-form-urlencoded" style="margin:0px;"> <div id="txt_1" style="position:absolute; left:467px; top:570px; width:97px; height:16px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box; overflow:hidden; z-index:1;"> <p class="Body-text-P"><label for="edit_1"><span class="Body-text-T">Username</span></label></p> <> <div style="position:absolute; left:550px; top:565px; width:150px; height:22px; text-align:left; z-index:2;"> <input type="text" id="edit_1" name="uname" size="20" style="width:150px;" maxlength="50" value=""> <> <div id="txt_2" style="position:absolute; left:467px; top:605px; width:101px; height:16px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box; overflow:hidden; z-index:1;"> <p class="Body-text-P"><label for="edit_2"><span class="Body-text-T">Password</span></label></p> <> <div style="position:absolute; left:550px; top:600px; width:150px; height:22px; text-align:left; z-index:2;"> <input type="password" id="edit_2" name="password" size="20" style="width:150px;" maxlength="100" value=""> <> <div style="position:absolute; left:547px; top:635px; width:81px; height:22px; text-align:left; z-index:2;"> <input type="submit" name="submit" value="Submit"> <input type="hidden" name="submitlog" value="TRUE"> <> </form> </body> </html>
  3. <div style="position:absolute; left:467px; top:684px; width:286px; height:154px; z-index:1;"> <div id="frag_3" style="text-align:left;"> <?php session_start(); if(isset($_SESSION['user'])) { echo "<p class='Body-text-P'><span class='Body-text-T'>You are now logged in, <b>".$_COOKIE['firstname']." ".$_COOKIE['lastname']."</b></p></span>"; } else { echo '<form id="form_1" name="login1" onSubmit="return validate_form_1(this)" action="logged.php" method="post" target="_self" enctype="application/x-www-form-urlencoded" style="margin:0px;"> <div id="txt_1" style="position:absolute; left:467px; top:570px; width:97px; height:16px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box; overflow:hidden; z-index:1;"> <p class="Body-text-P"><label for="edit_1"><span class="Body-text-T">Username</span></label></p> </div> <div style="position:absolute; left:550px; top:565px; width:150px; height:22px; text-align:left; z-index:1;"> <input type="text" id="edit_1" name="uname" size="20" style="width:150px;" maxlength="50" value=""> </div> <div id="txt_2" style="position:absolute; left:467px; top:605px; width:101px; height:16px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box; overflow:hidden; z-index:1;"> <p class="Body-text-P"><label for="edit_2"><span class="Body-text-T">Password</span></label></p> </div> <div style="position:absolute; left:550px; top:600px; width:150px; height:22px; text-align:left; z-index:1;"> <input type="password" id="edit_2" name="password" size="20" style="width:150px;" maxlength="100" value=""> </div> <div style="position:absolute; left:547px; top:635px; width:81px; height:22px; text-align:left; z-index:1;"> <input type="submit" name="submit" value="Submit"> <input type="hidden" name="submitlog" value="TRUE"> </div> </form>'; echo '<p class="Body-text-P"><span class="Body-text2-T">You are not logged in at this current time. Please login or register.</p></span>'; } ?> </div></div> Still no luck? :/ Div tags dont close with PHP tags between them and form doesnt even show up...
  4. Hey guys! Im trying to setup an IF statement on my home page. Its purpose is to show EITHER a login form and state your not logged in if it cannot find a stored cookie OR if it does find a stored cookie it will NOT show the HTML form and state you are logged in. I have it mostly working apart from the fact Im not sure how to insert a HTML form into PHP IF statement and make it work. Since I dont want the user to see the login form when they are already logged in. Here is a link to the php script: http://pastebin.com/aenq4gbE Here is link to the live page: http://jfbsystems.co.uk/secure Any help or ideas would be much appreciated! JellyFishBoy
  5. Thanks for the help. I ended up moving the two PHP elements (menu and login check) within the body element so it flowed with the rest of the layout. I understand how it works now
  6. Hello, I am having some trouble with my CSS positioning for some of the objects on my website. It is on several pages, but I'm going to link one page and also the live URL so I can understand it and implement it elsewhere. I havent done CSS in a long while (PHP junkie ) so hence the stumble. The 2 parts I will copy and paste are moving position when I change the size of the window. I am sure there is a simple fix for this, any help? The welcome message is moving: echo "<p class='Body-text-P'><span class='Body-text2-T'>You are now logged in, <b>".$_COOKIE['firstname']." ".$_COOKIE['lastname']."</b></span</p>"; } else { echo '<p class="Body-text-P"><span class="Body-text-T">You are not logged in at this current time. Please login or register.</span</p>'; And so is the menu: <div id="menu" style="position:absolute; left:728px; top:44px; width:530px; height:51px; z-index:1;"><span class="Body-Navlist"> <ul id="navlist"> <li id="active"> <a href="./index.php">Home</a></li> <?php if (isset($_COOKIE['firstname']) AND (substr($_SERVER['PHP_SELF'], -10) != './logout.php')) { echo '<li><a href="./logout.php">Logout</a></li> <li><a href="./cpass.php">Change Password</a></li> '; } else { echo '<li><a href="./register.php">Register</a></li> <li><a href="./login.php">Login</a></li> <li><a href="./fpass.php">Forgot Password</a></li> '; } ?> <li><a href="./buy.php">Buy</a></li> <li><a href="./sell.php">Sell</a></li> <li><a href='./help.php'>Help</a></li> </ul> </span> </div> Here is the raw file: http://pastebin.com/Ev4bRt1p And here is the link to the live site : http://jfbsystems.co.uk/secure/index.php Thanks for any help
  7. Aha solved. Went into notepad++ settings and changed the 'Encoding' to ANSI. There is also an option for 'UTF-8 without BOM'. Thanks
  8. Same as before... Warning: Cannot modify header information - headers already sent by (output started at /home/e-smith/files/ibays/Primary/html/secure/logout.php:1) in /home/e-smith/files/ibays/Primary/html/secure/logout.php on line 3 Warning: Cannot modify header information - headers already sent by (output started at /home/e-smith/files/ibays/Primary/html/secure/logout.php:1) in /home/e-smith/files/ibays/Primary/html/secure/logout.php on line 4 Line 3: { Line 4: setcookie('firstname', '', time()-300, '/', '', 0); Line 5: setcookie('lastname', '', time()-300, '/', '', 0);
  9. Although..... my logout.php is flagging up the same error again. Saved with notepad++ and dont see any outputs before it.... <?php if(isset($_COOKIE['firstname'])) //if no cookie present redirect the user (able to use this if else function for all pages which need login verification) { setcookie('firstname', '', time()-300, '/', '', 0); setcookie('lastname', '', time()-300, '/', '', 0); } else { //if the user isnt logged in (no cookies found) the client be redirected to the home page echo "<b>You are already logged out.</b><br>"; echo "<p>If you are not redirected in 15 seconds click <A HREF='./index.php'>here</A>."; print "<meta HTTP-EQUIV='REFRESH' content='5 url=./index.php'></p>"; } echo "<p>You are now logged out <b>{$_COOKIE['firstname']}</b>.</p>"; echo "<p>If you are not redirected in 15 seconds click <A HREF='./index.php'>here</A>."; print "<meta HTTP-EQUIV='REFRESH' content='5 url=./index.php'></p>"; ?> <html lang="en"> <head> <title>JFB Systems - Online Store - Home</title> <style type="text/css"> <!-- body {margin: 0px; padding: 0px;} a:link {color: #000000;} a:visited {color: #000000;} a:hover {color: #ffffff;} a:active {color: #000000;} a:link {text-decoration:none;} .Body-P { margin:0.0px 0.0px 0.0px 0.0px; text-align:left; font-weight:400; } .Body-Text-P { margin:0.0px 0.0px 0.0px 0.0px; text-align:center; font-weight:400; } .Body-C { font-family:"Arial", sans-serif; font-size:21.0px; line-height:1.19em; } .Body-C0 { font-family:"Times New Roman", serif; font-size:21.0px; line-height:1.14em; } .Body-Text-C { font-family:"Arial", sans-serif; font-size:11.0px; line-height:1.27em; } .Body-Navlist { font-family:"Arial", sans-serif; font-size:13.0px; color:black; line-height:1.19em; } #navlist li { display: inline; list-style-type: none; padding-right: 20px; } --> </style> <script type="text/javascript" src="wpscripts/jspngfix.js"></script> <script type="text/javascript"><!-- var blankSrc = "wpscripts/blank.gif"; --></script> <div id="menu" style="position:absolute; left:728px; top:44px; width:530px; height:51px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box; overflow:hidden; z-index:1;"><span class="Body-Navlist"> <ul id="navlist"> <li id="active"> <a href="./index.php">Home</a></li> <?php if (isset($_COOKIE['firstname']) AND (substr($_SERVER['PHP_SELF'], -10) != './logout.php')) { echo '<li><a href="./logout.php">Logout</a></li> <li><a href="./cpass.php">Change Password</a></li> '; } else { echo '<li><a href="./register.php">Register</a></li> <li><a href="./login.php">Login</a></li> <li><a href="./f_pass.php">Forgot Password</a></li> '; } ?> <li><a href="./buy.php">Buy</a></li> <li><a href="./sell.php">Sell</a></li> <li><a href='./help.php'>Help</a></li> </ul> </span> </div> </head> <body text="#000000" style="background-color:#ffffff; text-align:center; height:800px;"> <div style="background-color:transparent;text-align:left;margin-left:auto;margin-right:auto;position:relative;width:900px;height:800px;"> <div style="position:absolute; left:31px; top:83px; width:841px; height:694px;"> <img src="wpimages/wp6f2c4b55.png" width="841" height="694" border="0" id="qs_16" name="qs_16" title="" alt="" onload="OnLoadPngFix()"></div> <div style="position:absolute; left:32px; top:79px; width:840px; height:4px;"> <img src="wpimages/wp011a815e.png" width="840" height="4" border="0" id="qs_15" name="qs_15" title="" alt="" onload="OnLoadPngFix()"></div> <div style="position:absolute; left:51px; top:76px; width:359px; height:704px;"> <img src="wpimages/wp8ad5650a.png" width="359" height="704" border="0" id="qs_10" name="qs_10" title="" alt="" onload="OnLoadPngFix()"></div> <div id="txt_99" style="position:absolute; left:88px; top:109px; width:284px; height:238px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box; overflow:hidden;"> <p class="Body-P"><span class="Body-C">Logged Out</span></p> <p class="Body-P"><span class="Body-C0"> </span></p> <p class="Body-P"><span class="Body-C0"> </span></p> </div> <div id="txt_16" style="position:absolute; left:122px; top:777px; width:656px; height:23px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box; overflow:hidden;"> <p class="Body-Text-P"><span class="Body-Text-C">Copyright © All rights reserved. JFB Systems.</span></p> </div> <div style="position:absolute; left:35px; top:1px; width:831px; height:95px;"> <img src="wpimages/wp618f8c40.png" width="831" height="95" border="0" id="txt_98" name="txt_98" title="" alt="Online store " onload="OnLoadPngFix()"></div> </div> </body> </html> Any ideas?
  10. That being said what PHP editor would you recommend?
  11. Ah yes that was for an old if argument, forgot to edit that out Thanks..... ......and it WORKS! Seems like Dreamweaver is not a PHP friendly program. Thanks for the help guys. Much appreciated
  12. jfbsystems.co.uk/secure/login.php is the live page by the way..
  13. I just saved in Notepad++ and reloaded the page. It doesn't flag any PHP errors now, but still doesn't input the cookies after checking via Page Info on Firefox... :/
  14. I cant see anything. Only thing before the cookies is field validation and calling the config.php file. Here is the coding at the top of the page... <?php include_once ("config.php"); if(isset($_POST['submitl'])) { //Validate username input if (!empty($_POST['username'])) { $username = stripslashes($_POST['username']); } else { $username = NULL; echo "<p class='Body-error-P'><span class='Body-text-T'>You forgot to enter your username.</span></p>"; } //Validate password input if (!empty($_POST['pass'])) { $pass = stripslashes($_POST['pass']); } else { $pass = NULL; echo "<p class='Body-error2-P'><span class='Body-text-T'>You forgot to enter your password.</span></p>"; } //Validating input details and executing mysql query if ($username && $pass) { mysql_connect("$dhost","$dname","$dpass"); //Connection to mysql server @mysql_select_db("$dbase") or die ("Unable To Select Database!"); //Connection to stated database $query = "SELECT firstname, lastname, username FROM userdata WHERE password=SHA('$pass')"; //Retrieves firstname and lastname for username and password combination $result = @mysql_query ($query); $row = mysql_fetch_array ($result, MYSQL_NUM); //Return a record, if applicable if ($row) { //$num = mysql_num_rows ($result); //if($num > 0) //{ $row = mysql_fetch_array ($result, MYSQL_ASSOC); setcookie('firstname', $row[0], time()+1800, '/', '', 0); setcookie('lastname', $row[1], time()+1800, '/', '', 0); setcookie('username', $row[2], time()+1800, '/', '', 0); //Set the cookies echo "<p class='Body-error-P'><span class='Body-text-T'>Login successful. If you are not redirected in 15 seconds click <A HREF='./index.php'>here</A></span></p>"; print "<meta HTTP-EQUIV='REFRESH' content='5 url=./index.php'>"; } else { //no record matched the query echo "<p class='Body-error-P'><span class='Body-text-T'>The username and password you entered are not valid.</span></p>"; } mysql_close(); //close database connection } } ?>
  15. Line 34 - 36: setcookie('firstname', $row[0], time()+1800, '/', '', 0); setcookie('lastname', $row[1], time()+1800, '/', '', 0); setcookie('username', $row[2], time()+1800, '/', '', 0); //Set the cookies
  16. Just initiated PHP Error handling on my server. Get this message: Warning: Cannot modify header information - headers already sent by (output started at /home/e-smith/files/ibays/Primary/html/secure/login.php:1) in /home/e-smith/files/ibays/Primary/html/secure/login.php on line 34 Maybe I need to put the PHP script with setcookies() within the <head> tags?
  17. Hhmmm. When I look for cookies on Firefox it states on both login.php (before it redirects) and index.php... Is this website storing any information (cookies) on my computer? No. :S Must be something with the cookie declaration then?
  18. Yes that line is displaying upon pressing the 'Login' button.
  19. Ok. Changed the login php to put the setcookie at the top of the script login.php : http://pastebin.com/08wJMqWE And also changed index.php to retrieve the cookies at the top of the page index.php: http://pastebin.com/fwrTViJG Still no luck
  20. Yes they are. Here is the login.php full script: http://pastebin.com/L639gFRC Here is the index.php: http://pastebin.com/fwQ9rctk
  21. Hello, I am new to this forum and joined in hope I could get some help in relation to some PHP problems I have stumbled across within my work. I am currently working on an online store I am building from scratch. I have already built the basic system behind it and am now starting to implement a more user friendly design to it with JS validation, stylesheets and imaging layout. I have however come across a COOKIE problem with my login script. The purpose behind it is to only allow users into an area if they have logged in and declared cookies. I declare the cookies with 'setcookie()' then try and retrieve them with '$_COOKIE['firstname'];'. However since implementing my new design layout it has stopped being able to retrieve the cookies. Here is some of the script. I would greatly appreciate any help given ... Login.php <?php //Validating input details and executing mysql query if ($username && $pass) { mysql_connect("$dhost","$dname","$dpass"); //Connection to mysql server @mysql_select_db("$dbase") or die ("Unable To Select Database!"); //Connection to stated database $query = "SELECT firstname, lastname, username FROM userdata WHERE password=SHA('$pass')"; //Retrieves firstname and lastname for username and password combination $result = @mysql_query ($query); $row = mysql_fetch_array ($result,MYSQL_NUM); //Return a record, if applicable if ($row) { setcookie('firstname', $row[0], time()+3600); setcookie('lastname', $row[1], time()+3600); setcookie('username', $row[2], time()+3600); //Set the cookies echo "<p class='Body-error-P'><span class='Body-text-T'>Login successful. If you are not redirected in 15 seconds click <A HREF='./index.php'>here</A></span></p>"; print "<meta HTTP-EQUIV='REFRESH' content='5 url=./index.php'>"; } else { //no record matched the query echo "<p class='Body-error-P'><span class='Body-text-T'>The username and password you entered are not valid.</span></p>"; } mysql_close(); //close database connection } } Index.php <?php include_once ("config.php"); if(isset($_COOKIE['firstname'])) //if not cookie present, redirect the user { echo "<p class='Body-text-P'><span class='Body-text2-T'>You are now logged in, <b>".$_COOKIE['firstname'].' '.$_COOKIE['firstname']."</b></span</p>"; } else { echo '<p class="Body-text-P"><span class="Body-text-T">You are not logged in at this current time. Please login or register.</span</p>'; } ?> Let me know if you need anymore coding...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.