This repository has been archived on 2023-09-19. You can view files and clone it, but cannot push or open issues or pull requests.
AcmlmboardZero/register.php

121 lines
7.2 KiB
PHP

<?php
require("function.php");
require("layout.php");
if($loguserid){
print "
$header
<br>
<table border=0 bgcolor=$tableborder width=$tablewidth align=center cellpadding=0 cellspacing=0>
<td>
<table border=0 cellpadding=2 cellspacing=1 width=100% bgcolor=$tableborder>
";
print "$tccell1"."You are already logged in!";
print "<br>Click <a href=index.php>here</a> to return to the board.";
die();
}
$users=mysqli_query($con,"SELECT * FROM users");
$tccellha="<td bgcolor=$tableheadbg";
$tccellhb="><center>$fonthead";
print $header;
if ($_POST[action]=="") {
print "$fonttag <br><center><marquee height=50 direction=down behavior=alternate>Warning! As of right now, passwords are stored in <b>unencrypted</b> cookies when you login!</marquee></center>
<table border=0 bgcolor=$tableborder width=$tablewidth align=center cellpadding=0 cellspacing=0>
<td>
<table border=0 cellpadding=2 cellspacing=1 width=100% bgcolor=$tableborder>
<FORM ACTION=\"register.php\" NAME=\"REPLIER\" METHOD=\"POST\">
";
$sexlist="<INPUT type=radio name=\"sex\" value=0> Male&nbsp;&nbsp;&nbsp;";
$sexlist.="<INPUT type=radio name=\"sex\" value=1> Female&nbsp;&nbsp;&nbsp;";
$sexlist.="<INPUT type=radio name=\"sex\" value=2 checked=1> N/A&nbsp;&nbsp;&nbsp;";
$regtable="$tccellha $tccellhb"."&nbsp;</font></td>";
$regtable.="$tccellh"."&nbsp;</td><tr>";
$regtable.="$tccell1"."<b>User name:</b>$smallfont<br></center>&nbsp;The name you want to use on the board.</td>";
$regtable.="$tccell2"."</center><INPUT TYPE=TEXT NAME=\"username\" VALUE=\"\" SIZE=25 MAXLENGTH=25></td><tr>";
$regtable.="$tccell1"."<b>Password:</b>$smallfont<br></center>&nbsp;You can change your password by entering a new one here.</td>";
$regtable.="$tccell2"."</center><INPUT TYPE=PASSWORD NAME=\"password\" VALUE=\"\" SIZE=13 MAXLENGTH=13></td><tr>";
$regtable.="$tccell1"."<b>Sex:</b>$smallfont<br></center>&nbsp;Male or female ... (or N/A if you don't want to tell it)</td>";
$regtable.="$tccell2"."</center>$sexlist</td><tr>";
$regtable.="$tccell1"."<b>User picture:</b>$smallfont<br></center>&nbsp;The full URL of the image showing up below your username in posts. Leave it blank if you don't want to use a picture. The picture is resized to 60 in width.</td>";
$regtable.="$tccell2"."</center><INPUT TYPE=TEXT NAME=\"picture\" VALUE=\"\" SIZE=60 MAXLENGTH=100></td><tr>";
$regtable.="$tccell1"."<b>Email address:</b>$smallfont<br></center>&nbsp;This is only shown in your profile; you don't have to enter it if you don't want to.</td>";
$regtable.="$tccell2"."</center><INPUT TYPE=TEXT NAME=\"email\" VALUE=\"\" SIZE=60 MAXLENGTH=60></td><tr>";
$regtable.="$tccell1"."<b>Homepage Name:</b>$smallfont<br></center>&nbsp;Your homepage name, if you have one.</td>";
$regtable.="$tccell2"."</center><INPUT TYPE=TEXT NAME=\"homepagename\" SIZE=60 MAXLENGTH=80></td><tr>";
$regtable.="$tccell1"."<b>Homepage:</b>$smallfont<br></center>&nbsp;Your homepage URL, if you have one.</td>";
$regtable.="$tccell2"."</center><INPUT TYPE=TEXT NAME=\"homepage\" VALUE=\"\" SIZE=60 MAXLENGTH=80></td><tr>";
$regtable.="$tccell1"."<b>ICQ number:</b>$smallfont<br></center>&nbsp;Your ICQ number, if you have one.</td>";
$regtable.="$tccell2"."</center><INPUT TYPE=NUMBER NAME=\"icq\" VALUE=\"\" SIZE=10 MAXLENGTH=10></td><tr>";
$regtable.="$tccell1"."<b>Post Header:</b>$smallfont<br></center>&nbsp;This will get added at the beginning of each post you make.</td>";
$regtable.="$tccell2"."</center><TEXTAREA NAME=\"postheader\" ROWS=5 COLS=60 WRAP=VIRTUAL></TEXTAREA></td><tr>";
$regtable.="$tccell1"."<b>Signature:</b>$smallfont<br></center>&nbsp;This will get added at the end of each post you make, below an horizontal line. This should preferably kept to a small enough size.</td>";
$regtable.="$tccell2"."</center><TEXTAREA NAME=\"signature\" ROWS=5 COLS=60 WRAP=VIRTUAL></TEXTAREA></td><tr>";
$regtable.="$tccell1"."<b>Bio:</b>$smallfont<br></center>&nbsp;Some information about yourself, showing up in your profile.</td>";
$regtable.="$tccell2"."</center><TEXTAREA NAME=\"bio\" ROWS=5 COLS=60 WRAP=VIRTUAL></TEXTAREA></td><tr>";
$regtable.="$tccell1"."<b>Timezone offset:</b>$smallfont<br></center>&nbsp;How many hours you're offset from the time on the board (".date("m-d-y h:i A",time()).").</td>";
$regtable.="$tccell2"."</center><INPUT TYPE=TEXT NAME=\"timezone\" VALUE=\"0\" SIZE=5 MAXLENGTH=5></td><tr>";
$regtable.="$tccell1"."<b>Posts per page:</b>$smallfont<br></center>&nbsp;The maximum number of posts you want to be shown in a page in threads.</td>";
$regtable.="$tccell2"."</center><INPUT TYPE=NUMBER NAME=\"postsperpage\" VALUE=\"20\" SIZE=5 MAXLENGTH=5></td><tr>";
$regtable.="$tccell1"."&nbsp;</td>";
$regtable.="$tccell2"."</center>
<INPUT TYPE=HIDDEN NAME=\"action\" VALUE=\"register\">
<INPUT TYPE=Submit NAME=\"submit\" VALUE=\"Register account\"></td></FORM>";
print "$regtable
</table></td></table><center><marquee height=50 direction=down behavior=alternate>Warning! As of right now, passwords are stored in <b>unencrypted</b> cookies when you login!</marquee></center>
";
}
if ($_POST[action]=="register") {
$username=substr($_POST[username],0,25);
print "
<table border=0 bgcolor=$tableborder width=$tablewidth align=center cellpadding=0 cellspacing=0>
<td>
<table border=0 cellpadding=2 cellspacing=1 width=100% bgcolor=$tableborder>
";
//Check if user exists
$checkexists=mysqli_fetch_array(mysqli_query($con,"SELECT name FROM users WHERE name='$username'"));
if ($_POST[password]!="" and $username!="" and $checkexists == false) {
$signature=str_replace("
","<br>",$_POST[signature]);
$postheader=str_replace("
","<br>",$_POST[postheader]);
$bio=str_replace("
","<br>",$_POST[bio]);
$password=password_hash("$_POST[password]", PASSWORD_DEFAULT);
$date=time();
$sql = "INSERT INTO users (name, regdate, password, sex, picture, timezone, postsperpage, email, icq, signature, bio, homepageurl, homepagename, postheader ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
if($stmt = mysqli_prepare($con, $sql)){
mysqli_stmt_bind_param($stmt,"ssssssssssssss", $username, $date, $password, $_POST[sex], $_POST[picture], $_POST[timezone], $_POST[postsperpage], $_POST[email], $_POST[icq], $signature, $bio, $_POST[homepage], $_POST[homepagename], $postheader) or mysqli_error($con);
mysqli_stmt_execute($stmt) or mysqli_error($con);
}
//Bad
////$prepare = mysqli_stmt_init($con);
//$prepare = mysqli_prepare($con,);
//mysqli_stmt_bind_param($prepare,"ssssssssssss", $username, $date, $password, $_POST[sex], $_POST[picture], $_GET[timezone], $_POST[postsperpage], $_POST[email], $_POST[icq], $signature, $bio, $_POST[homepage]);
//mysqli_stmt_execute($prepare);
print "$tccell1"."Thank you, $_POST[username], for registering your account.
Click <a href=index.php>here</a> to return to the board.
</table></td></table>
";
} else {
print "$tccell1"."Couldn't register the account. Either you didn't put an username or password, or the";
print "username you tried to register is already used.";
print "<br>Click <a href=index.php>here</a> to return to the board.";
}
}
print $footer;
?>