Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-22-2012, 03:42 PM   PM User | #1
0mfg wtf man
New to the CF scene

 
Join Date: Oct 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
0mfg wtf man is an unknown quantity at this point
Exclamation mysql/php password registration form

I'm put a chat on my website that has a login system. I have 3 login systems on my website in which i integrated two of them. I have not integraded the chat with the website so instead im going to have it find the username of the login system of the website and then find a different password called chatpass. This is basically the registration page for the chat once they login to the site on the settings page. They can type a password in and it will save it to a row according to the user in a column. I can care less if it is md5 or not. Can anyone help pls it is not working and i can't figure out what im doing wrong?


passset.php
Code:
<? include "../pg/setup.php";?>
<?php
require ('includes/gen_inc.php');
require 'core.inc.php';
require ('includes/inc_myplayer.php');


//checking to see if the form hass been submitted or clicked
if(isset($_POST['chatpwd'])){
$chatusr =$_POST['userchat'];
$chatpass=$_POST['chatpwd'];

//now converting then to md5 encryption
$chatpass_harsh=md5(strip_tags($chattpass));

if(!empty($chattpass)){
//here we can do alot of checks here, the length allowed, uppercase and lowercase,
//strip slashes and more
//but let just frst achieve our mission of changing password first, now we need to run a query
//we need to check if the new password and comfirmpassword do match

//now after checking to see if the two passwords do match
//we then run our query to get all result from the database
//and if the myslq_num_rows == 1, then the username and password do match
//and we can then reset the password.

$query="SELECT * FROM `players` WHERE `username`='".@mysql_real_escape_string($chatusr)."'"; 
$query_run=mysql_query($query);

$mysql_num_rows=mysql_num_rows($query_run);
if($mysql_num_rows==1){

//now we then run a query to update or reset our password
$query="UPDATE `players` SET `chatpass`='".@mysql_real_escape_string($chatpass_harsh)."' WHERE `username`='".@mysql_real_escape_string($chatusr)."'";

if($query_run==mysql_query($query)){
echo 'You sucessfully set your chat password';
}else{
echo 'There was an error processing your password';
}
}

}else{
echo 'New password and comfirm password do not match';
}

}else{
echo 'All fileds are required';
}
?>
myplayers1.php
http://pastebin.com/YRTwQcVE
I used pastebin because i was limited on how many characters im allowed to use
0mfg wtf man is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:29 PM.


Advertisement
Log in to turn off these ads.