i have this code:
<?php
//THIS CODE WAS MADE BY FLASHGOCRAZY AND GP1 IF YOU GET BANNED WHILE USING THIS CODE IT IS NOT OUR FAULT
//makes sure there is all the info needed
if(isset($_GET['user'])&&isset($_GET['projectid'])){
$proj-id = filter_input(INPUT_GET, "projectid");
$user = filter_input(INPUT_GET, "user");
header('Location: http://scratch.mit.edu/projects/$user/$proj-id/loveit#');
}
?>and it says there is an error on line 9! Help?
Offline
bbbeb wrote:
1 too many blank lines
no, I don't think that is it.
Last edited by flashgocrazy (2011-09-30 19:47:23)
Offline
for the header, use " instead of ' to enclose the string, as speech marks support variables, whereas apostrophes don't.
Offline
Try this:
<?php
//THIS CODE WAS MADE BY FLASHGOCRAZY AND GP1 IF YOU GET BANNED WHILE USING THIS CODE IT IS NOT OUR FAULT
//makes sure there is all the info needed
if(isset($_GET['user'])&&isset($_GET['projectid'])){
$projid = $_GET['projectid'];
$user = $_GET['user'];
header('Location: http://scratch.mit.edu/projects/'.$user.'/'.$proj-id.'/loveit#');
}
?>I took out filter_input() because i don't know what they're code is. Could you include the code for me for those functions?
Offline
TRocket wrote:
try chaning to:
Code:
header('Location: http://scratch.mit.edu/projects/' . $user . '/' . $proj-id . '/loveit#');
That also would work.
And I agree with above poster, you have no need for the filter inputs, if you're not going to use their full functionality.
Offline
Any good programming language doesn't allow hyphens in variable names! So first of all, it's good practice to use underscores instead. Second, use double quotes to enclose strings. Lastly, you're never sure whether the parser will interpret the variable names as a string or as a variable -- so use string concatenation instead of embedding the variables into a single string.
Offline
LS97 wrote:
Any good programming language doesn't allow hyphens in variable names! So first of all, it's good practice to use underscores instead. Second, use double quotes to enclose strings. Lastly, you're never sure whether the parser will interpret the variable names as a string or as a variable -- so use string concatenation instead of embedding the variables into a single string.
lol i try to always use camel caps so proj-id would be projId
Offline
GP1 wrote:
Try this:
Code:
<?php //THIS CODE WAS MADE BY FLASHGOCRAZY AND GP1 IF YOU GET BANNED WHILE USING THIS CODE IT IS NOT OUR FAULT //makes sure there is all the info needed if(isset($_GET['user'])&&isset($_GET['projectid'])){ $projid = $_GET['projectid']; $user = $_GET['user']; header('Location: http://scratch.mit.edu/projects/'.$user.'/'.$proj-id.'/loveit#'); } ?>I took out filter_input() because i don't know what they're code is. Could you include the code for me for those functions?
I found filter_input() in a book about php and mysql
Offline
GP1 wrote:
Try this:
Code:
<?php //THIS CODE WAS MADE BY FLASHGOCRAZY AND GP1 IF YOU GET BANNED WHILE USING THIS CODE IT IS NOT OUR FAULT //makes sure there is all the info needed if(isset($_GET['user'])&&isset($_GET['projectid'])){ $projid = $_GET['projectid']; $user = $_GET['user']; header('Location: http://scratch.mit.edu/projects/'.$user.'/'.$proj-id.'/loveit#'); } ?>I took out filter_input() because i don't know what they're code is. Could you include the code for me for those functions?
can you test the code for me?
Offline
flashgocrazy wrote:
GP1 wrote:
Try this:
Code:
<?php //THIS CODE WAS MADE BY FLASHGOCRAZY AND GP1 IF YOU GET BANNED WHILE USING THIS CODE IT IS NOT OUR FAULT //makes sure there is all the info needed if(isset($_GET['user'])&&isset($_GET['projectid'])){ $projid = $_GET['projectid']; $user = $_GET['user']; header('Location: http://scratch.mit.edu/projects/'.$user.'/'.$proj-id.'/loveit#'); } ?>I took out filter_input() because i don't know what they're code is. Could you include the code for me for those functions?
can you test the code for me?
Do I have to do everything myself? Fine, I will.
Offline
GP1 wrote:
flashgocrazy wrote:
GP1 wrote:
Try this:
Code:
<?php //THIS CODE WAS MADE BY FLASHGOCRAZY AND GP1 IF YOU GET BANNED WHILE USING THIS CODE IT IS NOT OUR FAULT //makes sure there is all the info needed if(isset($_GET['user'])&&isset($_GET['projectid'])){ $projid = $_GET['projectid']; $user = $_GET['user']; header('Location: http://scratch.mit.edu/projects/'.$user.'/'.$proj-id.'/loveit#'); } ?>I took out filter_input() because i don't know what they're code is. Could you include the code for me for those functions?
can you test the code for me?
Do I have to do everything myself? Yes!
Okay, I have this code:
<link rel="stylesheet" type="text/css" href="global.css" />
<?php
include("demo.php");
include("main.php");
$ip = $_SEREVR["REMOTE_ADDR"];
$con = mysql_connect("*","*","*");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("*", $con);
mysql_query("INSERT INTO visitors (ip)
VALUES ('$ip')");
mysql_close($con);
?>Offline