Gossamer Forum
Home : Products : Gossamer Links : PHP Front End :

Static PHP pages problem ..

Quote Reply
Static PHP pages problem ..
Hi,

I'm trying to use PHP pages (such as index.php - like the HTML version) that are built using nph-build.cgi with the .php extension, however I'm unable to figure out how to pass a users session through to the "static" php page once they have logged in using the page.php?do=user function.

Once the user has logged in, and goes onto a *.php page that was built from the admin panel, they are no longer logged in. Being that PHP is for serving dynamic content, there should be a solution.. but I don't know what it is.

Any suggestions are most welcome!

Kind regards,
Mandi
Quote Reply
Re: [Evoken] Static PHP pages problem .. In reply to
Currently, you can't use the PHP front end with statically built pages.

Adrian
Quote Reply
Re: [brewt] Static PHP pages problem .. In reply to
Thanks for your quick response Adrian, not exactly the answer I wanted to hear - but that's OK, I'll just have to use the full-on dynamic mode instead. Smile

Regards,
Mandi
Quote Reply
Re: [Evoken] Static PHP pages problem .. In reply to
A while back, I was playing around with getting it to work with static mode, but it required me to do a d=1 (like page.cgi). Back then I hadn't implemented anything to handle it. I added support for URL sessions about a month ago (not in 2.1), so I might be able to add support for the d=1 option. If I have some spare time (I'm currently working on finishing up Gossamer Mail 2.1, so I'm quite busy), I'll see if I can get the static mode stuff into the PHP front end. Maybe it'll make it into 2.2 (or whatever the next release is going to be). No promises though Unsure

Adrian
Quote Reply
Re: [brewt] Static PHP pages problem .. In reply to
The dynamic mode is sufficient for the time being, don't rush yourself!
Quote Reply
On to another problem :o) In reply to
I'm slowly working my way through getting my Links SQL setup and just came across a problem with my search. There are NO results, even if there is 10 pages of results, each page is blank with a dot point where the first link on the page should be. Any idea of what is wrong?
Quote Reply
Re: [Evoken] On to another problem :o) In reply to
Yeah, there's a few bugs with the search with certain settings. I've attached an updated Search.inc.php. Just replace the one you already have in admin/Links/PHP.

Adrian
Quote Reply
Re: [brewt] On to another problem :o) In reply to
Wonderful, that fixed it! Thanks a bunch.
Quote Reply
I have another quick question .. In reply to
I hope I'm not bothering you too much, but I've got another problem I don't know how to fix. I've just made an "expiring" page by copying and modifying the "new" functions in page.inc.php and have successfully managed to create the page I want, but I need to limit the number of results returned to just the last 14 days - currently it is displaying an expiring page for every single date in the database!

How would I go about setting it to just 14 days?
http://www.cashnetsweeps.com/pages/page.php?do=page&action=expiring

Last edited by:

Evoken: May 24, 2002, 3:01 AM
Quote Reply
Re: [Evoken] I have another quick question .. In reply to
Is your SQL query correct? Maybe paste some of the code you've created?

Adrian
Quote Reply
Re: [brewt] I have another quick question .. In reply to
*grin* I wouldn't have a clue if it's correct! I can't program for the life of me, but I'm trying to learn PHP (unsuccessfully, I just don't have a brain for foreign languages).

Let me see, here are a few of the SQL queries I've got:

$query = "SELECT * FROM ${PREFIX}Links WHERE isValidated = 'Yes' AND MyExpires = '$date'";
if ($CFG['build_sort_order_expiring']) {
$query .= ' ORDER BY ' . $CFG['build_sort_order_expiring'];

$sth2 = $DB->query("SELECT COUNT(*) FROM ${PREFIX}Links WHERE isValidated = 'Yes' AND MyExpires = '$date'");

$sth = $DB->query("SELECT MyExpires, COUNT(*) FROM ${PREFIX}Links WHERE isValidated = 'Yes' GROUP BY MyExpires ORDER BY MyExpires ASC");

Any of these useful?

I've just edited the msg to include a text file with the entire function in it.

Last edited by:

Evoken: May 24, 2002, 3:30 AM
Quote Reply
Re: [Evoken] I have another quick question .. In reply to
You probably want to make the expire column a date type. Assuming you're using MySQL as your database, you'll be able to use SQL like:
Code:
SELECT * FROM ${PREFIX}Links WHERE isValidated = 'Yes' AND MyExpires < DATE_ADD(NOW(), INTERVAL 14 DAY) AND MyExpires >= NOW()
So you're looking for any links which the expiry is before than the current date + 14 days, but also haven't expired yet.

Adrian
Quote Reply
Re: [brewt] I have another quick question .. In reply to
All righty, I'll give that a go. The MyExpires column is already in SQL date format, so the syntax you gave should probably work! Thanks for your help, I'll let you know if I have any difficulties. Crazy
Quote Reply
Re: [brewt] I have another quick question .. In reply to
Eek, I can't seem to get it to work! I've replaced one and/or more of the SQL statements in the script and it still shows the same page (with all of the expiring dates) as it was before.

I haven't got a clue as to what it is I'm doing wrong.
Quote Reply
Re: [Evoken] I have another quick question .. In reply to
Nevermind, I sorted it out.. Thanks for your help with the SQL statement Adrian!
Quote Reply
Re: [brewt] I have another quick question .. In reply to
Sorry to be a pain, but after successfully getting the correct number of links to be displayed on the "soon to expire" page, I've found another problem I can't fix.

If my expiring query is: ?do=page&action=expiring&date=2002-06-06 and 3 results are returned, a span menu is built at the bottom of the page (when it shouldn't be) looking like this:

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ... [>>]

I've been looking at the script code for two hours and can't figure it out - but that's because most of it doesn't make any sense to me.

I've attached the latest version of the script that is producing the problem.
Quote Reply
Re: [Evoken] I have another quick question .. In reply to
I believe the line:
Code:
$sth2 = $DB->query("SELECT * FROM ${PREFIX}Links WHERE isValidated = 'Yes' AND MyExpires = '$date'");
$expiring_total = $sth2->fetchrow_one();
should be:
Code:
$sth2 = $DB->query("SELECT COUNT(*) FROM ${PREFIX}Links WHERE isValidated = 'Yes' AND MyExpires = '$date'");
$expiring_total = $sth2->fetchrow_one();

I think this line needs a little more work:
Code:
$query = "SELECT * FROM ${PREFIX}Links WHERE isValidated = 'Yes'";
It should probably be like the DATE_ADD() one I told you about previously (It's been quite a while since I worked on this project, so I can't remember what exactly each condition is supposed to do Smile).

Adrian
Quote Reply
Re: [brewt] I have another quick question .. In reply to
Thankyou Adrian,

Just adding the COUNT(*) function to the line you suggested seems to have fixed the problem!

Mandi