Kleine Vragen Topic #1

Gestart doorLennard4.284 reacties15.585 weergaven

4.285 berichten · pagina 181 van 286

Lennard

Lid · Topicstarter

Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Jep, dat moet je niet doen.

Je kan toch alle activiteiten ophalen van die dag (of maand, net hoe je agenda eruit ziet) en dan met mysql_num_rows checken hoeveel dat er zijn?
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Aarclay schreef:
Dan is er ook geen output, en is het niets meer dan logisch dat je een blanco scherm ziet.
Ja, maar meestal word in dan direct door gestuurd naar inlog.php en nu blijf ik op een witte pagina staan als ik Adblocker aan heb.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Heb je geen voorbeeld? Want dit is behoorlijk glazen bollen
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Natuurlijk:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/require"]require[/URL] [COLOR= #DD0000]"config.php"[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #0000BB]$bans_sel[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM bans"[/COLOR][COLOR= #007700]));[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]) &&[/COLOR] [URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]) &&[/COLOR] [URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]login_time[/COLOR][COLOR= #007700]])){[/COLOR] 
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]login_time[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]true[/COLOR][COLOR= #007700]) {[/COLOR]
    [COLOR= #0000BB]$session_time[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]604800[/COLOR][COLOR= #007700];

}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [COLOR= #0000BB]$session_time[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]86400[/COLOR][COLOR= #007700];
}[/COLOR]

[COLOR= #0000BB]$bans_sel[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM bans"[/COLOR][COLOR= #007700]));[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$bans_sel[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]value[/COLOR][COLOR= #007700]] ===[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]) {[/COLOR]
    [COLOR= #0000BB]$ban_da[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM bans WHERE value = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]" LIMIT 1"[/COLOR][COLOR= #007700]));[/COLOR]
    [URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Location: index?error=Je bent verbannen! Rede(n): [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$ban_da[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]reason[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]. Verloopt op: [/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"d-m-Y H:i:s"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$ban_da[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]expire[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700]);
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT aantal_fout FROM users WHERE username = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])) >=[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700]) {[/COLOR]
[COLOR= #FF8000]//     echo "SELECT aantal_fout FROM users WHERE username = ".mysql_real_escape_string($_GET[username])."";[/COLOR]
    
        [COLOR= #0000BB]$k_public[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]-[/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$privatekey[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]-[/COLOR][COLOR= #007700];[/COLOR]
        
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]hidden[/COLOR][COLOR= #007700]]) &&[/COLOR] [URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"recaptcha_challenge_field"[/COLOR][COLOR= #007700]])){[/COLOR]
                [COLOR= #0000BB]$resp[/COLOR] [COLOR= #007700]=[/COLOR] recaptcha_check_answer[COLOR= #007700]([/COLOR][COLOR= #0000BB]$privatekey[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"REMOTE_ADDR"[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"recaptcha_challenge_field"[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"recaptcha_response_field"[/COLOR][COLOR= #007700]]);[/COLOR]
                [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$resp[/COLOR][COLOR= #007700]->[/COLOR]is_valid[COLOR= #007700]) {[/COLOR]
                    
                    [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE users SET aantal_fout = 0 WHERE username = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
                    
                    [URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Location: index?error=Je kan weer inloggen! Ben je je wachtwoord vergeten? Klik dan op "Wachtwoord vergeten?"[/COLOR][COLOR= #007700]);
                    
                    
                }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
                    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Fout, probeer het nogmaals.[/COLOR][COLOR= #007700];
                }
            }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    ?>
    Je hebt je wachtwoord te vaak fout ingetypt. Vul de veiligheidscheck goed in, en je aantal keren fout word vergeven.
        <form action="" id="captcha-form" method="post">
        <script type="text/javascript"
        src="http://www.google.com/recaptcha/api/challenge?k=[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$k_public[/COLOR][COLOR= #007700];[/COLOR] ?>">
        </script>
        <noscript>
        <iframe src="http://www.google.com/recaptcha/api/noscript?k=[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$k_public[/COLOR][COLOR= #007700];[/COLOR] ?>"
        height="300" width="500" frameborder="0"></iframe><br>
        <textarea name="recaptcha_challenge_field" rows="3" cols="40">
        </textarea>
        <input type="hidden" name="recaptcha_response_field"
        value="manual_challenge">
        </noscript>
        <input type="hidden" name="hidden" value="hidden"/>
        <input type="hidden" id="avatarFigure" name="figure" value=""/>
        </form>
    [COLOR= #0000BB]<?php[/COLOR]
            [COLOR= #007700]}[/COLOR]
    [URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]();
    }[/COLOR]    
    
    
[COLOR= #0000BB]$selectleden[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM users WHERE username = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]" AND password = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selectleden[/COLOR][COLOR= #007700])) {[/COLOR]
        [COLOR= #FF8000]// Ingelogd[/COLOR]
        
        [COLOR= #0000BB]$hash[/COLOR] [COLOR= #007700]=[/COLOR] CookieHash[COLOR= #007700]([/COLOR][URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]().[/COLOR][URL="http://www.php.net/time"]time[/URL][COLOR= #007700]());[/COLOR]
        [COLOR= #0000BB]$get_id[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT id FROM users WHERE username = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]" AND password = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$fetch_id[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$get_id[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$insert_session[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO sessions (id, userid, hash, ip, logintime) VALUES (,"[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fetch_id[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$hash[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]" ,NOW())"[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]userid[/COLOR][COLOR= #007700]] =[/COLOR] xssafe[COLOR= #007700]([/COLOR][COLOR= #0000BB]$fetch_id[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]);[/COLOR]
        [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]] =[/COLOR] xssafe[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]);[/COLOR]
    [COLOR= #FF8000]// for debugging:
        #$bericht = "Ingelogd met hash: ".$hash." En je hebt id-nummer:".$fetch_id[id];[/COLOR]
        
        
        [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$insert_session[/COLOR][COLOR= #007700]) {[/COLOR]
            [URL="http://www.php.net/setcookie"]setcookie[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"id"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$fetch_id[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]],[/COLOR] [URL="http://www.php.net/time"]time[/URL][COLOR= #007700]()+[/COLOR][COLOR= #0000BB]$session_time[/COLOR][COLOR= #007700]);[/COLOR]
            [URL="http://www.php.net/setcookie"]setcookie[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"hash"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$hash[/COLOR][COLOR= #007700],[/COLOR] [URL="http://www.php.net/time"]time[/URL][COLOR= #007700]()+[/COLOR][COLOR= #0000BB]$session_time[/COLOR][COLOR= #007700]);[/COLOR]
            [URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]location:ingelogd.php[/COLOR][COLOR= #007700]);
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Fout in de query: "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();[/COLOR]
            [URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]();
        }
        }[/COLOR]  [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
         [COLOR= #FF8000]//Foute pass[/COLOR]
         
         [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE users SET aantal_fout = aantal_fout + 1 WHERE username = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
         
        [URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Location: index?error=Je log in gegevens kloppen niet![/COLOR][COLOR= #007700]);
    }
    
}    
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Location: index[/COLOR][COLOR= #007700]);
}[/COLOR]



    ?>
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Lennard schreef:
Jep, dat moet je niet doen.

Je kan toch alle activiteiten ophalen van die dag (of maand, net hoe je agenda eruit ziet) en dan met mysql_num_rows checken hoeveel dat er zijn?
Alleen het probleem is dat ik alle activiteiten in 1x ophaal..

Misschien kan ik een array maken met beschrijving + datum en dan een foreach doen?
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Milan schreef:
Eerdere citaten tonen
Lennard schreef:
Jep, dat moet je niet doen.
Je kan toch alle activiteiten ophalen van die dag (of maand, net hoe je agenda eruit ziet) en dan met mysql_num_rows checken hoeveel dat er zijn?

Alleen het probleem is dat ik alle activiteiten in 1x ophaal..

Misschien kan ik een array maken met beschrijving + datum en dan een foreach doen?
Dan kan toch ook met mysql_fetch_assoc() en while()?
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Maar dan moet ik voor elke datum, dat werkt niet zo handig.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Dylanh schreef:
Natuurlijk:

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]//knip[/COLOR]
    ?>
Tastbaar voorbeeld?
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Aarclay schreef:
Eerdere citaten tonen
Dylanh schreef:
Natuurlijk:
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]//knip[/COLOR]
    ?>

Tastbaar voorbeeld?

Tot zo ver houd mijn Nederlands op. Wat bedoel je met tastbaar?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Dylanh schreef:
Eerdere citaten tonen
Aarclay schreef:
Eerdere citaten tonen
Dylanh schreef:
Natuurlijk:
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]//knip[/COLOR]
    ?>

Tastbaar voorbeeld?
Tot zo ver houd mijn Nederlands op. Wat bedoel je met tastbaar?

Zucht.....
Spoiler tonen
0
Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik wil in jquery de functie preg_match gebruiken, aan gezien die niet bestaad vond ik iets als:
replace() Maar mijn code wilt het helaas niet doen.

Code:

<form>
        <input id="start" type="text" name="title" />
        <input id="end" type="text" name="slug" />
    </form>
    

<script type="text/javascript">
$(document).ready(function(e) {
    
    $(input).attr(name, title).change(function() {
        var strSlug = "";
        strSlug = $(input).attr(name, title).val();
        strSlug = strSlug.str.replace("!", "");
        strSlug = strSlug.str.replace("?", "");
        strSlug = strSlug.str.replace(".", "");
        strSlug = strSlug.str.replace(",", "");
        strSlug = strSlug.str.replace(" ", "-");
        $(input).attr(name, slug).val(strSlug);
    });
    
});
    
</script>


Hij zegt dat: strSlug niet is gedifend maar ik heb hem toch wel gedifend ??
OF wat heb ik fout?

Alvast bedankt!

Probleem 1 opgelost, de "str." moest weg. Alleen als ik nu de spatie vervang dan vervangt hij alleen de eerste, hoe los ik dat op?

Voor regel 17 gebruik ik nu:

var strSlug = strSlug.replace(/^[ ]+$/, "-");


Maar dat doet hij ook niet.
0
Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
var strSlug = strSlug.replace(/s+/g, -);


Denk ik. Die G maakt het globaal en zou dus voor elke spatie moeten worden uitgevoerd.
0
Berichten
88
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Freestyle schreef:
Ik wil in jquery de functie preg_match gebruiken, aan gezien die niet bestaad vond ik iets als:
replace()
Maar dat doet hij ook niet.

Die bestaat toch gewoon? .match
0
Marv

Lid

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
42,8571428571

heb nu dit getal, wil dat hij gewoon afrond op een heel getal, hoe doe ik dit? smile
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren