Announcement

Collapse
No announcement yet.

Problem with relative link and connecting to a SQL database

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Problem with relative link and connecting to a SQL database

    Hi - I have a form on my site that needs to connect to database. It does this by the standard procedure of using a .php script above the webspace.

    My problem is that on my pc Actinic is processing this as a relative link so I get an error message telling me that the file does not exist on my PC. The code I want to use is:

    <?php require_once ('../../mysql_connect.php'); ?>
    Is there a way to stop it processing this as a relative link?
    Regards
    David

    #2
    Does full URL fail too? Add the file to 'additional files' and reference it relatively or full url to where you want it otherwise.

    Comment


      #3
      Hi Lee - I'm not sure how to reference it as a full URL when it is not in the webspace. i.e. it is in the same folder as the htdocs folder.
      Regards
      David

      Comment


        #4
        Move it to a level where you know how to get to it, i usually have a sub folder on the root called 'scripts' and have it in there. I would then access it by http://www.domain.co.uk/scripts/myfile.php etc.

        FTP into your webspace and move it to a an accessible level if you are struggling to reference it. I presume there is no security issue with the file. Or you can just add it to additionals in actinic and it will sit in your acatalog folder then.

        Comment


          #5
          There is a security issue with the file. It contains my SQL database access information - username, password etc.

          That is why it is not in the webspace.
          Regards
          David

          Comment


            #6
            give it a random name, a 16 digit hex name, and then reference it in your root.

            Comment


              #7
              i was about to help you more, until I noticed this disasterous attempt to fool google:

              HTML Code:
              <div style="display:none">
              	<h1>Web page design, web site design, development & consultancy services in Birmingham UK</h1>
              	<h2>Affordable ecommerce solutions & online shop development</h2>
              </div>
              you complete fruit.

              *rolls eyes*

              Comment


                #8
                You did read the company name Gabe?

                Comment


                  #9
                  lolz. indeed. i did now.

                  Comment


                    #10
                    For anybody who has this problem and is searching the forum.

                    This works fine if you have it as a template, or as part of a template, in the actinic library.

                    My problem is that it was in the code of another script that was referenced from within the text field of a fragment.

                    i.e. this code:

                    <?php require_once ('../../mysql_connect.php'); ?>
                    was part of the code of a file called mailing list.php. I added mailing_list.php to the text field of a fragment so:

                    !!<
                    <actinic:block php="true">
                    include('mailing_list.php');
                    </actinic:block>
                    >!!
                    After a bit of testing it appears that any code within an Actinic PHP block is processed on the local machine and not on the server even if you give it opening <?php and closing ?> tags.

                    I also tried using the following in the text field of a fragment:

                    !!<
                    <?php
                    include('mailing_list.php');
                    ?>
                    >!!
                    but this did not work - it got translated to this in the code in the browser:

                    <php _moz-userdefined="" ?="" );="" seasalt_mysql_connect.php="" ..="" (="" require_once="">
                    Regards
                    David

                    Comment

                    Working...
                    X