GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Need some php Help (https://gfy.com/showthread.php?t=1369932)

mopek1 11-02-2023 03:01 AM

Need some php Help
 
After switching my site to https one of my php scripts stopped working.

My host's Apache error logs confirmed it was due to an SSL issue.

The script allows surfers to post some text and has a captcha before hitting submit. The captcha image is where I believe the problem lies:

______________________________
<? $code = makeCode(); ?>
<img src="include/code.php?code=<?=$code?>">
______________________________

The script calls on an image somewhere in the include folder, in a file called code.php [header("Content-type: image/png");].

I believe that somehow this image is still being served over http, even though I've checked every link in that script and on those pages with a fine toothed comb.

Of anyone has any knowledge of php or can point me to someone or some business that can help I;d appreciate it.

Thanks

redwhiteandblue 11-02-2023 03:55 AM

What's in code.php?

Klen 11-02-2023 03:59 AM

Sounds like issue where you including http content on https website, make sure you check all your links.

mopek1 11-02-2023 04:39 AM

Quote:

Originally Posted by redwhiteandblue (Post 23194418)
What's in code.php?

Below is the whole code in that code.php file:


<?php
include("functions.inc.php");

$code = makeStr($_GET['code']);

header("Content-type: image/png");
$im = @imagecreate(75, 30)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 255, 255, 255);
imagestring($im, 7, 10, 7, $code, $text_color);
imagepng($im);
imagedestroy($im);
?>

mopek1 11-02-2023 04:40 AM

Quote:

Originally Posted by Klen (Post 23194419)
Sounds like issue where you including http content on https website, make sure you check all your links.

Yeah, I did that for 4 hours straight yesterday. Checking every line. Almost went blind :upsidedow

NakedWomenTime 11-02-2023 03:50 PM

Are you able to modify the code to capture the error php is giving?

I would agree it's likely to be related to the change to https, but can't be of much more help ... there will probably be a file path somewhere that is http and should now be https. See also:

https://www.php.net/manual/en/function.imagecreate.php

Stackoverflow is good for php help.

2MuchMark 11-02-2023 04:13 PM

It is impossible to help without seeing some of the error logs, but you can at least check this: Check for mixed content. If your PHP script is trying to load resources (like images, scripts, or styles) over HTTP your browser will block it. If you are using an AutoSSL certificate, try generating a new one. Also check to see if the version of PHP installed on your server is not some ancient version. Check to see if the GD library is enabled.

You can also try removing the @ operator before imagecreate() to see if there are any errors being suppressed.

fris 11-04-2023 09:18 AM

https shouldnt have any effect on that

mopek1 11-05-2023 02:06 PM

Thanks for everyone's help. I looked through the script this whole weekend and enjoyed every bit of my weekend being spent looking at code trying to figure it out, instead of relaxing :)

The solution made no sense but it worked.

I went though the script with a fine toothed comb. I copied files from a folder where I kept the original script (15 years ago) and replaced the ones on the domain, doing so one file at at a time, testing, and then continuing on.

The file that finally did it was the functions.php file. It doesn't make sense because I never changed that file during the https switch, or I thought anyway.

Perhaps I opened that file just to look through and hit "break" accidentally, and so with a break line the code wasn't working anymore.

I still don't know what actually happened.* The newer (original) file looks identical to the one I replaced it with.

In any case thanks for all your help.

just a punk 11-06-2023 01:45 AM

Quote:

Originally Posted by mopek1 (Post 23194405)
After switching my site to https one of my php scripts stopped working.

My host's Apache error logs confirmed it was due to an SSL issue.

The script allows surfers to post some text and has a captcha before hitting submit. The captcha image is where I believe the problem lies:

Just a tip to literally save you a TON of time: in all situations like that, just ask ChatGPT-4, and yes, you can even show it your pieces of code :2 cents:

mopek1 11-06-2023 04:21 AM

Quote:

Originally Posted by just a punk (Post 23195807)
Just a tip to literally save you a TON of time: in all situations like that, just ask ChatGPT-4, and yes, you can even show it your pieces of code :2 cents:

Never thought of that. Thanks for the top :thumbsup


All times are GMT -7. The time now is 11:43 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc