aggiefan
08-06-2006, 04:07 AM
I'm working on porting my product over to 3.6 and I know that there are now input cleaners for $_get and other commands.
Basically, what I'm trying to do is use the url the person is on to capture a value. So, if they're on the following real url, I want to grab the contest and week values.
http://www.aggiefans.com/forums/vbcontest.php?do=matchups&contest=TESTA&week=1
(if you visit, ignore the mysql errors. It's because I haven't finished coding the % of votes for the other 14 games).
Then when they submit, I want to record the contest name (TESTA) and the week # (1) to the database (these values are in the url address bar only).
I found that using $contestname = $_GET['contest']; and $week = $_GET['week']; pull the information from the url correctly as I can use it to query. I've pulled out the array using the following ($contestkey is simply "$contestname$week"):
$contestnameresult = $db->query_first("SELECT contestname from " . TABLE_PREFIX . "vbcontest_matchups WHERE contest_key='$contestkey'");
$contestname1 = $contestnameresult[contestname];
$weekresult = $db->query_first("SELECT weekid from " . TABLE_PREFIX . "vbcontest_matchups where contest_key='$contestkey'");
$week1 = $weekresult[weekid];
If I do a print "$contestname1" it prints TESTA at the top of my page (you can see it on the link above). However, when I put write to db for $contestname1, it comes across blank. Help would be appreciated.
And to clarify, this is my values being written to the database. Every value is being recorded (17 others, except the first two).
$db->query_write ("INSERT INTO " . TABLE_PREFIX . "vbcontest_picks (contestname, weekid, username, userid, game1, game2, game3, game4, game5, game6, game7, game8, game9, game10, game11, game12, game13, game14, game15)
VALUES ('$contestname1', '$week1', '$yourname', '$yourid', '$radioanswer1', '$radioanswer2', '$radioanswer3', '$radioanswer4', '$radioanswer5', '$radioanswer6', '$radioanswer7', '$radioanswer8', '$radioanswer9', '$radioanswer10', '$radioanswer11', '$radioanswer12', '$radioanswer13', '$radioanswer14', '$radioanswer15')");
Basically, what I'm trying to do is use the url the person is on to capture a value. So, if they're on the following real url, I want to grab the contest and week values.
http://www.aggiefans.com/forums/vbcontest.php?do=matchups&contest=TESTA&week=1
(if you visit, ignore the mysql errors. It's because I haven't finished coding the % of votes for the other 14 games).
Then when they submit, I want to record the contest name (TESTA) and the week # (1) to the database (these values are in the url address bar only).
I found that using $contestname = $_GET['contest']; and $week = $_GET['week']; pull the information from the url correctly as I can use it to query. I've pulled out the array using the following ($contestkey is simply "$contestname$week"):
$contestnameresult = $db->query_first("SELECT contestname from " . TABLE_PREFIX . "vbcontest_matchups WHERE contest_key='$contestkey'");
$contestname1 = $contestnameresult[contestname];
$weekresult = $db->query_first("SELECT weekid from " . TABLE_PREFIX . "vbcontest_matchups where contest_key='$contestkey'");
$week1 = $weekresult[weekid];
If I do a print "$contestname1" it prints TESTA at the top of my page (you can see it on the link above). However, when I put write to db for $contestname1, it comes across blank. Help would be appreciated.
And to clarify, this is my values being written to the database. Every value is being recorded (17 others, except the first two).
$db->query_write ("INSERT INTO " . TABLE_PREFIX . "vbcontest_picks (contestname, weekid, username, userid, game1, game2, game3, game4, game5, game6, game7, game8, game9, game10, game11, game12, game13, game14, game15)
VALUES ('$contestname1', '$week1', '$yourname', '$yourid', '$radioanswer1', '$radioanswer2', '$radioanswer3', '$radioanswer4', '$radioanswer5', '$radioanswer6', '$radioanswer7', '$radioanswer8', '$radioanswer9', '$radioanswer10', '$radioanswer11', '$radioanswer12', '$radioanswer13', '$radioanswer14', '$radioanswer15')");