Aarclay schreef:Waar zou ik dat moeten zetten? Bij de echo?$splitnaam[1][0]
Probeer dit eens
Kleine Vragen Topic #2
Sanderc schreef:Ipv die substrProbeer dit eensEerdere citaten tonen
Aarclay schreef:$splitnaam[1][0]
Waar zou ik dat moeten zetten? Bij de echo?
Huh, en kan je uitleggen waarom?
Want ik leer er ook graag van
Want ik leer er ook graag van

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]
?> Bedankt.
Hier heb je heel mijn scriptje
Is het correct? Het werkt allesinds, maar of het correct is weet ik niet;
Hier heb je heel mijn scriptje

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]
?> Antonn schreef:Je moest in de functie wel een returntje gebruiken ipv echo.Dit soort dingen kan je ook erg mooi met reguliere expressies oplossen.Eerdere citaten tonen
Rogier schreef:[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] ?>
Heel goed punt, ik had het eerst als gen functie geschreven vandara dat foutje.
Rogier schreef:
[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?
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...
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
http://jbnfcommunity.net/profiel.php
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
Je hebt een div in een H1 tag? Als ik die H1 tag weghaal werkt t gewoon hoor.
( Als ik kijk met chrome inspecteren)
( Als ik kijk met chrome inspecteren)
Oohja, vergeten af te sluiten
.
Ik had zojuist nog een tal problemen, lag allemaal daar aan. Thanks
.Ik had zojuist nog een tal problemen, lag allemaal daar aan. Thanks
Ik krijg steeds de foutmelding bij mij inlog systeem, (ER KLOPT IETS NIET AAN UW GEGEVENS)
met deze code:
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]
?> Weet iemand een api of een script waarmee je meerdere domeinnamen kan checken?
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.
Rik schreef:Kijk eens naar de documentatie van isset, en vooral wat voor waarde het teruggeeft.met deze code:Eerdere citaten tonen
Desire schreef:Ik krijg steeds de foutmelding bij mij inlog systeem, (ER KLOPT IETS NIET AAN UW GEGEVENS)[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] ?>
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
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.
Je moet die isset dus nog buiten de query afhandelen. Als je ECHT de documentatie had doorgelezen had je dit kunnen weten.

