diff options
| author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-03-31 20:53:08 +0000 |
|---|---|---|
| committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-03-31 20:53:08 +0000 |
| commit | b2380300ff8557bd2317742903d5bc147fa09e69 (patch) | |
| tree | b3a3d984800f4da469877789bde083c28918bbd3 /data/mysql/Register.php | |
| parent | 2404bb74c59c46c1252764ec9bf1dbc46a399471 (diff) | |
Added a small example webpage that can be used to register nicknames online via SQL
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2852 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'data/mysql/Register.php')
| -rw-r--r-- | data/mysql/Register.php | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/data/mysql/Register.php b/data/mysql/Register.php new file mode 100644 index 000000000..2506a6153 --- /dev/null +++ b/data/mysql/Register.php @@ -0,0 +1,59 @@ +<?php +/* + * (C) 2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for furhter details. + * + * + * + */ + +/* This is an example functional webpage showing how to use Anopes MySQL + * Execute feature to register a nickname online + */ + +/* Include Anope's PHP API */ +include('Anope.php'); + +function IsValidEmail($Email) +{ + return eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $Email); +} + +if (!empty($_POST['nick']) && !empty($_POST['password1']) && !empty($_POST['password2']) && !empty($_POST['email'])) +{ + if ($_POST['password1'] != $_POST['password2']) + { + echo 'Passwords do not match'; + } + else if (!IsValidEmail($_POST['email'])) + { + echo 'Invalid email address'; + } + else + { + /* Create a new connection, arguments are hostname, username, password, and database name */ + $Anope = new Anope("localhost", "anope", "anoperules", "anope"); + /* Check if we connected */ + if (!$Anope->Connected()) + { + echo "Error connecting to MySQL database"; + } + else + { + echo $Anope->Register($_POST['nick'], $_POST['password1'], $_POST['email']); + } + die; + } +} +?> +</br> +<form method="post" action="Register.php"> +Nick: <input type="text" name="nick"></br> +Password: <input type="password" name="password1"></br> +Confirm Password: <input type="password" name="password2"></br> +Email: <input type="text" name="email"></br> +<input type="submit" value="Submit"> +</form> + |
