PDA

View Full Version : Using PHP for Landing Pages Part II



TimUkaj
05-20-2007, 03:30 PM
Hey guys. I've made a little script you could use on your landing pages. It's quite simple so it won't be a pain in the ass for the non-programmers to install.

Before we continue I want you to first read this thread: http://forum.clickconsultants.com/showthread.php?p=4547.

So now you know the basic idea with this script. If you don't here's a short summary. It will make the search engines think you have huge website with several pages. And we all know that search engines love websites with many pages. An example. Someone searches for payday loans. He sees your ad in the results and clicks on it. Instead of just entering www.your-landing-page.com he/she will now get redirected to www.your-landing-page.com/payday-loans.php. Got it?

How to install it.

1. Copy the following code into your htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

2. Copy the following code into your index file (main landing page file index.html/php etc). It should be on line #1, before the <html> tag:

<?php

if ($OVKEY = $_GET['OVKEY']) {

$pattern = '/\s/';
$replacement = '-';

$optimized_OVKEY = preg_replace($pattern, $replacement, $OVKEY);

header('location: http://YOUR-LANINDG-PAGE.COM/'.$optimized_OVKEY.'.php');

}
?>

3. Edit where it says "http://YOUR-LANINDG-PAGE.COM" to whatever your domain is. It's even possible for you to change the extension to html. Just change the "php" to "html" in the header.

4. You're set to go :). Try it out by typing "www.your-landing-page.com?OVKEY=Some Keyword" in your browser.

Feel free to ask me anything :). I will be adding new features along the road. Hope you enjoy it.

Peace!

KGL
05-20-2007, 05:55 PM
awesome. just awesome.

alan8888
06-15-2007, 12:52 PM
I try to work on this..but it seem is not working to me....I don't have a htaccess file in my hosting server

I save


<?php
$path = array(
'true' => 'http://x.azjmp.com/xxxxx',
'singlenet' => 'http://x.azjmp.com/xxxxx',
'sprint' => 'http://x.azjmp.com/xxxxx',
'nextel' => 'http://x.azjmp.com/xxxxx',
'other' => 'http://x.azjmp.com/xxxxx'
);

$id = htmlspecialchars($_GET['id']);
$ovkey = htmlspecialchars($_GET['ovkey']);
$filename = './logs/' . $id . '.log';

$content = 'JUMP, ' . $_SERVER["REMOTE_ADDR"] . ', ' . date("h:iA") . ', ' . date("Y-m-d") . ', ' . $ovkey;

$handle = fopen($filename, 'a');
fwrite($handle, "$content\r\n");
fclose($handle);

if (array_key_exists($_GET['id'],$path))
header('Location:'.$path[$_GET['id']].'?sub='.$key.'-'.$ovkey);

?>


in a file named link.php and upload to server


I also ADD


<?php

if ($OVKEY = $_GET['OVKEY']) {

$pattern = '/\s/';
$replacement = '-';

$optimized_OVKEY = preg_replace($pattern, $replacement, $OVKEY);

header('location: http://www.ybasic.net/'.$optimized_OVKEY.'.php');

}
?>

to the top of my html in the index page.

I also change all the link to

link.php?id=true&ovkey=<?php echo $ovkey; ?>

When I click the link it works... it redirect the the page....

I type

http://www.mydomain.net/?OVKEY=marriage

there is nth appear......where is the log file ???
where can I view there
Do i have to create the log file by myself ?
Can we choose the log file name ?

I wish someone can help em out thank you

syns0r
06-15-2007, 01:11 PM
you have to make a folder called 'logs' and change perms to 777 i believe
then it will automatically create log files for each link on your landing page and add the ovkey to the log file corresponding to the landing page link

TimUkaj
06-15-2007, 03:34 PM
@ alan 888: Just create a file called .htaccess and then upload it to your server.

Pm me on monday and I'll help you with setting up the PHP code.

alan8888
06-15-2007, 04:00 PM
JUMP, 69.105.119.225, 03:00PM, 2007-06-15, &lt;?php echo $ovkey; ?&gt;
JUMP, 69.105.119.225, 03:01PM, 2007-06-15, &lt;?php echo $ovkey; ?&gt;
JUMP, 69.105.119.225, 03:01PM, 2007-06-15, &lt;?php echo $ovkey; ?&gt;
JUMP, 69.105.119.225, 03:01PM, 2007-06-15, &lt;?php echo $ovkey; ?&gt;
It only show the time and day....what's this means ?

artarmon42
06-15-2007, 04:18 PM
OVKEY is case sensitive (as are all PHP variables).
Think about whether you really are trying to access the upper or lower case variable.

Look back through the PHP thread, and make sure you copied the code EXACTLY (with the proper case being used).

alan8888
06-15-2007, 06:35 PM
lol...i don't know any programming..i just copy everything :-(

alan8888
06-21-2007, 11:01 PM
Someone Please Help me..i uploaded my index and link.....

someone please help me

pure_yz
06-21-2007, 11:29 PM
What up dudes. I've been greatly helped by all the php provided on this site (contributed by artarmon42 and TimuKaj).

My only question now is whether or not combining all the functions together would work - 1. the ovkey in the title & meta tags, 2. getting the ovkey and transferring it to the link.php, and 3. the latest script provided in this post.

I've been able to implement 1 & 2, also adding in 3 (which works). The trouble is that when 3 works, 2 no longer does. Would someone please tell me how to get them all to work together?

alan8888
06-21-2007, 11:49 PM
I got your msn TimuKaj....but it seems u never online :-(

TimUkaj
06-22-2007, 02:26 AM
I am online quite often but most of the time I'm busy. Throw me a PM even if my status isn't online. I will respond :).

alan8888
06-22-2007, 10:25 AM
I uploaded my file in here..can u help me to check it...thx

syns0r
06-22-2007, 01:42 PM
I don't know if this is your problem but in your links.php you already have the subid filled in. you should leave the link as the regular azjmp link and the links.php file adds the subid=ovkey to the url automatically

like this:


'true' => 'http://x.azjmp.com/0fFYl',


in your index.php remove amp; from all of your links



<a href="link.php?id=singles&amp;ovkey=<?php echo $ovkey; ?>"


to


<a href="link.php?id=singles&ovkey=<?php echo $ovkey; ?>"

slbusiness
08-15-2007, 08:38 AM
Im a bit of a newbie. Can someone explain how to access the htaccess file (or if i have to make it)?

Thanks

mystickcal
08-15-2007, 08:41 AM
Im a bit of a newbie. Can someone explain how to access the htaccess file (or if i have to make it)?

Thanks

If ther eisn't a file in your ftp called .htaccess then you will need to create it. Simply open up notepad and type in whatever you want/need your .htaccess to say then simply save it as .htaccess

Minisuit
04-03-2012, 05:16 PM
Thanks for sharing.