Top
Phpuniverset logo
 
930 banner

INDHOLD

Forside

Script libary

Job annoncer

Tips og Tricks

Konkurrence

Downloads

Dokumenter

Forum

Online udviklere


ARTIKLER

CSS

Diverse

E-handel / annoncer

Grafik

Html

Internet

Javascript

Linux

PHP/MySQL

Programmer

Flash

Søgemaskiner

Windows

C / C++


INFO

Information

Annoncering

Kontakt

Forside Forum PHP, mysql ænder password!

ænder password!


 

ænder password!

Per H  

Hej alle. jeg er ved at lave en chatportal, og man skal kunne ænder sit password, men den
kode jeg har lavet virker ikkke, den kommer ikke med nogen fejl... og den opdater heller
ikke passwordet i databasen, :(

Kode:

<? session_start();
 
    if(
$_GET['opdate'] == 'pass'){
    
            include(
"../../../data/database.php");
                    
$db "SELECT * FROM user WHERE id = '$_SESSION[id]'";
                    
$db_pass mysql_query($db);
                    while (
$hent mysql_fetch_assoc($db_pass)) {
                    
                if(
$_POST['pass'] == ""){
                
                    print 
"Du skal skriv dit gamle kodeord";
                
                } else {
                    
                    if(
md5($_POST['pass']) == $hent['password']){        
                    
                            if(isset(
$_POST['pass'])){
                            
                                if(
$_POST['newpass'] == $_POST['newpass1']){
                                
                                    
$newpass md5($_POST['newpass']);
                                    
                                                            
                                        
$updateSQL "UPDATE user SET password = '$newpass' WHERE `id` LIKE
'
$_SESSION[id]'";
                                        
                                    
                                        
mysql_query($updateSQL);
                                    
                                } else { 
                                    print 
"Du har ikke taste dit nye password rigtigt 2 gang, Om igen :-)";
                                } 
                                
                            } else { 
                            
                                print 
"Not pass<br>";
                                print 
"<a href=\"#\" onClick=\"javascript.histery(-1);\"><-- Tilbage</a>";
                        } 
                    } 
                } 
            } 
        } 
?>

Nogen der kan se fejlen????


//Per H



Dato : 05.05.2006, 19:17

Visninger : 1656

Points : 100

 

Har fået koden til at virke, men fandt ikke ud af hvad der var galt da jeg skrev den
forfra! :)

Kode:

<? session_start();
 
    if(
$_GET['opdate'] == 'pass'){
    
            include(
"../../data/database.php");
                    
$db "SELECT * FROM user WHERE id = '$_SESSION[id]'";
                    
$db_pass mysql_query($db);
                    while (
$hent mysql_fetch_assoc($db_pass)) {
                    
                if(
md5($_POST['pass']) == $hent['password']){        
                    
                        if(isset(
$_POST['pass'])){
                            
                            if(
$_POST['newpass'] == $_POST['newpass1']){
                                
                                
$newpass md5($_POST['newpass']);
                                    
                                                            
                                    
$updateSQL "UPDATE user SET password = '$newpass' WHERE `id` LIKE
'
$_SESSION[id]'";
                                        
                                    
                                    
mysql_query($updateSQL);
                                    
                            } else { 
                                print 
"Du har ikke taste dit nye password rigtigt 2 gang, Om igen :-)";
                            } 
                                
                        } else { 
                            
                            print 
"Not pass<br>";
                            print 
"<a href=\"#\" onClick=\"javascript.histery(-1);\"><-- Tilbage</a>";
                    } 
                } 
            } 
        } 
?>

//Per H


Dato : 05.05.2006, 23:00

Godkendt svar af : Per H  




Login for at skrive et indlg :



   Brugernavn

Password
 

+ Opret en ny Bruger, Klik her

+ Glemt brugernavn/password

 

Send Artikel/anmeldelse til: phpuni@phpuniverset.dk

Tilbage til oversigt

Phpuniverset's politik om personlige oplysninger, artikler & Koder Phpuniverset er optimeret til Mozilla 1024 * 768 Phpuniverset version: 3.0 beta
Webhost : Ignesco.dk

Bund