Jump to content

gkjr1

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by gkjr1

  1. Cool. That's one down, now I suppose I need to search for other API.
  2. If this is a dup, I'm really sorry. I've searched and searched and couldn't find this anywhere. I was hoping someone could steer me in the right direction. I'm wondering how guild host sites, like guildlaunch, get data from games like Aion and wow. Is it something with curl? I know one site used to get data for Aion is aionarmory.com, but I was just wondering if someone could give me a rough explanation on how (stuff like guilds, characters,items,descriptions,etc from the game).
  3. <?php if (isset($_POST['submitted'])) { //This allows just alpha characters and must be at least 2 characters. if (preg_match('/^[a-zA-Z0-9]{2,}$/',$_POST['fname'])) { $fname = mysql_real_escape_string($_POST['fname']); } else { $error[] = 'Please enter a valid first name!'; } //This allows just alpha characters and must be at least 2 characters. if (preg_match('/^[a-zA-Z0-9]{2,}$/',$_POST['lname'])) { $lname = mysql_real_escape_string($_POST['lname']); } else { $error[] = 'Please enter a valid last name!'; } //This allows just alphanumeric characters and must be 4 - 15 characters. if (preg_match('/^[a-zA-Z0-9]{4,15}$/',$_POST['uname'])) { $uname = $_POST['uname']; } else { $error[] = 'Please enter a valid user name!'; } //check email if (preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/",$_POST['email'])) { $email = mysql_real_escape_string($_POST['email']); }else{ $error[] = 'Please enter a valid email!'; } //This allows just alphanumeric characters and must be 6-15 characters. if ($_POST['password1'] == $_POST['password2']) { if (preg_match('/^[a-zA-Z0-9]{6,15}$/',$_POST['password1'])) { $lastpass = md5($_POST['password1']); } else { $error[] = 'Please enter a valid password!'; } } else { $error[] = 'Passwords do not match!'; } //This allows just alpha characters and must be at least 2 characters. if (preg_match('/^[0-9]{0,11}$/',$_POST['phone'])) { $phone = mysql_real_escape_string($_POST['phone']); } else { $error[] = 'Please enter a valid phone number!'; } echo $lname .",". $fname .",". $uname .",". $email .",". $lastpass .",". $phone; } Even then throws the code. Please help someone its been hours of me trying to find the problem...
  4. I was actually using just functions. I also cannot find my php.ini file on my host anywhere. May not have access, can't I just upload my own php.ini in my root?
  5. I'm just getting back into coding after over a year of not doing it. Don't even remember where to check.
  6. I have no idea why it's doing it. I know I'm missing something, but everything looks right to me. When you submit the registration form it just does the error, and properties say its the process page, so this code below. Sorry posting it all, I'm just not sure period. <?php require('connect.php'); //check all the posted info function getInfo() { $error = array(); $fname = validateFirstname($_POST['fname']); $lname = validateLastname($_POST['lname']); $uname = validateUsername($_POST['uname']); $email = validateEmail($_POST['email']); $password = validatePass($_POST['password1'], $_POST['password2']); $phone = validatePhone($_POST['phone']); //check for errors error(); } function validateFirstname($str) { //This allows just alpha characters and must be at least 2 characters. if (preg_match('/^[a-zA-Z0-9]{2,}$/',$str)) { return preg_match('/^[a-zA-Z0-9]{2,}$/',$str); } else { $error[] = 'Please enter a valid first name!'; } } function validateLastname($str) { //This allows just alpha characters and must be at least 2 characters. if (preg_match('/^[a-zA-Z0-9]{2,}$/',$str)) { return mysql_real_escape_string($str); } else { $error[] = 'Please enter a valid last name!'; } } function validateUsername($str) { //connect to database $link = mysql_connect($db_host, $db_user, $db_pass); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db($db_name); //pull usernames to make sure new is unique $sql = "SELECT username FROM users WHERE username = '".$str."'"; if ($sql == "") { //This allows just alphanumeric characters and must be 4 - 15 characters. if (preg_match('/^[a-zA-Z0-9]{4,15}$/',$str)) { return mysql_real_escape_string($str); } else { $error[] = 'Please enter a valid user name!'; } } else { $error[] = 'This user name is already registered!'; } } function validateEmail($str) { //connect to database $link = mysql_connect($db_host, $db_user, $db_pass); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db($db_name); //pull usernames to make sure new is unique $sql = "SELECT email FROM users WHERE email = '".$str."'"; if ($sql == "") { if (preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/",$str)) { return mysql_real_escape_string($str); }else{ $error[] = 'Please enter a valid email!'; } } else { $error[] = 'This email is already registered!'; } } function validatePass($str, $str2) { //This allows just alphanumeric characters and must be 6-15 characters. if ($str == $str2) { if (preg_match('/^[a-zA-Z0-9]{6,15}$/',$str)) { return md5(mysql_real_escape_string($str)); } else { $error[] = 'Please enter a valid password!'; } } else { $error[] = 'Passwords do not match!'; } } function validatePhone($str) { //This allows just alpha characters and must be at least 2 characters. if (preg_match('/^[0-9]{0,11}$/',$str)) { return mysql_real_escape_string($str); } else { $error[] = 'Please enter a valid phone number!'; } } function error() { if ($error[] == '') { addInfo(); } else { echo "<a href='javascript: history.go(-1)'><-- Go Back</a><br>"; echo $error[]; } } function addInfo() { //setcookie("site_user", $Name, time() + 31536000, "/"); //setcookie("site_pass", $Password, time() + 31536000, "/"); //Connect to database from here $link = mysql_connect($db_host, $db_user, $db_pass); if (!$link) { die('Could not connect: ' . mysql_error()); } //activation link $a = md5(uniqid(rand(), true)); //select the database | Change the name of database from here mysql_select_db($db_name); $sql="INSERT INTO users (firstname,lastname,email,username,password,phone,active,ip,rank,acctcreated) VALUES ('$fname','$lname','$uname',$email','$lastpass','$phone',$a','$ip','$rank',NOW())"; } // Send the email: $message = " To activate your account, please click on this link:\n\n"; $message .= WEBSITE_URL . '/activate.php?email=' . urlencode($Email) . "&key=$activation"; mail($Email, 'Registration Confirmation', $message, 'From:'.EMAIL); // Flush the buffered output. // Finish the page: echo '<div class="success">Thank you for registering! A confirmation email has been sent to ' . $Email .' Please click on the Activation Link to Activate your account </div>'; ?>
×
×
  • 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.