Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: done it countless of times |
|
Author |
|
coldasice
Joined: 02 Jan 2007 Posts: 20
|
Posted: Fri 02 Feb '07 1:18 Post subject: done it countless of times |
|
|
well i have installed all apaches there is..
and all i get from my home made forum is!!!!
Code: |
Click here to log out."; exit; } else { fail("database query failed, registration page", true); } } else { setup_page("Registration", "Invalid registration"); echo "Sorry, that username has been taken. Please try another.
"; } } else { setup_page("Registration", "Invalid registration"); echo "Please submit a valid email address."; } // if less than all three fields have been filled up .. } else if ($user || $pass || $email) { setup_page("Registration", "Invalid registration"); echo "Please fill in all fields."; // greeting for new users } else { setup_page("Registration", "Registration"); echo "Please enter your details to register."; } ?>
Enter a username:
Enter a password:
Your email:
Should we allow other users to email you? Yes No
|
|
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Fri 02 Feb '07 10:00 Post subject: |
|
|
Seems that php is not parsing the page.
My first though is short tags in php.ini
Code: |
short_open_tag = On
|
|
|
Back to top |
|
coldasice
Joined: 02 Jan 2007 Posts: 20
|
Posted: Sat 03 Feb '07 13:59 Post subject: |
|
|
yes that seems to work.. >.< sorry for late replay... was ^^ partying =D
btw that worked but none of the script is =D
like connecting to mysql |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
|
Back to top |
|
coldasice
Joined: 02 Jan 2007 Posts: 20
|
Posted: Sat 03 Feb '07 17:42 Post subject: |
|
|
O.o that , i already have it it works =D.. but i use php 520..
well the problem is that with short tags on.. >.< it looks like it shuld but it wont conenct to db.. it will neither die.. >.> when not connected.. >.<
all it does is refreshing the page >.>
so =? got any suggestions =? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Sun 04 Feb '07 19:16 Post subject: |
|
|
Can you post your script? So I may take a look. |
|
Back to top |
|
coldasice
Joined: 02 Jan 2007 Posts: 20
|
Posted: Mon 05 Feb '07 2:28 Post subject: |
|
|
well here is some of it >.>
Code: |
<?
// this function is called to set up each of the pages in the website.
// it shows the site's logo, and gives as the page title whatever it's passed
// as its first argument .. the other argument it uses as the header text of the
// page. there is also a javascript function included in the title; this is used as
// a confirm on the post.php and main.php pages, for deleting posts and threads,
// respectively. an internal style sheet is set up to ensure stylistic coherence.
function setup_page ($title, $headtext) {
echo "<HTML>
<HEAD>
<TITLE>".$title."</TITLE>
<SCRIPT LANGUAGE=JAVASCRIPT TYPE='TEXT/JAVASCRIPT'>
<!--
function areYouSure (msg) {
var bool = window.confirm(msg);
return bool;
}
-->
</SCRIPT>
</HEAD>
<STYLE>
H1 {color:#CCCCCC; font:bold 16pt 'Verdana', 'Tahoma', 'Arial'}
H2 {color:#CCCCCC; font:bold 12pt 'Verdana', 'Tahoma', 'Arial'}
P {color:#CCCCCC; font:10pt 'Verdana', 'Tahoma', 'Arial'}
A:link {color:#FF0000; font:bold 10pt}
A:hover {color: #FFFF33; font:bold 10pt}
A:visited {color:#CC9900; font:bold 10pt}
</STYLE>
<BODY BGCOLOR='#000066' TEXT='#CCCCCC'>
<P ALIGN='center'><IMG SRC='logo.gif' WIDTH='344' HEIGHT='55'></p>
<H1>".$headtext."<H1>
<p>";
// set up a global variable to show that the page has been set up
global $set_up;
$set_up = TRUE;
}
// this function shows an error message and some links. the error message is
// passed as the first argument of the function.
function fail ($msg, $serious) {
// if the page has already been set up, just show a small header
if ($set_up) {
echo "<H2>Whoops</H2>";
// otherwise set up the page to show that an error has occured
} else {
setup_page ("Error", "Whoops");
}
echo "<p>Sorry. There has been an error (".$msg.").<BR><br>";
// if 'serious' is true (the second argument passed in a call to this function)
// then the user must return all the way to the site entrance
if ($serious) {
echo "<A HREF='enter.php'>Please click here to return to the site entrance.</A>";
// if its not a 'serious' error then the user has to go to the main thread listing page
} else {
echo "<A HREF='main.php'>Please click here to return to the main page.</A>";
}
// show a link to mail the technical help
echo "<BR><BR><A HREF='mailto:administrator@greatdebate.net'>Click here to inform
our technical staff of this problem.</A></p>";
exit;
}
// this function checks to make sure the string that is passed its argument is in valid format
// for an email address
function isValidEmail ($email) {
return eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$", $email);
}
// this function connects to MySQL and selects the forum database
function dbConnect () {
$db = mysql_pconnect("localhost", "coldasice", "");
mysql_select_db("forum", $db);
}
?>
[the function]
|
Code: |
the login script
<?
// check for session variables
session_start();
// load the script containing the common functions
require "forum.inc";
// set a string variable to contain some hyperlinks to other parts of the site
$links = "<A HREF='main.php'>Click here to proceed to the forum =D.</A><BR><BR>
<A HREF='enter.php'>Click here to log out.</A>";
// if this page has been called by the form on itself
if ($user && $pass) {
// if the user specified on the form is the user that has already been logged in
if ($logged_in_user == $user) {
// inform the user of this, show the links and stop executing this script
setup_page ("Already logged in!", "Whoops");
echo $user.", you are already logged in.<BR><BR>";
echo $links;
exit;
}
// connect to 'forum' database and check the username-password combination
// submitted on the form
dbConnect();
$result = mysql_query("SELECT * FROM users WHERE name = '".$user."'
AND password = PASSWORD('".$pass."')");
// if the query doesnt execute, show an error message
if (!$result) {
fail("database query failed, login page", true);
}
// if the username and password are valid
if (mysql_num_rows($result) > 0) {
// find the userID and register it as a session variable
$record = mysql_fetch_assoc($result);
$logged_in_user = $user;
session_register("logged_in_user");
$logged_userID = $record["userID"];
session_register("logged_userID");
// if the user is identified as a moderator on the database,
// log this fact as a session variable
if ($record["mod"]) {
$logged_as_mod = true;
session_register("logged_as_mod");
}
setup_page("Welcome", "Welcome");
echo "Glad you could make it, ".$logged_in_user." :)<BR><BR>";
echo $links;
exit;
// if the login details did not match the database, show the form again
} else {
setup_page("Invalid", "Invalid Login");
echo "That username-password combination does not appear to match our records.
Please try again.<BR><BR>";
}
// or if the user has failed to fill in both fields, show the form again
} else if ($user || $pass) {
setup_page("Invalid", "Invalid Login");
echo "Please fill in both fields.<BR><BR>";
// if the user has arrived for the first time on this page, ask them to complete the form
} else {
setup_page("Login", "Login");
echo "Please enter your details to log in.";
}
?>
<FORM METHOD=POST ACTION="login.php">
Your username:
<INPUT NAME="user" TYPE=TEXT MAXLENGTH=20 SIZE=20>
<BR>
Your password:
<INPUT NAME="pass" TYPE=PASSWORD MAXLENGTH=10 SIZE=20>
<BR>
<BR>
<INPUT TYPE=SUBMIT VALUE="Login">
</FORM>
<A HREF="enter.php">Click here to return to the site entrance.</A>
</BODY>
</HTML>
|
|
|
Back to top |
|
|
|
|
|
|