Hey.
Ik ben bezig met een chatbox alleen ik wil dat als ik: ":alert Nickjexx Stop met spammen"
Doe dat die persoon een alert krijgt. Dat werkt wel handmatig maar als ik dat dus in de chatbox typ insert hij member_id: 0 en geen member_id 1
Ik heb dit:
Hoe krijg ik van gebruikersnaam naar member id?
Tabel: leden
Tabellen: gebruikersnaam, member_id.
Ik ben bezig met een chatbox alleen ik wil dat als ik: ":alert Nickjexx Stop met spammen"
Doe dat die persoon een alert krijgt. Dat werkt wel handmatig maar als ik dat dus in de chatbox typ insert hij member_id: 0 en geen member_id 1
Ik heb dit:
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strstr"]strstr[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]message[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #DD0000]:alert[/COLOR][COLOR= #007700]) &&[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]admin[/COLOR][COLOR= #007700]]){[/COLOR]
[COLOR= #0000BB]$alert[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]:alert [/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]message[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$array[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/explode"]explode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000] [/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$alert[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$user[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$array[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$message[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$array[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$uQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM leden WHERE gebruikersnaam = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$user[/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]$uQuery[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
{[/COLOR]
[COLOR= #0000BB]$ufetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uQuery[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$uservan[/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 gebruikersnaam FROM leden WHERE member_id="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]));[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO alert (alert_id, member_id, reden, gelezen, datum, door) VALUES (
NULL,
"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$ufetch[/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]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$message[/COLOR][COLOR= #007700])).[/COLOR][COLOR= #DD0000]",
Nee,
NOW(),
"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$uservan[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"
);
"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());
}[/COLOR] ?> Hoe krijg ik van gebruikersnaam naar member id?
Tabel: leden
Tabellen: gebruikersnaam, member_id.


