Jump to content

help with config and email


hcns

Recommended Posts

hi all im making A world of warcraft make an account page and i have been trying to do 2 thing one make a config file with the mysql use name and passwords so any users can just put thir info in and use the line include 'config.php'; to add it to the page 

 

And the other thing is make it so when a user add thir E mail it has to be one of the following  msn hotmail yahoo and some others.

 

i have tryed to do the include config.php and it just dose not connect to the database at all but when i put the database info in the main page it dose.

 

this is the 2 pages i have

 

config.php

<?

$config['mysql_host'] = '******'; 	// MySql Hostname / IP
$config['mysql_user'] = '******'; 				// MySql Username
$config['mysql_pass'] = '******'; 			//  MySql Password
$config['mysql_dbname'] = '******'; 		// Database Name

?>

 

create_an_account1.php

<?php

error_reporting(E_ALL ^ E_NOTICE);

session_start();

$msg = Array();
$error = Array();

include 'config.php';
function addUser(){
if (empty($_POST)) return false;
    global $config, $msg, $error;

    if (empty($_POST['login'])) $error[] = 'Error, you forgot to enter a account name!';

    if (empty($_POST['password'][0]) || empty($_POST['password'][1])) $error[] = 'Error, you forgot to enter a password!';
    if ($_POST['password'][0] !== $_POST['password'][1]) $error[] = 'Password does not match!';

if (empty($_POST['Email'])) $error[] = 'Error, you forgot to enter a Email Address!';
    if (!empty($error)) return false;

    $db = @mysql_connect($config['mysql_host'], $config['mysql_user'], $config['mysql_pass']);
    if (!$db) return $error[] = 'Database Error: The Connection to the host has been lost.'.mysql_error();
    if (!@mysql_select_db($config['mysql_dbname'], $db)) return $error[] = 'Database: '.mysql_error();


    $query = "SELECT `acct` FROM `accounts` WHERE `login` = '".mysql_real_escape_string($_POST['login'])."'";
    $res = mysql_query($query, $db);
    if (!$res) return $error[] = 'Database Error: The Account Name input failed to send or write to the database.'.mysql_error();
    if (mysql_num_rows($res) > 0) return $error[] = 'Account name already exists';

$query = "SELECT `acct` FROM `accounts` WHERE `email` = '".mysql_real_escape_string($_POST['Email'])."'";
    $res = mysql_query($query, $db);
    if (!$res) return $error[] = 'Database Error: The e-mail input failed to send or write to the database.'.mysql_error();
    if (mysql_num_rows($res) > 0) return $error[] = 'E-Mail already exists';


$type = intval($_POST['flags']);
;
$query = "INSERT INTO `accounts` (`login`,`password`,`gm`,`flags`,`lastip`,`email`) VALUES ('".mysql_real_escape_string($_POST['login'])."', '".mysql_real_escape_string($_POST['password'][0])."','0','".mysql_real_escape_string($_POST['flags'])."', '".$_SERVER['REMOTE_ADDR']."','".mysql_real_escape_string($_POST['Email'])."')";
    $res = mysql_query($query, $db);

    if (!$res) return $error[] = 'Database ohh Dear i thing a monkey brock it.'.mysql_error();
    $msg[] = 'The Account <strong>'.htmlentities($_POST['login']).'</strong> has been created. Thanks!';
    mysql_close($db);
    return true;
}
{
addUser();
}
?>

<HTML>
<HEAD>



<TITLE>Create An Account</TITLE>
<style type="text/css">
<!--
.style2 {	color: #A20101;
font-weight: bold;
}
input {
    font-family: Tahoma;
    text-align: center;
    padding: 2px;
}
input.button {
font-family: Verdana;
font-size: 12px;
padding: 2px 25px;
}
div.error {
    border: 2px solid #FF0000;
    background-color: #f48987;
    padding: 4px;
color: #000000
}
div.msg {
    background-color: #9fd5b5;
    padding: 4px;
    border: 2px solid #00b159;
color: #000000
}
-->
</style>

</HEAD>
<BODY>
<map name="mainmap">
<color="#FFFFFF"><area shape="rect" coords="141,114,372,143" href="/sightings">
<area shape="rect" coords="141,154,372,183" href="/coolest">
<area shape="rect" coords="0,0,460,266" nohref></color>
</map>
<u><h2 align="left"><font><center>
</center></h2></u>

<br>
<DIV align=center>
<DIV style="WIDTH: 95%" align=left>
<FIELDSET><LEGEND><LABEL>Create An Account</LABEL></LEGEND> 
    <DIV style="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; PADDING-TOP: 3px">
                <p>Welcome to warzoneclan on this page you can make a account to play on the wzc world of warcraft servers.<br/>
                To make an account enter your new account information down blow in the empty box.<br/>
The Account Name Can Be 16 Characters Long.<br />
The Password can be up to 24 characters long useing uper and lower case letters and numbers for E.G <span class="style2">FxgGH3s832d</span><br/>
Enter your e-mail adress the box below so the server can send you mail or so you can change your password.<br/>
Select the game type that you run on your system. Eg   Non-Burning Crusade is Normal wow and 
    Burning Crusade is the expansion pack.
    <br>
                <table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><?php
if (!empty($error)){
    echo '<div class="error">';
    foreach($error as $text)
        echo $text.'<br/>';
    echo '</div>';
};
if (!empty($msg)){
    echo '<div class="msg">';
    foreach($msg as $text)
        echo $text.'<br/>';
    echo '</div>';
    exit('</body></html>');
};
?></td>
  </tr>
</table>
                <br/>
  <div id="formaccount" align="center">
      <form action="modules.php?name=Murloc&file=create_an_account" method="post" class="accform">
        <p><span class="heading">Account Name: </span><br />
            <input type="text" name="login" class="usernameform" maxlength="16" />
            <br />
            <br />
            <span class="heading">Password:</span><br />
          <input type="password" name="password[]" class="passwordform" maxlength="24"  />
          <br />
	  <br />
	  <span class="heading">Confirm Password:</span><br />
          <input type="password" name="password[]" class="passwordform" maxlength="24"  />
          <br />
          <br />
          <span class="heading">E-Mail Address:</span><br />
          <input type="text" name="Email" class="emailform" />
          <br />
          <br />
          <span class="heading">Game Type: </span><br />
          <select name="flags" class="gametypeform">
            <option value="8" selected="selected">Burning Crusade</option>
            <option value="0">Non-Burning Crusade</option>
          </select>
          <br />
          <br />
          <input type="submit" value="Submit" name="submit" />
        </p>
        </form>
      <br>
    </div>
                </DIV>
    </FIELDSET></DIV></DIV>

<DIV>
<DIV></DIV>
<DIV></DIV></DIV>
<center><br>
</center>
</BODY></HTML>

 

other then that i dontknow what to do to make it work if anyone knows what to do i love to here it

Link to comment
https://forums.phpfreaks.com/topic/72293-help-with-config-and-email/
Share on other sites

hi all im making A world of warcraft make an account page and i have been trying to do 2 thing one make a config file with the mysql use name and passwords so any users can just put thir info in and use the line include 'config.php'; to add it to the page 

 

And the other thing is make it so when a user add thir E mail it has to be one of the following  msn hotmail yahoo and some others.

 

i have tryed to do the include config.php and it just dose not connect to the database at all but when i put the database info in the main page it dose.

 

I don't understand what you mean? you mean you are trying to make a "Registration Page" ? or something else.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.