cancel
Showing results for 
Search instead for 
Did you mean: 

PHP & MySQL Datab Connection Issues on BT WEB HOSTING

BCAV_WEB
Member

Hello, firstly I will outline what I what to achieve.  

 

PLEASE NOTE I KNOW ALL OF THIS CODING WORK AS I HAVE USED IT FOR VARIOUS WEBSITE, JUST AN ISSUE ON BT HOSTING.

 

I'm currently developing our website, which now requires an admin area, okay so that one page called "login.php" required straight away for the admin to enter username & password, as well as a backend database. This has been created as "staff" with the two main fields "username" & "password".

 

Nextly I need to use a form and post this info to another page called "loginaction.php" and then check it against the database and redirect using PHP header to another page. My issue occurs on this page, I believe that because the database is held on another server in my case "sql5c30a.carrierzone.com"when the page is re-driecting it sees thepage as non existent and halts on the page causing a blank page on firefox.

 

Can anyone help me??

 

Here is the coding:

 

LOGIN.php

 

<?php include "sections/phparea.php";?>
<?php include "sections/header.php";?>
<?php include "sections/left.php";?>
    <!-- start content -->
        <div id="content">
                          <?php
                              // Include the formatted error message
                              if (isset($_SESSION['message']))
                            echo
                              "<h4>".$_SESSION['message']."</h4>";
                              // Generate the login <form> layout

                         ?>                  
                         <form action="loginaction.php" method="post">
                         <table class="tablelogin" >
                                 <tr>
                                 <td>
                                    <label for="email">E-mail Address</label>                                
                                </td>
                                 <td>
                                    <input type="text" name="email" id="email" />                                
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <label for="password">Password</label>                                
                                </td>
                                <td>
                                    <input type="password" name="password" id="password" />                                
                               </td>
                            </tr>
                            <tr>
                                <td>&nbsp;
                                    
                                </td>
                                <td>
                                    <a href="accountrecovery.php">Forgotten Password?</a>    
                                </td>
                            </tr>
                            <tr>
                                <td>&nbsp;
                                    
                                </td>
                                <td>&nbsp;
                                    
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                                <td>
                                    <input type="hidden" name="count" id="count" value="1" />
                                    <input type="reset" name="reset" id="reset" value="Clear" />   
                                    <input type="submit" name="submit" id="submit" value="Log in" />    
                                </td>
                            </tr>
                          </table>
                         </form>  
        </div>
        <!-- end content -->
<?php include "sections/right.php";?>
<?php include "sections/footer.php";?>

 

LOGINACTION.php

 

<?php
      
    include "connections/dbconnect.php";
    session_start();
       $email =$_POST["email"];
       $password =$_POST["password"];

       if (empty($email) or empty($password))
           {
           $_SESSION["message"] = "Must enter your E-mail and Password " ;
           header("Location: login.php"); //This sets the redirection information
            //Ends the script and redirects to above
           }
       else
        {
            
            $query = "SELECT * FROM staff WHERE username = '$email' AND  password = '$password'";
            $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
            header("Location: cpanel.php");

        }



?>
       

DBCONNECTION.php PLEASE NOTE THE PASSWORD & USERNAME HAVE BEEN ALTERED TO SHOW.

 

<?php
    $hostname = "sql5c30a.carrierzone.com";
    $username = "username";
    $password = "password";
    $databaseName = "main_bikescarsandvans_co_uk";
    $connection = mysql_connect($hostname, $username, $password);   // or die ("Unable to connect!")
    mysql_select_db($databaseName) or die ("Unable to select database!");           
?>

 

CPANEL.php

 

<?php include "sections/phparea.php";?>
<?php include "sections/header.php";?>
<?php include "sections/left.php";?>
    <!-- start content -->
        <div id="content">
            <h2>Control Panel</h2>
            <p>
            </p>
            <?php include "connections/dbconnect.php"; ?>
            
        </div>
        <!-- end content -->
<?php include "sections/right.php";?>
<?php include "sections/footer.php";?>


               

 

0 REPLIES 0