Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'redirect header function'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. Hello, Please help! Thank you. I have a webpage (a member log in page called logcheck.php) which allows members to enter their member name and password, then once the member name (member_name) and password (pass) are validated, i.e. the combination is found in a unique record in the members table in a mysql database called test , then members will be redirected to another page (called byimain.php) on my website using. header('Location: byimain.php'); This works perfectly when I run it on localhost where the mysqli connect function is as follows: $dbc = @mysqli_connect('localhost', 'root', 'password', test') OR die ('Could not connect to MySQL: ' . mysqli_connect_error()); Now I sign up with yahoo as my web hosting. I have to set up access to mySQL and to create a new username and password for mySQL database (phpMyadmin). I also created a database called test to store my members table, and on my members table, I have one row with member_name = janekoo and pass = passjk . Yahoo told me the host now is mysql instead of localhost. So my new mysqli connect function will be: $dbc = @mysqli_connect('mysql', 'xxx', 'yyy', test') OR die ('Could not connect to MySQL: ' . mysqli_connect_error()); where xxx =username and yyy = password I know the mysql part and the validation of the member_name and pass against the members table in the test database are working because for testing, I program to have the sentence "I am in" to display on the member log in page if someone enters janekoo as member_name and passjk as password. And I did get "I am in". But I cannot get the redirection to the byiman.php page with yahoo hosting which I can under localhost. Before Yahoo allows me to set up mySQL access, I have to upgrade my php from version 5.2 to a newer version 5.3. Before my script is under version 5.2, now it is under version 5.3. Will that upgrade cause header('Location: byimain.php'); not to work under yahoo hosting? Once again, the following script works fine under localhost, but not under Yahoo hosting. Under Yahoo hosting, I cannot get the redirect to byimain.php when users enter the correct member name and password. Below is my script in the members log in page: <?php error_reporting (E_ALL ^ E_NOTICE); ?> <!DOCTYPEhtml><html> <head> <title> Login Form </title> <style type="text/css" media="screen"> form div{ margin-bottom: 1em; } </style> </head> <body bgcolor=#FFFFFF> <h1> Log In </h1> <?php $form = "<form action='logcheck.php' method='POST'> <table> <tr> <td> Username: </td> <td> <input type='text' name='member_name' /> </td> </tr> <tr> <td> Password: </td> <td> <input type='password' name ='pass'/> </td> </tr> <tr> <td></td> </tr> <tr> <td></td> <td> <input type='submit' name='submit' value='submit'/> </td> </tr> </table> </form>"; echo $form; ?> <?php //Check for form submission if ($_SERVER['REQUEST_METHOD'] =='POST'){ $m=($_POST['member_name']); $p=($_POST['pass']); // Register the user in the database host = mysql, username = xxx, password = yyy, database = test. $dbc = @mysqli_connect('mysql', 'xxx', 'yyy', 'test') OR die ('Could not connect to MySQL: ' . mysqli_connect_error()); //Retrieve the first_name, and last_name for that email/password combination: $q= "SELECT member_id FROM members WHERE member_name = '$m' AND pass = '$p' "; //Run the query: $r= @mysqli_query($dbc, $q); //Check the results if (mysqli_num_rows($r) == 1) { //if a record is found //Success message header('Location: byimain.php'); }else{//if no record is found //Problem message print '<p style="color: red;"> Incorrect username and password combination. Or username and/or password fields are blank. Please try again! </p>'; } //Close the database connection mysqli_close($dbc); exit(); } ?> </body> </html>
×
×
  • Create New...