- This topic is empty.
-
AuthorPosts
-
September 26, 2008 at 2:28 am #779909
Anonymous
Inactivetry somthing like this
Code:Start php
include(“../cpconfig.php”); // load db data for connection
if ( isset($HTTP_GET_VARS[‘id’]) || isset($HTTP_POST_VARS[‘id’]) ) // get ID # of casino
{
$id = ( isset($HTTP_POST_VARS[‘id’]) ) ? htmlspecialchars($HTTP_POST_VARS[‘id’]) : htmlspecialchars($HTTP_GET_VARS[‘id’]);
}$update_clicks-mysql_query(“update p_casinos set bclick=bclick+1 where id=’$id'”); // increase counting f tracing clcks
$get_rows=mysql_query(“select * from p_casinos where id=’$id'”); // select casino from db
$get_url=@mysql_fetch_array($get_rows);
$clickurl=$get_url[url]; // get the url to redirect toheader(“Location: $clickurl”); // redirect to the casino
?>September 26, 2008 at 2:50 am #779912Anonymous
InactiveThanks that helped.
September 26, 2008 at 3:12 am #779913Anonymous
InactiveFoun out “links” is a reserved word in MySQL
SELECT link FROM links where (id=’$_GET[ID]
Thanks for your help
September 26, 2008 at 8:27 pm #779960Anonymous
InactiveHi Erik,
Just some comments using your own code:
1) $url = “casino.php?ID=”.$_GET[ID];
It seems that it has no use in the part you sent.
2) If you are getting a 404, it is because the “header” has an invalid URL. So:
a) Since it is:
$row = mysql_fetch_object($result);
$row it is an array thus, it wouldnt work as you posted.
b) Should be:
header(‘Location: ‘.$row[0]);3) There is an easy way to test what you are sending to the header. You print and ask the script to stop like this:
echo ‘URL: >’.$row[0].’<';
die;4) You should close the database connection prior to the header redirection.
That is it.
September 27, 2008 at 3:49 am #779973
winner.comMembera different php question
Do you know how to have text and image links open in a new window?
is there something on the back end i have to switch?
September 27, 2008 at 2:34 pm #779990Anonymous
InactiveSeptember 29, 2008 at 5:40 pm #780182
winner.comMemberThanks, bot it still didn’t work. ‘new’ or ‘blank’ get stripped in the html code when saved or uploaded
September 29, 2008 at 6:12 pm #780187Anonymous
Inactivehmmm…
If you are ftping the code directly to the server that won’t happen.
Since you are talking about SQL and so on in the post, it is hard to understand how your code is doing but I suspect that you have some kind of html form and submit the html… or, you are entering it directly to the db. If this is the case, you will need to clean the html prior to inserting to the db… something like this:
or… you may try to mimic the same situation just before you insert the data in to the db.
September 29, 2008 at 7:46 pm #780202
winner.comMemberThanks – I’ll give it a shot
September 29, 2008 at 7:57 pm #780205Anonymous
InactiveI always use a single ` for php code and ” double quotes for using inside strings to elimate these issues..
But if your sating youe just using plain html then theres somthing up with how your getting it there,,
for instance
$var=”http://”www.site.com””;will get hosed while
$var=’http://”www.site.com”‘;
will be ok
September 29, 2008 at 10:59 pm #780241Anonymous
InactiveThanks for all the advise and replies everyone:hattip:
September 30, 2008 at 12:58 am #780253Anonymous
InactiveI load the the whole string into insert into table values (x,’http;//www.site.com’) x being id (index) then when I call the url from the html [PHP] [/PHP]This opens a new page and works fine.
-
AuthorPosts