Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Insert Server Behavior & Navigation with pages stored in SSL folder

New Here ,
Dec 31, 2010 Dec 31, 2010

I tested all navigations, database updates, and connections to my remote server without SSL and all is working perfectly!

Now, I need to move the private php pages into an SSL folder.

I created the ssl folder on my remote server and made the same changes on my local server...all is in sync.

I have an insert server behavior on my 1st php file stored in the ssl folder.

The server behavior asks where to go after the insert.  I've entered several things here, starting with the basic navigation to my file within the ssl folder using the browse button on the insert server behavior pop-up screen to entering the full blown secure URL that is generated by my Web Hosting company (included below).  Every time I submit my 1st php file on the web, I receive a Sorry.Gone erorr from my Web Hosting site and my data doesn't get updated into my database table.

I have validated that the URL I enter after $insertGoTo pulls up the correct page when I plug it into the web url address field.  My php form is definately on my remote server site without issues.

As mentioned inititally, I tested all of my .php forms and successfully updated my database and navigated to the correct .php form after successful insert when not using the ssl folder.  And I did check/change all of my links where applicable to ensure that they are pointing to files/images in the new ssl folder.

Something has to be happening between the database insert (which fails) and the navigation to the next .php page inside the ssl folder.

Since I give all of this instruction to Dreamweaver through the insert server behavior, I'm hoping Dreamweaver experts can point me in the right direction.

Here is a scrubbed version of the insert code in my 1st php page.  I just don't know what I have to enter as the URL for the $insertGoTo command in order for this to work properly.

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "Form1")) {
  $insertSQL = sprintf("INSERT INTO Table1 (Field1, Field2) VALUES (%s, %s)",
                       GetSQLValueString($_POST['Field1'], "text"),
                       GetSQLValueString($_POST['Field2'], "text"));

  mysql_select_db($database_connSite, $connSite);
  $Result1 = mysql_query($insertSQL, $connSite) or die(mysql_error());

  $insertGoTo = "http://www.domain.com/ssl/Form2.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}

My web hosting company stated that I would need to enter the entire URL, but that didn't work either.  Here is an example of the entire URL with secure prefix:  https://p8.secure.hostingprod.com/@www.domain.com/ssl/Form2.php

Thank you!!

TOPICS
Server side applications
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 01, 2011 Jan 01, 2011

swood30 wrote:

  $insertGoTo = "http://www.domain.com/ssl/Form2.php";

My web hosting company stated that I would need to enter the entire URL, but that didn't work either.  Here is an example of the entire URL with secure prefix:  https://p8.secure.hostingprod.com/@www.domain.com/ssl/Form2.php

I haven't used SSL, so I'm only guessing here, but when accessing a secure page externally, the prefix you show wouldn't normally be used. All that's different is the use of https instead of http. I would have thought that the value of $insertGoTo should be https://www.domain.com/ssl/Form2.php.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 01, 2011 Jan 01, 2011

Thanks for response David.  Unfortunately, that didn't work. Here is some more info, questions are in bold.

Starting URL:
http://www.domain.com/ssl/Form1.php

Yahoo translates to Secure URL:
https://p8.secure.hostingprod.com/@www.domain.com/ssl/Form1.php


From the web...I enter data into form1 and Submit

The database insert is failing...so my 1st question is...
Would there be a problem with accessing the database from the secure URL?

Ending URL:
https://p8.secure.hostingprod.com/ssl/Form1.php?

Yahoo Error...Sorry Gone message

If I view the source code on the page from the web, it says:  <form action="/ssl/Form1.php?"
The @www.domain.com is being dropped from the form action path causing the error.
How do I correct the form action path?

From Dreamweaver Design View my form action is:
<?php echo $editFormAction; ?>

From the Insert server behavior pop-up where it says, "After inserting go to:"  I have entered many URLs but always the error.

Examples:
/@www.domaiin.com/ssl/Form2.php

https://@www.domaiin.com/ssl/Form2.php

https://p8.secure.hostingprod.com/@www.domain.com/ssl/Form2.php

@www.domaiin.com/ssl/Form2.php

www.domaiin.com/ssl/Form2.php

ETC...


From Dreamweaver code view:
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);


After Submit and database update, the Ending URL should be:
https://p8.secure.hostingprod.com/@www.domain.com/ssl/Form2.php

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 01, 2011 Jan 01, 2011

Ok, just spoke to my Web Hosting company.

They said that I should NOT have any issues updating my database from the secure URL.

They said that I have to change my form action path to:

<form action="/@domain.com/ssl/Form1.php?"id="form1" name="form1" method="POST">

So...here is the initial CODE for my form:  <form id="form1" name="form1" method="POST">

From the Design view, I create the Insert Server Behavior.  I enter the following in the After insert Go To field: /@domain.com/ssl/form2.php?

So...now my CODE says:  <form action="<?php echo $editFormAction; ?>" method="POST" name="form1" id="form1">

I replace "<?php echo $editFormAction; ?>"  WITH "/@domain.com/ssl/form1.php?"

I save the file.

NOTE:  In Design View, my insert record behavior has a red exclamation mark to indicate a potential error.

I put the file.

I test the file...

My database was updated successfully AND I'm being navigated to my form2 correctly!!

Now my only worry is if the warning in dreamweaver on my insert behavior will bite me later...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 02, 2011 Jan 02, 2011

swood30 wrote:

Now my only worry is if the warning in dreamweaver on my insert behavior will bite me later...

The red exclamation mark means that you have edited the server behavior, and Dreamweaver may no longer recognize it. This is perfectly normal. You should not rely entirely on Dreamweaver to generate PHP code for you. It's often necessary to edit the code. Once you do so, Dreamweaver says you're on your own.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 02, 2011 Jan 02, 2011
LATEST

Good to know!!  Thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines