Jump to content

problem php&MySQL UPDATE


arbitter

Recommended Posts

I have a problem with updating my tables. All works fine, if the fields are empty it sais you need to fill in something, if the first field isn't correct with your real password it does not go any further, and if the 2nd and 3rd field don't match, it sais so. The porblem is, that when the first is corresponding to your reall password and the 2nd and 3rd correspong, the table password doesn't get updated...

Any thoughts?

if (isset($_POST['actie'])) {
$oud = $_POST['oud'];
$nieuw = $_POST['nieuw'];
$nieuw2 = $_POST['nieuw2'];	
$oud = strip_tags($oud);
$nieuw = strip_tags($nieuw);
$nieuw2 = strip_tags($nieuw2);
$oud = trim($oud);
$nieuw = trim($nieuw);
$nieuw2 = trim($nieuw2);
$melding = 'Gelieve alle velden in te vullen.';
if(strlen($oud) < 1){echo $melding;}
elseif(strlen($nieuw) < 1){echo $melding;}
elseif(strlen($nieuw2) < 1){echo $melding;}
else{
	$melding = 'Uw wachtwoord moet minimum 3 tekens en maximaal 20 tekens lang zijn.';
	if(strlen($oud) < 3 or strlen($oud) >20){echo $melding;}
	elseif(strlen($nieuw) < 3 or strlen($nieuw) >20){echo $melding;}
	elseif(strlen($nieuw2) < 3 or strlen($nieuw2) >20){echo $melding;}
	else{


		require_once('mysql_connect.inc.php');
		mysql_connect(MYSQL_SERVER, MYSQL_GEBRUIKERSNAAM, MYSQL_WACHTWOORD) or die("Verbinding mislukt: " . mysql_error());
		mysql_query("SELECT * FROM gebruikers WHERE email='$_SESSION[email]'");

		if ($oud != $_SESSION["wachtwoord"]){echo'Paswoord is incorrect. Gelieve deze na te kijken en opnieuw te proberen.';
			include('footer.php');
			exit();}
		else {
			if ($nieuw != $nieuw2){echo 'Nieuwe paswoorden komen niet overeen. Gelieve opnieuw te proberen.';}
			else{
				if ($nieuw == $nieuw2){
					echo 'Paswoorden komen overeen!';
					mysql_query("UPDATE gebruikers SET wachtwoord='$nieuw' WHERE id='$_SESSION[id]'");
					}}}}}

 

(only (i think) the last line is wrong)

 

Yet I have tried to change the apostrophes and stuff.

 

Link to comment
https://forums.phpfreaks.com/topic/191651-problem-phpmysql-update/
Share on other sites

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.