eaglelegend Posted May 25, 2008 Share Posted May 25, 2008 include("header.php"); $eaglelegend = "eaglelegend.com"; //Your site url without http:// $eaglelegend2 = "www.eaglelegend.com"; //Type your domain with www. this time $referer = $_SERVER['HTTP_REFERER']; //Check if browser sends referrer url or not if ($referer == "") //If not, set referrer as your domain $domain = $yoursite; else $domain = parse_url($referer); //If yes, parse referrer if($domain['host'] == $eaglelegend || $domain['host'] == $eaglelegend2) { //Run your dowloading code here normally } else { //The referrer is not your site, we redirect to your home page header("Location: http://www.eaglelegend.com"); exit(); //Stop running the script } I know I am doing alot of work on my site today heh, but security, no matter how small is VERY important to me, so, please help, I have an error... Help IS much appreciated, thanks! Parse error: syntax error, unexpected '=' in /misc/39/000/171/334/2/user/web/eaglelegend.com/login.php on line 14 login.php: @$username = strip_tags(stripslashes($_POST['username'])); //assuming 'username' is the name of your form var @$password = strip_tags(stripslashes(md5($_POST['password']))); // ditto on 'password' } if($username && $password) { $check = mysql_num_rows(mysql_query("SELECT * FROM `members` WHERE `username`='$username' AND `password`='$password'")); if($check == 1) { $_SESSION['ELv2'] = $username; if(session_register('ELv2')){ $sql = mysql_query("UPDATE members SET ip ='{$_SERVER['REMOTE_ADDR']}' WHERE username='$username' LIMIT 1"); Header("Location: index.php"); } else { print "Cant set cookie"; } } else { print "Sorry, username/password mismatch!"; } } else { ?> Quote Link to comment https://forums.phpfreaks.com/topic/107212-http_referer/ Share on other sites More sharing options...
eaglelegend Posted May 25, 2008 Author Share Posted May 25, 2008 Please ignore that old code, I noticed I missed a ew things -.-' here it is currently... include("header.php"); $eaglelegend = "eaglelegend.com"; //Your site url without http:// $eaglelegend2 = "www.eaglelegend.com"; //Type your domain with www. this time $referer = $_SERVER['HTTP_REFERER']; //Check if browser sends referrer url or not if ($referer == "") //If not, set referrer as your domain $domain = $yoursite; else $domain = parse_url($referer); //If yes, parse referrer if($domain['host'] == $eaglelegend || $domain['host'] == $eaglelegend2) { //Run your dowloading code here normally } else { //The referrer is not your site, we redirect to your home page header("Location: http://www.eaglelegend.com"); exit(); //Stop running the script } however the site is showing me this... Parse error: syntax error, unexpected '}' in /misc/39/000/171/334/2/user/web/eaglelegend.com/login.php on line 24 Quote Link to comment https://forums.phpfreaks.com/topic/107212-http_referer/#findComment-549655 Share on other sites More sharing options...
deadonarrival Posted May 25, 2008 Share Posted May 25, 2008 Which one is line 24? You only posted 19, none of which have any problems with unmatched braces Quote Link to comment https://forums.phpfreaks.com/topic/107212-http_referer/#findComment-549658 Share on other sites More sharing options...
eaglelegend Posted May 25, 2008 Author Share Posted May 25, 2008 this is 45, code, up to just before the begining of the form. <?php include("header.php"); $eaglelegend = "eaglelegend.com"; //Your site url without http:// $eaglelegend2 = "www.eaglelegend.com"; //Type your domain with www. this time $referer = $_SERVER['HTTP_REFERER']; //Check if browser sends referrer url or not if ($referer == "") //If not, set referrer as your domain $domain = $yoursite; else $domain = parse_url($referer); //If yes, parse referrer if($domain['host'] == $eaglelegend || $domain['host'] == $eaglelegend2) { //Run your dowloading code here normally } else { //The referrer is not your site, we redirect to your home page header("Location: http://www.eaglelegend.com"); exit(); //Stop running the script } @$username = strip_tags(stripslashes($_POST['username'])); //assuming 'username' is the name of your form var @$password = strip_tags(stripslashes(md5($_POST['password']))); // ditto on 'password' } if($username && $password) { $check = mysql_num_rows(mysql_query("SELECT * FROM `members` WHERE `username`='$username' AND `password`='$password'")); if($check == 1) { $_SESSION['ELv2'] = $username; if(session_register('ELv2')){ $sql = mysql_query("UPDATE members SET ip ='{$_SERVER['REMOTE_ADDR']}' WHERE username='$username' LIMIT 1"); Header("Location: index.php"); } else { print "Cant set cookie"; } } else { print "Sorry, username/password mismatch!"; } } else { ?> Quote Link to comment https://forums.phpfreaks.com/topic/107212-http_referer/#findComment-549660 Share on other sites More sharing options...
eaglelegend Posted May 25, 2008 Author Share Posted May 25, 2008 still in need of help. ??? Quote Link to comment https://forums.phpfreaks.com/topic/107212-http_referer/#findComment-549668 Share on other sites More sharing options...
jonsjava Posted May 25, 2008 Share Posted May 25, 2008 <?php include("header.php"); $eaglelegend = "eaglelegend.com"; //Your site url without http:// $eaglelegend2 = "www.eaglelegend.com"; //Type your domain with www. this time $referer = $_SERVER['HTTP_REFERER']; //Check if browser sends referrer url or not if ($referer == "") //If not, set referrer as your domain $domain = $yoursite; } else $domain = parse_url($referer); //If yes, parse referrer } if($domain['host'] == $eaglelegend || $domain['host'] == $eaglelegend2) { //Run your dowloading code here normally } else { //The referrer is not your site, we redirect to your home page header("Location: http://www.eaglelegend.com"); exit(); //Stop running the script } @$username = strip_tags(stripslashes($_POST['username'])); //assuming 'username' is the name of your form var @$password = strip_tags(stripslashes(md5($_POST['password']))); // ditto on 'password' if($username && $password) { $check = mysql_num_rows(mysql_query("SELECT * FROM `members` WHERE `username`='$username' AND `password`='$password'")); if($check == 1) { $_SESSION['ELv2'] = $username; if(session_register('ELv2')){ $sql = mysql_query("UPDATE members SET ip ='{$_SERVER['REMOTE_ADDR']}' WHERE username='$username' LIMIT 1"); Header("Location: index.php"); } else { print "Cant set cookie"; } } else { print "Sorry, username/password mismatch!"; } } else { ?> You were missing 2 brackets Quote Link to comment https://forums.phpfreaks.com/topic/107212-http_referer/#findComment-549671 Share on other sites More sharing options...
eaglelegend Posted May 25, 2008 Author Share Posted May 25, 2008 Thanks but now... Parse error: syntax error, unexpected '}' in /misc/39/000/171/334/2/user/web/eaglelegend.com/login.php on line 11 <?php include("header.php"); $eaglelegend = "eaglelegend.com"; //Your site url without http:// $eaglelegend2 = "www.eaglelegend.com"; //Type your domain with www. this time $referer = $_SERVER['HTTP_REFERER']; //Check if browser sends referrer url or not if ($referer == "") //If not, set referrer as your domain $domain = $yoursite; } else $domain = parse_url($referer); //If yes, parse referrer } if($domain['host'] == $eaglelegend || $domain['host'] == $eaglelegend2) { //Run your dowloading code here normally } else { //The referrer is not your site, we redirect to your home page header("Location: http://www.eaglelegend.com"); exit(); //Stop running the script } @$username = strip_tags(stripslashes($_POST['username'])); //assuming 'username' is the name of your form var @$password = strip_tags(stripslashes(md5($_POST['password']))); // ditto on 'password' if($username && $password) { $check = mysql_num_rows(mysql_query("SELECT * FROM `members` WHERE `username`='$username' AND `password`='$password'")); if($check == 1) { $_SESSION['ELv2'] = $username; if(session_register('ELv2')){ $sql = mysql_query("UPDATE members SET ip ='{$_SERVER['REMOTE_ADDR']}' WHERE username='$username' LIMIT 1"); Header("Location: index.php"); } else { print "Cant set cookie"; } } else { print "Sorry, username/password mismatch!"; } } else { ?> Quote Link to comment https://forums.phpfreaks.com/topic/107212-http_referer/#findComment-549715 Share on other sites More sharing options...
eaglelegend Posted May 25, 2008 Author Share Posted May 25, 2008 Ok, sorry its kind of urgent now Quote Link to comment https://forums.phpfreaks.com/topic/107212-http_referer/#findComment-549724 Share on other sites More sharing options...
eaglelegend Posted May 25, 2008 Author Share Posted May 25, 2008 ??? Quote Link to comment https://forums.phpfreaks.com/topic/107212-http_referer/#findComment-549747 Share on other sites More sharing options...
sasa Posted May 25, 2008 Share Posted May 25, 2008 remove } in line 11 and line 14 Quote Link to comment https://forums.phpfreaks.com/topic/107212-http_referer/#findComment-549752 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.