Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

PHP & MYSQL Website Development

Hey, I am working on a php website and I am using mysql as the database of the site. I am currently using MAMP to setup my localhost server. The problem is when I uploaded my website to Siteground hosting features like the login page isn't working. The redirects using header() for example { if login failed do... header("Location: login.php?res=1"); } doesn't pass the parameter res=1 also when valid login credentials are used the site gives a blank page. On my localhost everything works fine and as expected also on my actual website on siteground the signup page functions properly so i don't know what the problem is.

Please help me fix this issue.

The code used to check

if ($_SERVER['REQUEST_METHOD'] == "POST") { $email = trim(filter_input(INPUT_POST,'login_email',FILTER_SANITIZE_EMAIL)); $password = trim(filter_input(INPUT_POST,'login_password',FILTER_SANITIZE_STRING)); $_SESSION['used_email'] = $email; $_SESSION['login_failed'] = "no"; if (empty($email) || empty($password)) { $err_msg = "Please fill in the required fields!"; } else { if (log_user_in($email,$password)) { $_SESSION['lis'] = encrypt_text(true); echo($_SESSION['cu']) . "<br>\n"; echo($_SESSION['lis']); header("Location: home.php"); exit; } else { header("Location: login.php?res=1"); }

}

}

The functions used are coded in different files placed in different folders but included in this (login.php) page