Jump to content

cssfreakie

Staff Alumni
  • Posts

    1,674
  • Joined

  • Last visited

Everything posted by cssfreakie

  1. It's a bit unclear for me what you normally expect, because you didn't describe that with an example. May I assume you don't want to allow an Iframe? And that you just want them to leave an ordinary link?
  2. IE 9 (if you have it) has something similar to firebug but from my point of view it's a bit more chaotic. If you open up a website in IE9 and press F12 you get a sort of inspector. (same is for chrome btw) That way you can inspect the elements presented, and alter it in your browser live. As for referencing, do as you like although I would suggest to anyone new to get a book on the topic So if you were to reference I would add what i just mentioned because i think it is vital. Books have more structure, are much more detailed start at the beginning and work their way upwards. It saves one searching, and within a week one definitely knows more than trying out crappy online tutorials. Tutorials are pretty much always handle a tiny bit, and assuming one knows his stuff already. Not to mention my blog does not have tutorials, they are little articles.
  3. no I don't comment for production, I have a specific order I always use. In production i use a compressed stylesheet without comments at all. I test locally with a non compressed and commented stylesheet though. Conditional comments are something different btw
  4. cssfreakie

    tables

    no their not, but but they are often abused for things they are not meant for although it does the job. For instance building your complete site template by using tables. That is besides redundant bad. Tables are not bad the coder that does not use them properly. It's like using the grill of a jaguar XFR To grill your meat on. It works, but there are better methods. The grill is perfect but better suited on a expensive car. As a rule of thumb. If you have multi column data (like a spreadsheet) or making html emails, you can use tables. is it a single column a List is much better. as for templates, use divs to make the general structure. In the end it's about using the right tool for the right moment.
  5. if you don't want to use sessions to store the previous page like JCbones sugested, You could append a $_GET variable to your login link. ONes someone presses that link the variable is passed along, than at the login form you can store that variable as a hidden field. To keep i persistent. A simple example could be: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>PAGE A</title> </head> <body> <div id="wrapper"> <div id="login"> <?php echo '<a href="loginlinkform.php?article='.$_SERVER['SCRIPT_NAME'].'">Login</a>';?> </div> <p class="article"> lalala this is some article </p> </div> </body> </html> than your login form, (stripped down just to show how to use that $_GET variable) <?php $location = ''; //first time if(isset($_GET['article'])){ $location = $_GET['article']; }else{ //do something else } //if submitted the $_GET variable is gone so we store it in a hidden field, other methods are possible here if(isset($_POST['submit'])){ $location = $_POST['location']; } ?> <form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post"> <input type="hidden" name="location" value="<?php echo $location; ?>" /> <input type="text" name="username" /> <input type="password" name="password" /> <input type="submit" name="submit" value="login" /> </form> Anyway there are more roads that lead to Rome, so pick the one that makes more sense to you
  6. you are overcomplicating things. Before you code just get a pen and pencil and work out the most simplistic way of doing things. As you stated, you want on every page, a welcome, user thing (if logged in) and Also something that allows them to login. IF you combine those two, al you have to do is include 'login.php'; in the pages you want without having to mess around with headers() Have a look at the attachment. That is how I would do it. You make some login logic script and where ever you want to use it include it. in the page in the position you like. The login form is self referencing so there is no need to remember where someone came from. (it all happens on the same page) Thus no need to overcomplicate things. In the end you want (or atleast I would) 1 index.php where you include a nice template. Within that template you include little logics like a login form, twitter module etc. So in other words all the logic is in separate files and ones you need it you include it in your template. If I were you I would just sit down and write down the logic for the 2 situations: Logged in and not logged in. Combine those in 1 if clause Like in the image attached, and ones that works all you have to do is include it where ever you want. [attachment deleted by admin]
  7. Get firebug for firefox and inspect the element. Instead of guessing you than know exactly how it is done.
  8. It comes down to how many header request you find acceptable. The more request you make on your site the slower it will load. That said. The only reason why i would use extra separate stylesheet is when using conditional comments for older versions of IE. Than it is not an option to combine them, unless you want to use all kinds of css hacks which I never use.
  9. In the end what is important is that the end-user feels happy/comfortable with the solution you give. But as PFMaBiSmAd mentioned. A very solid way is just to implement it on the same page the way you want, without having to deal with extra complexity. If your not logged in, a username and password field are shown, else a welcome message. You can make the logic for that in a separate file and just include as said on each page you want people to have a logged in status. Your method works too, but it's a little more complex (than needed). But it's good to try it out anyway
  10. sessions are the way to go Ones someone logged in(1 time you contact the database, and check credentials), you store that in a session . So adding Welcome Debbie, can be just as easy as a simple check. Is debbie logged in if so echo hello debbie
  11. I assume it works? if so well done!
  12. are you serious???? did you click that? Are you seriously expecting that people here copy paste that stuff for you? and post it here so you don't have to do the effort?
  13. Jaysonic is totally right! So use conditional comments or something to target older browsers and apply new techniques for the new ones. have you got an idea what the impact is of using single images where you don't have to in for instance the following case. I don't think you do, because the impact is huge! anyway lets keep it on topic
  14. type in google conditional comments first link or try: http://www.quirksmode.org/css/condcom.html Not sure what you want to use this for though. I only use it to back up ie 7 and 6. If you want a more complete thing use this: http://chrisschuld.com/projects/browser-php-detecting-a-users-browser-from-php/ good luck! eidt: and mark it solved ones your done
  15. So atleast 30% of your audience can't enjoy it
  16. in case you want to have a fool proof crossbrowser solution, use a 1x1 .png in the color and transparancy you like and set that as background color on repeat
  17. hmm... Look if you rightclick your page and press view source. Anything you see there is sent to your browser. If your code with the header() is inside there (you won't see it since it is php serverside) you will get Headers already sent. SO your code with using header() MUST come Before all the stuff you see when you pressed view source. So to repeat it. if you right click and than do view source. ALL that stuff is sent to your browser and thus the headers are sent. If you have header() inside of that code (although you wont see it since it is php serverside code) It won't execute and throw an error. so to do it properly <?php header( some stuff); // above EVERYTHING!!!!!!!!!!!!!!!!!!!!!!!! ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>PAGE A</title> </head> <body> ...etcetera p.s. I am off to work
  18. well as already mentioned by pretyy much everyone here and the link that was given even a slight whitespace will cause headers sent (Stuff is sent to your browsers, text, whitespace monkeys images whatever) If you can't place this code above, I would revisit your code to be honest. IF you don't feel like it, have a look again at that link givven and play around with ob_start(). anyway the cause of this error is now clear and you know how to solv it now. place this stuff before anything is being output (sent to the browser) or play around with ob_start()
  19. And there you have it!! at line 112 your trying to do a header() which you can't because you already sent stuff (pretty much your whole page) // Redirect User. if (isset($_SESSION['returnToPage'])){ header("Location: " . $_SESSION['returnToPage']); }else{ // Take user to Home Page. header("Location: " . WEB_ROOT . "index.php"); } Place this In the top part of your code above <doctype> and it should be fine. And this is why we like precise error reports
  20. Expect a call from me soon... Debbie Okay have a look at the attachment, I included a folder with page A B and C. although they are static, you can do the same with a database. Run that and press the buttons. half way clear you cookies refresh the page and do it again. Hope it helps try to see the logic in it. It's just a simple thing. Its very easy to build a link with that as a back button. [attachment deleted by admin]
  21. pretty much yes. Keep in mind though the $_GET variable is user input so make sure when you query a database to run it through the appropriate function The moment someone can influence input it should be considered as unsafe. (user input) And user input is not only a $_POST or $_GET variable. SCRIPT_NAME can not be influenced. To understand this the only way is to test it out and read alot. (hence echo $_SERVER variables) SCRIPT_NAME just uses the script name (which is always the same) PHP_SELF and REQUEST_URL can change all the time (and can be influenced on purpose, which is why you can't rely on it) Just test it. Make a page with a form in it, as action use echo $_SERVER['PHP_SELF'] than append some weird stuff after your url like so domain.com/index.php/someweirdstuff if you press submit you can still see the /weirdstuff in your browser(which i typed myself) so nothing stops me to add some javascript there. SO in a nutshell any 'potential' user input can not be trusted. But before you panic. First make sure the basic logic of your script stands. Afterwards let someone have a look at it if there might be security flaws.
  22. make a template for any code you write and above everything put: <?php error_reporting(E_ALL); ini_set("display_errors", 1); // rest of the code ?> anytime you get an error. Give us the precise error message (they are detailed). If it refers to a line. Give us the code that is on and around that line and tell us what the line is. In a Nutshel the code you use or the file you have is already outputting stuff to the browser. quite often this is just whitespace. If you can attach your Complete file it would be easier to spot, because now it's just guessing.
×
×
  • 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.