Search the Community
Showing results for tags 'config.php'.
-
I have the following code for a very simple registration form handler - //require('../../config/config.php'); require('reg_functions.php'); //assign clean form variables $firstname = clean_names($_POST['firstname']); $lastname = clean_names($_POST['lastname']); $username = clean_names($_POST['username']); $email = clean_email($_POST['email']); $email2 = clean_email($_POST['email2']); $password = clean_password($_POST['password']); $password2 = clean_password($_POST['password2']); $date = date("Y-m-d"); if(isset($_POST['register_button'])) { //validate & confirm emails match if($email == $email2) { if(filter_var($email, FILTER_VALIDATE_EMAIL)) { $email = filter_var($email, FILTER_VALIDATE_EMAIL); // I THINK I COULD DEF MAKE THIS EMAIL CHECK CLEANER - WORK ON THAT LATER //check if email exists in system already $email_check = mysqli_query($conn, "SELECT email FROM users WHERE email='$email'"); //number of rows returned with the email (this should be 0 to proceed) $number_rows = mysqli_num_rows($email_check); if($number_rows > 0) { echo "Email already in use <br>"; } else { echo "email is correct <br>"; } } else { echo "Invalid email format <br>"; } } else { echo "Emails don't match <br>"; } echo "First Name: " . $firstname . "<br>"; echo "Last Name: " . $lastname . "<br>"; echo "Username: " . $username . "<br>"; echo "Number of Rows: " . $number_rows . "<br>"; } the code that starts with the mysqli_query() function to check for matching emails is where it fails (white screen). I figured it may be because the $conn variable wasn't being associated with the $conn variable in the config.php file. So I added the require config.php at the top. Now it only works if both are commented out. So in reality this could be 2 issues and I struggled with how not to ask too many questions in one post though they may be the same issue. I'm really new to php. Can someone explain the mechanics of whats going on (or not going on). to recap, this is the code that caused the white screen initially - // I THINK I COULD DEF MAKE THIS EMAIL CHECK CLEANER - WORK ON THAT LATER //check if email exists in system already $email_check = mysqli_query($conn, "SELECT email FROM users WHERE email='$email'"); //number of rows returned with the email (this should be 0 to proceed) $number_rows = mysqli_num_rows($email_check); if($number_rows > 0) { echo "Email already in use <br>"; } else { echo "email is correct <br>"; } and I realized it had no association to the $conn variable in the config.php file so I added the require config.php line at the top. This above code is obviously still not working and if I comment it out, the require config.php line still causes a white screen. This is my config file - ob_start(); session_start(); $timezone = date_default_timezone_set("America/xxxxxxxx"); $db_host = "localhost"; $db_user = "root"; $db_pass = ""; $db_name = "qcic"; $conn = mysqli_connect( $db_host, $db_user, $db_pass, $db_name ); if( $conn->connect_errno) { printf( "Connect Failed: %s\n", $conn->connect_error); exit(); } else { echo "Connected to database"; } ob_end_flush(); and I get the "Connected to database" echo so I have no idea what the problem is. Anyone with some time and more experience that can explain some of these things? thanks
-
My previous post disappeared for some reason :-( Thankfully I still have the suggestions made by jazzman1 and AoTBuNgLe in my email :-) @jazzman1: Here are the results from the 3 folders: Parent Directory /home4/clickfi4/public_html 'demo' folder /home4/clickfi4/public_html/demo 'secure_folder' subfolder /home4/clickfi4/public_html/demo/secure_folder
- 5 replies
-
- path
- config.php
-
(and 1 more)
Tagged with:
-
I know this is a really basic question, but I'm still a real php noob. I want to move $salt to the config.php file, but I'm not sure how to call the variable correctly so the page can use it. I tried this: require_once('config.php); $salt = loadSaltFromConfig(); I'm assuming that I need to declare loadSaltFromConfig somewhere, but I'm not quite sure what that would need to be.
- 10 replies
-
- salt
- config.php
-
(and 3 more)
Tagged with: