Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@120 f5dc347c-c33d-0410-90a0-b07cc1902cb9
- Loading branch information
Kenzaburo Ito
committed
Jan 25, 2001
1 parent
9f4b4d9
commit f87aaa3
Showing
2 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<? | ||
# Mantis - a php based bugtracking system | ||
# Copyright (C) 2000 Kenzaburo Ito - kenito@300baud.org | ||
# This program is distributed under the terms and conditions of the GPL | ||
# See the README and LICENSE files for details | ||
?> | ||
<? include( "core_API.php" ) ?> | ||
<? | ||
db_connect( $g_hostname, $g_db_username, $g_db_password, $g_database_name ); | ||
|
||
if ( $g_allow_signup == "0" ) { | ||
### need to replace with access error page | ||
header( "Location: $g_logout_page" ); | ||
exit; | ||
} | ||
|
||
$result = 0; | ||
if ( !is_valid_email( $f_email ) ) { | ||
echo $f_email." INVALID"; | ||
exit; | ||
} | ||
|
||
### Check for duplicate username | ||
$query = "SELECT username | ||
FROM $g_mantis_user_table | ||
WHERE username='$f_username'"; | ||
$result = db_query( $query ); | ||
if ( db_num_rows( $result ) > 0 ) { | ||
echo "DUPLICATE ID. CHOOSE ANOTHER USERNAME"; | ||
exit; | ||
} | ||
|
||
### Passed our checks. Insert into DB then send email. | ||
$t_password = create_random_password( $p_email ); | ||
$result = send_new_user_password( $f_username, $f_email, $t_password ); | ||
if ( !$result ) { | ||
echo "PROBLEMS SENDING EMAIL"; | ||
exit; | ||
} | ||
|
||
### create the almost unique string for each user then insert into the table | ||
$t_cookie_string = create_cookie_string( $f_email ); | ||
$t_password = crypt( $t_password ); | ||
$query = "INSERT | ||
INTO $g_mantis_user_table | ||
( id, username, email, password, date_created, last_visit, | ||
access_level, enabled, protected, cookie_string ) | ||
VALUES | ||
( null, '$f_username', '$f_email', '$t_password', NOW(), NOW(), | ||
'reporter', 'on', '', '$t_cookie_string')"; | ||
$result = db_query( $query ); | ||
if ( !$result ) { | ||
echo "Failed to create user account"; | ||
exit; | ||
} | ||
|
||
### Use this for MS SQL: SELECT @@IDENTITY AS 'id' | ||
$query = "select LAST_INSERT_ID()"; | ||
$result = db_query( $query ); | ||
if ( $result ) { | ||
$t_user_id = db_result( $result, 0, 0 ); | ||
} | ||
|
||
### Add profile | ||
$query = "INSERT | ||
INTO $g_mantis_user_profile_table | ||
( id, user_id, platform, os, os_build, description, default_profile ) | ||
VALUES | ||
( null, '$f_user_id', '$f_platform', '$f_os', '$f_os_build', '$f_description', '' )"; | ||
$result = db_query( $query ); | ||
?> | ||
<? print_html_top() ?> | ||
<? print_head_top() ?> | ||
<? print_title( $g_window_title ) ?> | ||
<? print_css( $g_css_include_file ) ?> | ||
<? include( $g_meta_include_file ) ?> | ||
<? print_head_bottom() ?> | ||
<? print_body_top() ?> | ||
<? print_header( $g_page_title ) ?> | ||
|
||
<p> | ||
<div align=center> | ||
<? | ||
### SUCCESS | ||
if ( $result ) { | ||
PRINT "$f_username - $f_email was successfully added.<p>Wait a few minutes and check your email for your password. If you do not respond within a week your account may be deleted."; | ||
} | ||
### FAILURE | ||
else { | ||
PRINT "$s_sql_error_detected <a href=\"<? echo $g_administrator_email ?>\">administrator</a><p>"; | ||
} | ||
?> | ||
<p> | ||
<a href="<? echo $g_login_page ?>"><? echo $s_proceed ?></a> | ||
</div> | ||
|
||
<? print_footer(__FILE__) ?> | ||
<? print_body_bottom() ?> | ||
<? print_html_bottom() ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<? | ||
# Mantis - a php based bugtracking system | ||
# Copyright (C) 2000 Kenzaburo Ito - kenito@300baud.org | ||
# This program is distributed under the terms and conditions of the GPL | ||
# See the README and LICENSE files for details | ||
?> | ||
<? include( "core_API.php" ) ?> | ||
<? print_html_top() ?> | ||
<? print_head_top() ?> | ||
<? print_title( $g_window_title ) ?> | ||
<? print_css( $g_css_include_file ) ?> | ||
<? print_head_bottom() ?> | ||
<? print_body_top() ?> | ||
<? print_header( $g_page_title ) ?> | ||
|
||
<p> | ||
<div align=center> | ||
<? echo $s_signup_info ?> | ||
<p> | ||
<table width=50% bgcolor=<? echo $g_primary_border_color." ".$g_primary_table_tags ?>> | ||
<tr> | ||
<td bgcolor=<? echo $g_white_color ?>> | ||
<table cols=2 width=100%> | ||
<form action="<? echo $g_signup ?>" method=post> | ||
<tr> | ||
<td colspan=2 bgcolor=<? echo $g_table_title_color ?>> | ||
<b><? echo $s_signup_title ?></b> | ||
</td> | ||
</tr> | ||
<tr bgcolor=<? echo $g_primary_color_dark ?>> | ||
<td width=25%> | ||
<? echo $s_username ?>: | ||
</td> | ||
<td width=75%> | ||
<input type=text name=f_username size=32 maxlength=32> | ||
</td> | ||
</tr> | ||
<tr bgcolor=<? echo $g_primary_color_light ?>> | ||
<td> | ||
<? echo $s_email ?>: | ||
</td> | ||
<td> | ||
<input type=text name=f_email size=32 maxlength=64> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td align=center colspan=2> | ||
<input type=submit value="<? echo $s_signup_button ?>"> | ||
</td> | ||
</tr> | ||
</form> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
</div> | ||
|
||
<? print_footer(__FILE__) ?> | ||
<? print_body_bottom() ?> | ||
<? print_html_bottom() ?> |