Jump to content

2 Problems, sort() function and cookie placement


Gazdaman

Recommended Posts

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-name

If 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
Link to comment
Share on other sites

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.php

Anyone got another suggestion to that one?

My sort question is still active.

Gaz
Link to comment
Share on other sites

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&amp;java=0&amp;security=41292060&amp;invisible=1" alt="free counter statistics" border="0"></a> </noscript>
<!-- End of StatCounter Code -->
<div id="container"> &nbsp;
  <div id="heading">&nbsp;&nbsp;</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



Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.