Need some php Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mopek1
    Confirmed User
    • Jun 2004
    • 3192

    #1

    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
    Bollocks
    • Jun 2007
    • 2793

    #2
    What's in code.php?
    Interserver unmanaged AMD Ryzen servers from $73.00

    Comment

    • Klen
      • Aug 2006
      • 32235

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

      Comment

      • mopek1
        Confirmed User
        • Jun 2004
        • 3192

        #4
        Originally posted by redwhiteandblue
        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);
        ?>

        Comment

        • mopek1
          Confirmed User
          • Jun 2004
          • 3192

          #5
          Originally posted by Klen
          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

          Comment

          • NakedWomenTime
            Confirmed User
            • Oct 2015
            • 564

            #6
            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.
            bbNaked | Naked Women Time | Naked Women Time Blog

            Comment

            • 2MuchMark
              Mark of 2Much.net
              • Aug 2004
              • 50973

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

              Comment

              • fris
                Too lazy to set a custom title
                • Aug 2002
                • 55679

                #8
                https shouldnt have any effect on that
                Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                Comment

                • mopek1
                  Confirmed User
                  • Jun 2004
                  • 3192

                  #9
                  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.

                  Comment

                  • just a punk
                    So fuckin' bored
                    • Jun 2003
                    • 32393

                    #10
                    Originally posted by mopek1
                    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
                    Obey the Cowgod

                    Comment

                    • mopek1
                      Confirmed User
                      • Jun 2004
                      • 3192

                      #11
                      Originally posted by just a punk
                      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
                      Never thought of that. Thanks for the top

                      Comment

                      Working...