Kleine Vragen Topic #2

Gestart doorKingunit3.067 reacties11.764 weergaven

3.068 berichten · pagina 46 van 205

Berichten
11.263
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
$splitnaam[1][0]
Probeer dit eens wink
Waar zou ik dat moeten zetten? Bij de echo?
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Sanderc schreef:
Eerdere citaten tonen
Aarclay schreef:
$splitnaam[1][0]
Probeer dit eens wink
Waar zou ik dat moeten zetten? Bij de echo?
Ipv die substr
0
Berichten
11.263
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Huh, en kan je uitleggen waarom?

Want ik leer er ook graag van smile
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Stiekem heeft iemand van PHP bedacht dat een string ook al array te benaderen is, om steeds de letters per stuk op te halen:

[COLOR= #0000BB]<?php
$string[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"One2xs"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$string[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]];[/COLOR] [COLOR= #FF8000]// geeft O[/COLOR]
?>
0
Berichten
11.263
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Bedankt.
Hier heb je heel mijn scriptje biggrin
Is het correct? Het werkt allesinds, maar of het correct is weet ik niet;

[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700])
{[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](![/COLOR][URL="http://www.php.net/stristr"]stristr[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #DD0000]" "[/COLOR][COLOR= #007700]))
    {[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]];
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
        [COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]];[/COLOR]
        [COLOR= #0000BB]$naamex[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/explode"]explode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]" "[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$naam[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$name[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$naamex[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]];[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$naamex[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$name[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"."[/COLOR][COLOR= #007700];
    }
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
?>
<form action="#" method="post">
    <input type="text" name="name"><br/>
    <input type="submit" value="Klik">
</form>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
?>
0
Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Antonn schreef:
Eerdere citaten tonen
Rogier schreef:
Dit soort dingen kan je ook erg mooi met reguliere expressies oplossen.

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]function[/COLOR] shortSurname[COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/COLOR][COLOR= #007700]) {[/COLOR]

    [COLOR= #0000BB]$regex[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]/[a-zA-Z]* [a-zA-Z]{1}/[/COLOR][COLOR= #007700];[/COLOR]
    [COLOR= #FF8000]// $regex = /[A-Z]{1}[a-z]*  [A-Z]{1}/;[/COLOR]
    
    [URL="http://www.php.net/preg_match"]preg_match[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$regex[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$name[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$matches[/COLOR][COLOR= #007700]);[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$matches[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000].[/COLOR][COLOR= #007700];
}[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] shortSurname[COLOR= #007700]([/COLOR][COLOR= #DD0000]Rogier Fischer[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]// Rogier F.[/COLOR]
?>

Je moest in de functie wel een returntje gebruiken ipv echo.

Heel goed punt, ik had het eerst als gen functie geschreven vandara dat foutje.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Rogier schreef:
@sanders:

Dit soort dingen kan je ook erg mooi met reguliere expressies oplossen.
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]function[/COLOR] shortSurname[COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/COLOR][COLOR= #007700]) {[/COLOR]

    [COLOR= #0000BB]$regex[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]/[a-zA-Z]* [a-zA-Z]{1}/[/COLOR][COLOR= #007700];[/COLOR]
    [COLOR= #FF8000]// $regex = /[A-Z]{1}[a-z]*  [A-Z]{1}/;[/COLOR]
    
    [URL="http://www.php.net/preg_match"]preg_match[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$regex[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$name[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$matches[/COLOR][COLOR= #007700]);[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$matches[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000].[/COLOR][COLOR= #007700];
}[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] shortSurname[COLOR= #007700]([/COLOR][COLOR= #DD0000]Rogier Fischer[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]// Rogier F.[/COLOR]
?>


Maar wat als je Jan van Dalen heet?
0
Berichten
11.263
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Weet iemand nog een vrij profecioneel, maar langs de andere kant toch wat mooi lettertype?

toevoeging op 26 mei 2013, 11:53:12:
Maar waarom werkt dit nu weer niet...

#melding{
            background:#FFEEEE;
            border:1px solid #CC0000;
            padding-top:5px;
            padding-bottom:5px;
            width:100%;
        }


<div id="melding">Momenteel is aanmelden niet mogelijk</div>


De div blijft gewoon ongestijld;

http://prntscr.com/16q6ep

http://jbnfcommunity.net/

toevoeging op 26 mei 2013, 12:05:08:
En waarom gaat dit niet rechts staan? omg

<html>
<head>
        <style>
            body{
                font-family: sans-serif;
                margin:0;
            }
            #menu{
                background:#444444;
                width:100%;
                height:60px;
                margin:0;
            }
            #menu .logi{
                float:right;
                color:#EEE;
                font-size:12px;
                line-height:50px;
                height:50px;
            }
            #menu .containe{
                width:977px;
                height:auto;
                margin:0 auto;
            }
            #menu h1{
                font-size:30px;
                color:#DDD;
                font-weight: 200;
                line-height:10px;
                float:left;
            }
            #menu strong{
                font-weight:bold;
                color:#fff;
            }
            .logilink{
            cursor:pointer;
            text-decoration:none;
            color:#CCC;
        }
        </style>
</head>
<body>
<div id="menu">
    <div class="containe">
        <h1>Zask.be<strong> Justin Bieber</strong><h1>
        <div class="logi"><a href="#" class="logilink">Ingelogd als Sander</a></div>
    </div>
</div>
</body>
</html>


<div class="logi"><a href="#" class="logilink">Ingelogd als Sander</a></div>


http://jbnfcommunity.net/profiel.php
0
Berichten
473
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je hebt een div in een H1 tag? Als ik die H1 tag weghaal werkt t gewoon hoor.
( Als ik kijk met chrome inspecteren)
0
Berichten
11.263
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Oohja, vergeten af te sluiten emo.

Ik had zojuist nog een tal problemen, lag allemaal daar aan. Thanks
0
Berichten
4.367
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik krijg steeds de foutmelding bij mij inlog systeem, (ER KLOPT IETS NIET AAN UW GEGEVENS)

met deze code:

[COLOR= #0000BB]<?php

    $aQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT id,  naam, wachtwoord, status FROM leden WHERE 
                            naam = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR]htmlentities[COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]))).[/COLOR][COLOR= #DD0000]" AND
                            wachtwoord = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]))).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$aFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aQuery[/COLOR][COLOR= #007700]);[/COLOR]
?>
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Weet iemand een api of een script waarmee je meerdere domeinnamen kan checken?
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Desire schreef:
Ik krijg steeds de foutmelding bij mij inlog systeem, (ER KLOPT IETS NIET AAN UW GEGEVENS)

met deze code:
[COLOR= #0000BB]<?php

    $aQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT id,  naam, wachtwoord, status FROM leden WHERE 
                            naam = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR]htmlentities[COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]))).[/COLOR][COLOR= #DD0000]" AND
                            wachtwoord = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]))).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$aFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aQuery[/COLOR][COLOR= #007700]);[/COLOR]
?>


Kijk eens naar de documentatie van isset, en vooral wat voor waarde het teruggeeft.
0
Berichten
4.367
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rik schreef:
Eerdere citaten tonen
Desire schreef:
Ik krijg steeds de foutmelding bij mij inlog systeem, (ER KLOPT IETS NIET AAN UW GEGEVENS)
met deze code:

[COLOR= #0000BB]<?php

    $aQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT id,  naam, wachtwoord, status FROM leden WHERE 
                            naam = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR]htmlentities[COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]))).[/COLOR][COLOR= #DD0000]" AND
                            wachtwoord = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]))).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$aFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aQuery[/COLOR][COLOR= #007700]);[/COLOR]
?>

Kijk eens naar de documentatie van isset, en vooral wat voor waarde het teruggeeft.

Dat heb ik gedaan maar daar kan ik niks in terug vinden..

toevoeging op 26 mei 2013, 15:56:09:
Alleen dit werkt weer wel:

[COLOR= #0000BB]<?php
    $naam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$wachtwoord[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$aQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT id,  naam, wachtwoord, status FROM leden WHERE 
                            naam = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR]htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$naam[/COLOR][COLOR= #007700])).[/COLOR][COLOR= #DD0000]" AND
                            wachtwoord = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$wachtwoord[/COLOR][COLOR= #007700])).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$aFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aQuery[/COLOR][COLOR= #007700]);[/COLOR]
?>


Met deze fouten:

Quote:
Notice: Undefined index: naam in // on line 11

Notice: Undefined index: wachtwoord in // on line 12
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
isset geeft true / false terug. Dus je probeert te kijken of er een gebruiker is met de naam true (of false) en het wachtwoord true (of false).

Je moet die isset dus nog buiten de query afhandelen. Als je ECHT de documentatie had doorgelezen had je dit kunnen weten. pompom
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