1<?php
2//if you want to show two (different) login pages for two (different) links,
3//you can first of all think of two urls for two different login pages.
4//here, i have two links => /login-old and /login-new for which i want different forms,
5//now as any of these url hits the browser, i will check for url paramenter
6
7 $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
8
9 if (strpos($url,'login-new') !== false) {
10 // echo 'to New Login page';
11 $cookie_name = "login_page";
12 $cookie_value = "new";
13 setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); //will not set immediately, but useful later for logout
14 header("Location: ".site_url('login')); //this will be your default login page url
15 exit;
16
17 } else if(strpos($url,'login-old') !== false) {
18 // echo 'to Old Login page';
19 $cookie_name = "login_page";
20 $cookie_value = "old";
21 setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); //will not set immediately, but useful later for logout
22 header("Location: ".site_url('login'));
23 exit;
24 }
25
26//now that the cookie is set, i know which form to show to user,
27//now, as the user gets redirected to default login page, go to it's template file
28//and check for the default login form, where, check,
29
30$login_page = '';
31if (isset($_COOKIE['login_page'])) {
32 $login_page = $_COOKIE['login_page'];
33}
34
35if ($login_page == 'new') { ?>
36 <style>
37 #your new form styling here...
38 </style>
39<?php } else if ($login_page == 'old'){ ?>
40 <style>
41 #your old form styling here...
42 </style>
43<?php }
44
45if ($login_page == 'new') { ?>
46 <form id="new_form" action="" method="post"> </form>
47<?php } else if ($login_page == 'old'){ ?>
48 <form id="old_form" action="" method="post"> </form>
49<?php }
50//here, check the default login form action attr to put above in our custom forms
51