1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Simple PHP function. First one to give the correct advice will get the $5 via paypal

Discussion in 'Programming' started by sowers, May 26, 2012.

  1. #1
    Hello,

    First one to give the correct advice will get the $5 via paypal

    The login system for my site works like this:

    Members of group_id 2, are redirected to a specific/page/.

    All other members are redirected to the account/home/



    if ($SESSION->auth) {
    	if ( isset($_SESSION['REQUEST_URI']) && $_SESSION['REQUEST_URI'] ) {
    		$request_uri = $_SESSION['REQUEST_URI'];
    		$_SESSION['REQUEST_URI'] = '';
    		if ( isset($_POST['islogin'])  &&  $_POST['islogin'] && (strcmp($request_uri, VIR_PATH) == 0 || strcmp($request_uri.'/', VIR_PATH) == 0 || strpos($request_uri, 'account_login') !== false || strpos($request_uri, 'account/login') !== false) ) {
    			$request_uri = VIR_PATH . ($PREFS->conf['fancy_urls'] ? "account/home/" : "index.php?m=account_home");
    		}
    		if ($SESSION->conf['group_id'] == 2)
    		{
    			$request_uri = VIR_PATH . ($PREFS->conf['fancy_urls'] ? "specific/page/" : "index.php?m=specific_page");	
    		}
    		redirect( $request_uri );
    	}
    	elseif ( isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] ) {
    		$request_uri = $_SERVER['HTTP_REFERER'];
    		if ( isset($_POST['islogin'])  &&  $_POST['islogin'] && (strcmp($request_uri, VIR_PATH) == 0 || strcmp($request_uri.'/', VIR_PATH) == 0 || strpos($request_uri, 'account_login') !== false || strpos($request_uri, 'account/login') !== false) ) {
    			$request_uri = VIR_PATH . ($PREFS->conf['fancy_urls'] ? "account/home/" : "index.php?m=account_home");
    		}
    		if ($SESSION->conf['group_id'] == 2)
    		{
    			$request_uri = VIR_PATH . ($PREFS->conf['fancy_urls'] ? "specific/page/" : "index.php?m=specific_page");		
    		}
    		redirect( $request_uri );
    	}
    	else {
    		if ($SESSION->conf['group_id'] == 2)
    		{
    			$request_uri = VIR_PATH . ($PREFS->conf['fancy_urls'] ? "specific/page" : "index.php?m=specific_page");		
    		}
    		else
    			redirect( VIR_PATH . ($PREFS->conf['fancy_urls'] ? "account/home/" : "index.php?m=account_home") );
    	}
    }
    
    PHP:

    I want to work like this:

    Members of group_id 2, are redirected to a specific/page.
    Members of group_id 6 are redirected to a specific/page2.
    All other members are redirected to the account/home/

    First one to give the correct advice will get the $5 via paypal
     
    sowers, May 26, 2012 IP
  2. Einheijar

    Einheijar Well-Known Member

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    3
    Trophy Points:
    165
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    
    <?php
    
    if ($SESSION->auth) {
        if (isset($_SESSION['REQUEST_URI']) && $_SESSION['REQUEST_URI']) {
            $request_uri = $_SESSION['REQUEST_URI'];
            $_SESSION['REQUEST_URI'] = '';
            if (isset($_POST['islogin']) && $_POST['islogin'] && (strcmp($request_uri, VIR_PATH) == 0 || strcmp($request_uri . '/', VIR_PATH) == 0 || strpos($request_uri, 'account_login') !== false || strpos($request_uri, 'account/login') !== false)) {
                $request_uri = VIR_PATH . ($PREFS->conf['fancy_urls'] ? "account/home/" : "index.php?m=account_home");
            }
            if ($SESSION->conf['group_id'] == 2) {
                $request_uri = VIR_PATH . ($PREFS->conf['fancy_urls'] ? "specific/page/" : "index.php?m=specific_page");
            }
            if ($SESSION->conf['group_id'] == 6) {
                $request_uri = VIR_PATH . ($PREFS->conf['fancy_urls'] ? "specific/page2/" : "index.php?m=specific_page2");
            }
            redirect($request_uri);
        } elseif (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) {
            $request_uri = $_SERVER['HTTP_REFERER'];
            if (isset($_POST['islogin']) && $_POST['islogin'] && (strcmp($request_uri, VIR_PATH) == 0 || strcmp($request_uri . '/', VIR_PATH) == 0 || strpos($request_uri, 'account_login') !== false || strpos($request_uri, 'account/login') !== false)) {
                $request_uri = VIR_PATH . ($PREFS->conf['fancy_urls'] ? "account/home/" : "index.php?m=account_home");
            }
            if ($SESSION->conf['group_id'] == 2) {
                $request_uri = VIR_PATH . ($PREFS->conf['fancy_urls'] ? "specific/page/" : "index.php?m=specific_page");
            }
            if ($SESSION->conf['group_id'] == 6) {
                $request_uri = VIR_PATH . ($PREFS->conf['fancy_urls'] ? "specific/page2/" : "index.php?m=specific_page2");
            }
            redirect($request_uri);
        } else {
            if ($SESSION->conf['group_id'] == 2) {
                $request_uri = VIR_PATH . ($PREFS->conf['fancy_urls'] ? "specific/page" : "index.php?m=specific_page");
            } elseif ($SESSION->conf['group_id'] == 6) {
                $request_uri = VIR_PATH . ($PREFS->conf['fancy_urls'] ? "specific/page2/" : "index.php?m=specific_page2");
            } else
                redirect(VIR_PATH . ($PREFS->conf['fancy_urls'] ? "account/home/" : "index.php?m=account_home"));
        }
    }
    
    ?>
    
    PHP:
     
    Einheijar, May 26, 2012 IP
    sowers likes this.
  3. sowers

    sowers Well-Known Member

    Messages:
    257
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    110
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    It worked, please send me your paypal id by private message
     
    sowers, May 27, 2012 IP