Jump to content

Create special PHP link


bgbs

Recommended Posts

use a php session and if the session is set  send user to payment if session unset send users to register

edit that up a bit should work

<?php
session_start( ); 
if(!isset($_SESSION["username"])){
header('Location: /register.php');
}
else
{
header('Location: /payment.php');
}
?>

wow, this looks complicated.

Thanks for your help guys

 

But where do I stick this code?

 

Here is the button link.  Button is generated by CSS.

<div class="signuplink"><a href="register.php">To become a Premium Member  - SIGN UP NOW </a>  </div>

 

 

So I erase the href and put in the php code in there?

 

 

<?php
session_start( ); 
if(!isset($_SESSION["username"])){
echo '<div class="signuplink"><a href="register.php">To become a Premium Member  - SIGN UP NOW</a>  </div>'; 
}
else
{
echo '<div class="paymentlink"><a href="payment.php">Continue to checkout</a>  </div>'; 
}
?>

 

try that

Ok, I tried that, but I get this error

 

 

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/wass/public_html/pricing.php:16) in /home/wass/public_html/inc.pricing.php on line 101

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/wass/public_html/pricing.php:16) in /home/wass/public_html/inc.pricing.php on line 101

For some reason its still not working. after I placed the code at the top it gives me this error now

 

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/wass/public_html/pricing.php:15) in /home/wass/public_html/inc.pricing.php on line 2

 

Warning: Cannot modify header information - headers already sent by (output started at /home/wass/public_html/pricing.php:15) in /home/wasc/public_html/inc.pricing.php on line 4

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.