Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

Resolved Question

misdirected linking

Mar 7, 2012 9:52PM PST

About a year ago, I wrote a module in PHP for a membership register/login. I was not into MySQL at the time, so the database is a simple text file. Development was done on my website on a remote server using Safari.

I've recently installed MySQL 5.5 and enabled WebServer (MacBook OS 10.6). Having rewritten the registration pages, I proceeded to rewrite the login pages. The first login page is HTML using an input form that passes the info to a PHP page for processing.

The problem is, instead of loading the PHP on my localhost, it redirects to where I had the old module on my website.

I completely rewrote the HTML into a new document, renamed all the pages (including the redirect - action="login.php" changed to action="accept-member.php"). I also installed Firefox but same thing.

Even after changing the "action=" script, the browser still goes looking for "login.php" on my remote website.

This is driving me crazy and has brought my development to a standstill.

To any replies, I'm a SQL newbie.

Discussion is locked

SheepSqueezer has chosen the best answer to their question. View answer

Best Answer

- Collapse -
Just out of curiosity
Mar 7, 2012 10:27PM PST

Just out of curiosity, as I've fallen victim to my own stupidity like this a time or two... You say you renamed all the pages, so are you absolutely sure that you're pointing the browser at the right login page? Maybe you had a bookmark set up and you've been using that out of habit, forgetting that it's linked to the OLD login page.

You can also try clearing the browser cache. It shouldn't be an issue, but there's often times a difference in what should be and what is.

- Collapse -
re: out of curiosity
Mar 8, 2012 12:07AM PST

"...sure that you're pointing the browser at the right login page?"

I first go to /localhost/index.html and verify in the browser URL box. I click the "Login" link on that page which then links to login.html where i enter my user / pass using an HTML FORM, again checking the URL box. On that page I click "Submit" which links to "login.php" (action="login.php"). This is where it goes awry. I'm on a login page but the URL box box shows "www.(my website)/login.php" NOT "/localhost/login.php" and since I've long ago deleted those pages from my website, I get a 404 error.

As I outlined in my post, this happens despite changing the FORM action to action="accept-member.php" (after renaming "login.php" to "accept-member.php").

Curiously, when I replace the pages that use MySQL with the old pages that use a text file, this doesn't happen.

- Collapse -
Answer
Just a passing thought.
Mar 8, 2012 2:24AM PST

Is the browser's cache emptied between changes?

- Collapse -
re:passing thought
Mar 8, 2012 3:36AM PST

First thing I did. I should have made it clearer n my post: I installed and tried Firefox to make sure it wasn't the browser.

- Collapse -
(NT) Even if I installed another browser, I would still clear it.
Mar 8, 2012 8:31AM PST
- Collapse -
re:passing thought
Mar 8, 2012 11:17AM PST

You asked if i cleared the cache. I said "First thing I did"

YES I cleared the cache. I cleared the history. I installed Firefox and did NOT import anything.

I really don't think this has anything to do with the browser; it's some deeper and I'm sure has some connection with MySQL, since it only happens with the page that was rewritten to make a MySQL connection. The old page that does not use MySQL links properly.

- Collapse -
Then back to basics.
Mar 9, 2012 12:34AM PST

Stick with SIMPLE SHORT 8.3 filenames.

- Collapse -
fgohkgk
Mar 9, 2012 3:10AM PST

what could simpler than "login"? The filename is not the problem. Read my previous reply

- Collapse -
Last I read was "accept-member.php"
Mar 9, 2012 3:16AM PST
- Collapse -
Have to say
Mar 9, 2012 3:23AM PST

Have to say this doesn't sound like a MySQL issue at all, but more of a PHP configuration issue. Maybe a configuration error with the web server.

Still, can't hurt to go back and check things like your PHP config file to make sure you didn't disable MySQL functions before, and forgot to turn them back on, or if this is a new web server setup, maybe you forgot to configure the web server.

So I would go and get something like phpMyAdmin and see if that works on your setup. If not, then there's a configuration issue somewhere. If it does work, then it's probably your code that is bad. And just to make absolutely sure, when you say you rewrote the login pages and what not, we're talking a from scratch reimplementation, correct? Not just retrofitting the old pages with new code.

Either way, looking to MySQL for the answer seems like a dead end to me. The problem here seems to be that the process is short circuiting before it even gets to MySQL. So I would go over the httpd.conf and php.ini files with a fine tooth comb, looking for ANYTHING that is amiss.

And one or two last "just to be clear" questions. You did actually install PHP on your MacBook right? You just say you installed MySQL and turned on the web server. Nothing about PHP. And if yes, you're running PHP 5.3.x or 5.4, correct?