Gazdaman Posted January 25, 2007 Share Posted January 25, 2007 Ok, let's try 1 thing at a time.Firstly I wrote a script called login.php which is essentially an html form that submits to itself. It has 2 fields, username and password. Whatever you submit to the script, it evaluates against a mySQL database. If the username and passwords match, it sets a cookie on the machine. Which is fine. It works if I use the script alone.When I put the script into the setting that I want it used it hits problems because by the time the page gets to login.php within the page, it's already past the header section, and therefore login can't set the cookie. Any ideas?The second thing is, I have an array full of directory names.In the format DD-MM-YY-Event-nameIf I do $sort($array) It only sorts it according to the day, it completely ignores the months and years. It also does the same if I remove the hyphens.Thanks a lot, any help is MUCH appreciated.Gaz Quote Link to comment Share on other sites More sharing options...
Gazdaman Posted January 25, 2007 Author Share Posted January 25, 2007 Ok, it seems output buffering would solve my problem, a little ugly though. Because that means placing hard coded text into files whereas my login.php is nicely isolated.http://ca.php.net/manual/en/ref.outcontrol.phpAnyone got another suggestion to that one?My sort question is still active.Gaz Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 25, 2007 Share Posted January 25, 2007 It's sorting them as strings, it can't tell you want it to be chronological.You need to take out the date part, use strtotime() to get a timestamp, then sort that. Quote Link to comment Share on other sites More sharing options...
Gazdaman Posted January 25, 2007 Author Share Posted January 25, 2007 Ok excellent. Thanks for that!Back on the output buffering.This is my home.php code [code]<!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> <title>Motographs.co.uk - Motorsport racing and trackday photography</title><link rel="stylesheet" href="Layout.css" type="text/css" /> </head><body><? ob_start(); ?><!-- Start of StatCounter Code --><script type="text/javascript" language="javascript"><!-- var sc_project=1778734; var sc_invisible=1; var sc_partition=16; var sc_security="41292060"; //--></script><script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img src="http://c17.statcounter.com/counter.php?sc_project=1778734&java=0&security=41292060&invisible=1" alt="free counter statistics" border="0"></a> </noscript><!-- End of StatCounter Code --><div id="container"> <div id="heading"> </div> <div id="content"><div id="menuwrapper"><div id="leftsection"><H3><!-- This includes the menu, it's just stored in another file so it can be referenced into all pages easily --><? include 'menu.php'; ?> <br><br><br><br><br><br></div> <div id="loginsection"><? include 'login.php'; ?></div></div>... BLAH BLAH the rest of the file is irrelevant.[/code]Note the <? ob_start(); ?> just after the <body> tag. It's flushed at the end of the include()'d login.php.Yet it doesn't work. Is it because the starting is entirely seperate from the login script where it's flushed?I can paste the contents of login.php if it'll help. I was so proud to get my script fully working, just a bit of a let down it doesn't work in the context it was made for.Gaz Quote Link to comment Share on other sites More sharing options...
Gazdaman Posted January 25, 2007 Author Share Posted January 25, 2007 Ok solved, I just moved the object buffer command right to the top.Now I've got no problem generating the time stamps from the dir names, but how can I then put the dir names back into the array, sorted in the way the time stamped vars are? Would I just set the time stamps as the keys, then sort them?Gaz 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.