Errors Galore on this Aging Site

As you can see errors here,

http://pollinationproject.org/yearatglance.php

and on almost every page in the “Programs” menu on this page, http://pollinationproject.org/home.php

I am not extremely experienced in PHP, and I hope this is a simple fix.

Well, does not look like a lot of errors. But, we can not fix your code without seeing some of it.

PHP is SERVER-SIDE only. Therefore, we can not help you without posting some of your code.
Do NOT post any userid’s or password’s for your site or database.

As I saw on your two pages you showed us, there is line numbers shown for the errors.
Please show us a few lines before and after those line numbers and we can help.
As always, please place those sections of code inside of the PHP tags by using the PHP button.

Let’s see some code and we can help.

PS: the first error is most likely that you are using an INCLUDED file that has headers inside it.
OR, you had PHP code that you printed before the page’s header which is the same as a header…
(But, need to see some code on that page first…)

Here’s the file it’s referencing…

[php]

Pollination Project <?php $datey = date("d/m/Y") ?> <?php list($month, $day, $year) = split('[/.-]', $datey);?> <?php $monthtrimmed = ltrim($month, "0"); ?> <?php $daytrimmed = ltrim($day, "0"); ?> <?php $jd = GregorianToJD($daytrimmed, $monthtrimmed, $year); ?>

 

<? header('Location: yearatglance2.php?d='.$jd); ?> " /> [/php]

Well, that code makes no sense at all…
First, it opens and closes PHP for no reason.
It closes a label without opening it.
It closes the body before it opens it.
And, it has a form outside of the HTML tags.

So, none of that will work at all… Not sure what is going on here, but, that code would never work.
It was never a working “Aging Site” !

Here is it fixed up, but not sure if that is what you want…
[php]

Pollination Project <?php $datey = date("d/m/Y"); list($month, $day, $year) = split('[/.-]', $datey); $monthtrimmed = ltrim($month, "0"); $daytrimmed = ltrim($day, "0"); $jd = GregorianToJD($daytrimmed, $monthtrimmed, $year); header('Location: yearatglance2.php?d='.$jd); ?> " />

[/php]
So, this is kinda fixed up. BUT, the form will never be executed so it is just a waste.
All your page does is load some strange code to grab the date and convert it to JD format
and then pass it to another page? Silly code as the other page could do this code, too.

Not really sure what you are attempting to do, but let us know…

Hmm. I’d like to know what’s going on to. It was made by another developer a few years ago for a client of mine now. The pages are very strange, and I am very novice at PHP, and this still made no sense to me.

When I use that edited page (thanks very much!), I get a new error.

Warning: Cannot modify header information - headers already sent by (output started at /home/zjnvnpno/public_html/pollinationproject.org/yearatglance.php:11) in /home/zjnvnpno/public_html/pollinationproject.org/yearatglance.php on line 17

There are also other pages here, with “2” at the end of them, such as “yearataglance2.php” are these relevant at all?


Well, yes, but it appears that a lot of the code is missing in the first page you posted.

Since we do not know how the entire site fits together, everything is important and could be
causing errors. But, to me, it appears that many parts are missing.

Did they give you a copy of the site or did you copy it from the current live site?

Not really sure where to send you with all this. The code you first posted pulls in date data
and then redirects to the second file. So, that is just some sort of call to the second file with
the date pulled first. That really makes no sense as the second file can just pull the date data
itself. Makes no sense!

So, the second file is the real guts of the page. You are getting errors because the correct data
is not being sent to it. Well, that is a guess without having a copy of it all.

If you want to send me the files, you can do it inside a PM (Private Message) if it contains items you
do not want to post here in the open message.

One thing you should check is to see if your original file that you posted here matches your backup copy.
Perhaps your version was damaged? Not sure how I can help?

Okay thanks. I’ll compare it to the backup I have and see if this is broken somehow.

THANKS FOR THE HELP. I’ll check back in or message you to see how it goes. :slight_smile:

Just as a side note, mysql_* functions are deprecated and will most likely be removed in the next major release of PHP.

I suggest checking out PDO or MySQL. I can’t post links here yet (under 10 posts), but do a quick search and you’ll find them in the docs. Very easy to get a grasp of.

They will most likely not be removed for at least ten more years.
Doubt this is important when his site is down.

After it is up and running again, you can teach him how to update to PDO.

BUT, also, if you read any of this post, you would not see any database functions used.
So, you are way off topic. ! ! !

Regardless of when it will be removed, it’s not object oriented and it’s still insecure. It doesn’t allow parameterised querying which means, unless you escape every single query you execute, you’re prone to SQL injection.

Actually, the errors that the website is throwing are MySQL errors.

The point was, open your own post on the subject of upgrading to PDO if you wish.
This user is a total beginner and you are not helping going off topic to mix him up further.

Most likely he does not even know what “SQL injection” is. You must have seen no validations
were used in his code.

Sponsor our Newsletter | Privacy Policy | Terms of Service