The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 22, 2019, 05:49:28 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Some tips for url link drop script  (Read 1412 times)
nattsurfaren
Journeyman
***
Offline Offline

Posts: 64


View Profile
« on: November 10, 2008, 03:30:05 PM »

Two important things if you are building link drop scripts in php.
Here is one important line:
Code:
$action = html_entity_decode(getAttribute("action", $item));
The action attribute in a form could be encoded. urldecode doesn't work. You must use html_entity_decode.

Another tip:

Here is some code I use when handling action form.
Code:
//If there is no / in the beginning then the full path is required.
                    if ($action[0] != "/")
                    {
                        $action = "/" . $action;
                        $postpath=str_replace("\\","/",$postpath);
                        $posturl = $postpath . $action;
                        $posturl=str_replace("//","/",$posturl);
                    }
                    else
                    {
                    //There is a / in the beginning and now the root path is required.
                    $posturl = $domain . $action;
                    }

So the first / is very important. The first slash means root path.
Logged
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!