Hoi ieder k zou graag de scripts gebruiken die volano me aanbeveeld om men memberdatabase volledig te laten functioneren.
een database met membernamen heb ik al.
deze database bevat
Membernamen
Memberwachtwoorden
Memberdocument
Memberprofiel weergeven ( ja of nee )
De constants Php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
/*
* constants.php - constants for the VolanoChat membership scripts.
*/
// HTTP request parameter names.
define("NAME_PARAMETER", "name");
define("PASSWORD_PARAMETER", "password");
// Host name of database server and database name.
define("DATABASE_HOST", "localhost");
define("DATABASE_NAME", "website");
// Database table name and field names.
define("TABLE", "members");
define("NAME_FIELD", "member_name");
define("PASSWORD_FIELD", "member_password");
define("PROFILE_FIELD", "member_profile");
define("LINK_FIELD", "member_link");
// HTTP response content type and output.
define("CONTENT_TYPE", "text/plain");
define("TRUE_LINE", "true\n");
define("FALSE_LINE", "false\n");
define("ERROR_LINE", "error\n");
// Default member document link when undefined.
define("DEFAULT_MEMBER_DOCUMENT", "");
?>
Access.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/*
* access.php - a sample VolanoChat member access script.
*/
include "constants.php";
header("(anti-spam-content-type:) " . CONTENT_TYPE);
// Get the HTTP request parameters.
$name = $_REQUEST[NAME_PARAMETER]
or die(ERROR_LINE . "Undefined parameter: " . NAME_PARAMETER . "\n");
$password = $_REQUEST[PASSWORD_PARAMETER]
or die(ERROR_LINE . "Undefined parameter: " . PASSWORD_PARAMETER . "\n");
// Connect to the database.
$link = @mysql_connect(DATABASE_HOST)
or die(ERROR_LINE . mysql_error() . "\n");
@mysql_select_db(DATABASE_NAME)
or die(ERROR_LINE . mysql_error() . "\n");
// Get the database row for the given member name.
$query =
"SELECT " . PASSWORD_FIELD . ", " . PROFILE_FIELD . ", " . LINK_FIELD
. " FROM " . TABLE . " WHERE " . NAME_FIELD . " = '" . $name . "'";
$result = @mysql_query($query)
or die(ERROR_LINE . mysql_error() . "\n");
$row = mysql_fetch_assoc($result)
or die(FALSE_LINE);
// Return the HTTP response.
if ($row[PASSWORD_FIELD] == $password) {
print TRUE_LINE;
print $row[PROFILE_FIELD] . "\n";
if ($row[LINK_FIELD]) {
print TRUE_LINE;
}
else {
print FALSE_LINE;
}
}
else {
print FALSE_LINE;
}
// Free the database query result and close the connection.
@mysql_free_result($result);
@mysql_close($link);
exit();
?>
Document.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/*
* document.php - a sample VolanoChat member document script.
*/
include "constants.php";
// Get the HTTP request parameters.
$name = $_REQUEST[NAME_PARAMETER]
or die(ERROR_LINE . "Undefined parameter: " . NAME_PARAMETER . "\n");
// Connect to the database.
$link = @mysql_connect(DATABASE_HOST)
or die(ERROR_LINE . mysql_error() . "\n");
@mysql_select_db(DATABASE_NAME)
or die(ERROR_LINE . mysql_error() . "\n");
// Get the member document link for the given member name.
$query =
"SELECT " . LINK_FIELD . " FROM " . TABLE .
" WHERE " . NAME_FIELD . " = '" . $name . "'";
$result = @mysql_query($query)
or die(ERROR_LINE . mysql_error() . "\n");
$row = mysql_fetch_assoc($result);
// Redirect to the member document link if it exists; otherwise redirect to the
// default member document.
if ($row && strlen($row[LINK_FIELD]) > 0) {
header("Location: " . $row[LINK_FIELD]);
}
else {
header("Location: " . DEFAULT_MEMBER_DOCUMENT);
}
// Free the database query result and close the connection.
@mysql_free_result($result);
@mysql_close($link);
exit();
?>
Name.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/*
* name.php - a sample VolanoChat member name script.
*/
include "constants.php";
header("(anti-spam-content-type:) " . CONTENT_TYPE);
// Get the HTTP request parameters.
$name = $_REQUEST[NAME_PARAMETER]
or die(ERROR_LINE . "Undefined parameter: " . NAME_PARAMETER . "\n");
// Connect to the database.
$link = @mysql_connect(DATABASE_HOST)
or die(ERROR_LINE . mysql_error() . "\n");
@mysql_select_db(DATABASE_NAME)
or die(ERROR_LINE . mysql_error() . "\n");
// If the given member name exists, return true; otherwise, return false.
$query =
"SELECT " . NAME_FIELD . " FROM " . TABLE .
" WHERE " . NAME_FIELD . " = '" . $name . "'";
$result = @mysql_query($query)
or die(ERROR_LINE . mysql_error() . "\n");
$row = mysql_fetch_assoc($result)
or die(FALSE_LINE);
print TRUE_LINE;
// Free the database query result and close the connection.
@mysql_free_result($result);
@mysql_close($link);
exit();
?>
Hoe krijg ik deze scripts van toepassing op mijn database?