Jump to content

error with a basic php page!


coolphpdude

Recommended Posts

Hi people,

 

im tryin to remind myself how to do php so i've knocked together a basic page as follows...

 

<?php

echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";
echo "<html xmlns='http://www.w3.org/1999/xhtml'>";
echo "<head>";
echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />";

echo "</head>";

// *** Connection - START ***
// connect to database
$db = @mysql_connect("localhost","xxxxxx","xxxxxx");  

if (!$db) 
{ 
        do_error("Could not connect to the server"); 
} 

// Check connection - if it does not exist then go to the error function 
@mysql_select_db("xxxxx",$db)or do_error("Could not connect to the database");
// *** Connection - END ***

echo "<html>";

// *********************** No Results **************************

function  do_error($error) 
{
echo "User not found. Please enter your login details on the right.";
}


echo "</html>";
?>

 

and it brings up the following message when i try to load that page...

 

Error in my_thread_global_end(): 1 threads didn't exit Failed loading C:\WINDOWS\system32\inetsrv\ioncube\ioncube_loader_win_5.2.dll

 

Is there something I have forgot to do???

 

Also one last thing, is there any way to write a section of code for example a query checking your username and password that you are going to use accross multiple pages and then call that. rather than having to type out that same query on each and every php page that uses it?

 

Thanks

Link to comment
Share on other sites

dont know about the error, sounds like something wrong with server configuration rather than your code. try a google search on it.

 

as far as the login, just write a separate login.php page and include it on each page that may be logged in from.

 

alternatively, keep the login.php separate.  each page with a login form sends the results to login.php and also sets a session variable for the current page.  after the login request is successfully handled, you can redirect them back to the current page using a header

Link to comment
Share on other sites

sounds like what i'm after. So does an include statement just pull in code that i've written on a seperate page and then execute that before continueing through the rest of the code on my page???

 

I tried to google in but only came back with 2 results which wern't relative :(

 

Cheers for replying

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.