acid.waste Posted October 27, 2010 Share Posted October 27, 2010 Alrite, i have a configs.php that holds a bunch of information (Login info mostly) and when i do $UsrNme = $_POST["user"]; $Passw = $_POST["pass"]; include 'configs.php' if ($UsrNme == $UserName && $Passw == $Password) { setcookie("User", "True", time()+3600); echo "Welcome {$UsrNme}; You have been successfully logged in!"; } else { echo "Sorry, the username {$UsrNme} was not successfully logged in."; } It prints my configs.php instead of using the variables $UserName and $Password to check against UsrNme and Passw... Am i doing something wrong or is this supposed to happen? Link to comment https://forums.phpfreaks.com/topic/217016-include-filephp-is-printing-my-vars-before-i-tell-them-to/ Share on other sites More sharing options...
Pikachu2000 Posted October 27, 2010 Share Posted October 27, 2010 Hard to tell without knowing what's in configs.php. Link to comment https://forums.phpfreaks.com/topic/217016-include-filephp-is-printing-my-vars-before-i-tell-them-to/#findComment-1127151 Share on other sites More sharing options...
acid.waste Posted October 27, 2010 Author Share Posted October 27, 2010 config.php has $UserName = "Username"; $Password = "Password"; $AdminEmail = "[email protected]"; $sqlHOST = "host.host.host"; $sqlUser = "username"; $sqlPass = "Password"; $sqlDatabase = "database"; $ForumName = "Test"; $ForumName = "http://www.lol.com/forum/"; Link to comment https://forums.phpfreaks.com/topic/217016-include-filephp-is-printing-my-vars-before-i-tell-them-to/#findComment-1127154 Share on other sites More sharing options...
freelance84 Posted October 27, 2010 Share Posted October 27, 2010 There is no semi colon after include 'configs.php', that may be messing things up a bit Link to comment https://forums.phpfreaks.com/topic/217016-include-filephp-is-printing-my-vars-before-i-tell-them-to/#findComment-1127155 Share on other sites More sharing options...
BlueSkyIS Posted October 27, 2010 Share Posted October 27, 2010 does config.php have opening and closing php tags? Link to comment https://forums.phpfreaks.com/topic/217016-include-filephp-is-printing-my-vars-before-i-tell-them-to/#findComment-1127156 Share on other sites More sharing options...
rwwd Posted October 27, 2010 Share Posted October 27, 2010 It will print out the contents if you don't wrap the file in php tags - either that or you left them off the post? And in your first example your missing the ; from the include instruction. Rw Link to comment https://forums.phpfreaks.com/topic/217016-include-filephp-is-printing-my-vars-before-i-tell-them-to/#findComment-1127157 Share on other sites More sharing options...
acid.waste Posted October 27, 2010 Author Share Posted October 27, 2010 Thanks for your help everyone! I forgot to have fwrite add the opening and closing php tags, thanks for helping me see this! Link to comment https://forums.phpfreaks.com/topic/217016-include-filephp-is-printing-my-vars-before-i-tell-them-to/#findComment-1127232 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.