GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   PHP Gurus, fix this simple code (https://gfy.com/showthread.php?t=832119)

Shaze 06-02-2008 04:18 AM

PHP Gurus, fix this simple code
 
I'm doing a redirect in a php file, but having a problem with how to display the id at the end of the URL. Basically where it says "echo $id". What's the correct code for this?

<?php
header("location:http://refer.ccbill.com/cgi-bin/clic...6-0000&PA=echo $id");
exit;
?>


thanks in advance

Sam Granger 06-02-2008 04:22 AM

<?php
header('http://refer.ccbill.com/cgi-bin/clicks.cgi?CA=929876-0000&PA='. $id);
exit;
?>

Sam Granger 06-02-2008 04:24 AM

and maybe make exit to this:

exit();

Shaze 06-02-2008 04:28 AM

Quote:

Originally Posted by Sam Granger (Post 14265178)
and maybe make exit to this:

exit();


cool it worked. what if I need to have a URL at the end of the redirect. code below, but i know it's wrong:

<?php
header('location:http://refer.ccbill.com/cgi-bin/clicks.cgi?CA=98956-0000&PA='. $id'&HTML=http://www.site.com);
exit();
?>

Adultnet 06-02-2008 04:40 AM

Quote:

Originally Posted by Shaze (Post 14265185)
cool it worked. what if I need to have a URL at the end of the redirect. code below, but i know it's wrong:

<?php
header('location:http://refer.ccbill.com/cgi-bin/clicks.cgi?CA=98956-0000&PA='. $id'&HTML=http://www.site.com);
exit();
?>

'.$id.'&html=http://www.site.com');

Adultnet 06-02-2008 04:42 AM

you can also make $id="yourid&html=http://www.site.com"
with this code:
<?php
header('http://refer.ccbill.com/cgi-bin/clicks.cgi?CA=929876-0000&PA='. $id);
exit;
?>

Shaze 06-02-2008 04:45 AM

Quote:

Originally Posted by Adultnet (Post 14265197)
'.$id.'&html=http://www.site.com');

thank you very much! i suck at php

k0nr4d 06-02-2008 04:53 AM

you all fail. That code would rely on register_globals being on, which is off by default under php5.
<?php
$id = $_GET[id];
header('Location: http://refer.ccbill.com/cgi-bin/clicks.cgi?CA=98956-0000&PA='.$id.'&HTML=http://www.site.com');
exit();
?>

polle54 06-02-2008 05:13 AM

Quote:

Originally Posted by k0nr4d (Post 14265221)
you all fail. That code would rely on register_globals being on, which is off by default under php5.
<?php
$id = $_GET[id];
header('Location: http://refer.ccbill.com/cgi-bin/clicks.cgi?CA=98956-0000&PA='.$id.'&HTML=http://www.site.com');
exit();
?>

Agreed... BUT you don't know he has to get ID by GET do you? and you forgot two quotation marks in your get.

Shaze Here is a example where it's a bit more split up.

You should really read http://w3schools.com/php/default.asp

It takes 30 minutes and will save you many many hours in the future.

<?php
$id = $_REQUEST["id"];
$urlstring = "http://refer.ccbill.com/cgi-bin/clicks.cgi?CA=98956-0000&PA=".$id."&HTML=http://www.site.com";
header("Location: " . $urlstring);
exit();
?>


All times are GMT -7. The time now is 01:10 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123