Hij werkt inderdaad (; Thank man.
Desire`s Bug Topic
graag gedaan, en btw ergens in dit topic stond een script en daar stond je URL in...
Dylanh schreef:Klopt, zal ik verwijderen, maar weet je ook hoe ik het volgende doe?graag gedaan, en btw ergens in dit topic stond een script en daar stond je URL in...
Als ik niks invul dat er staat je hebt niks ingevult..
En dat je alleen een link mag toevoegen?
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]url[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je hebt geen URL ingevoerd, je mag alleen URL`s invoeren![/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]();
}[/COLOR]
?> bedoel je?
Dan is het altijd nog if(empty($_POST[url] ofso, maar waar moet ik die toevoegen..
Desire schreef:Dat kan ook...Dan is het altijd nog if(empty($_POST[url] ofso, maar waar moet ik die toevoegen..
ff script voor je kopieren sec.
toevoeging op 29 september 2012, 13
39:[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][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]url[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je hebt geen URL ingevoerd, je mag alleen URL`s invoeren![/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]();
}[/COLOR]
[COLOR= #0000BB]$url[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]url[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$id[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]10000[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]99999[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$shortened[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/base_convert"]base_convert[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$id[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]20[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]36[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]// VERVANG DEZE LIJN HE! [/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"
Uw verkorte url is <a href="http://site/"[/COLOR][COLOR= #007700].[/COLOR] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$shortened[/COLOR][COLOR= #007700]) .[/COLOR][COLOR= #DD0000]"">http://site/"[/COLOR][COLOR= #007700].[/COLOR] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$shortened[/COLOR][COLOR= #007700]) .[/COLOR][COLOR= #DD0000]"</a>
"[/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]De volgende fouten zijn opgetreden:<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Error: "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]() .[/COLOR] [COLOR= #DD0000]" "[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$core[/COLOR][COLOR= #007700]->[/COLOR]weergeef_fouten[COLOR= #007700]();
}
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De volgende fouten zijn opgetreden:<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Error: "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]() .[/COLOR] [COLOR= #DD0000]" "[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$core[/COLOR][COLOR= #007700]->[/COLOR]weergeef_fouten[COLOR= #007700]();
}[/COLOR]
?> Thanks, en als ik nu invoer dan doet hij het ook.
Ik zou even iets testen voor je. Als het werkt post ik het wel ff
Oke.. 

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]function[/COLOR] isValidURL[COLOR= #007700]([/COLOR][COLOR= #0000BB]$url[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/preg_match"]preg_match[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$url[/COLOR][COLOR= #007700]);
}[/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][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]url[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je hebt geen URL ingevoerd, je mag alleen URL`s invoeren![/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]();
}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR]isValidURL[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]url[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Geen geldige URL[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]();
}[/COLOR]
[COLOR= #0000BB]$url[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]url[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$id[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]10000[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]99999[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$shortened[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/base_convert"]base_convert[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$id[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]20[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]36[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO url(id, url,shortened) VALUES ("[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$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]$url[/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]$shortened[/COLOR][COLOR= #007700]) .[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"
Uw verkorte url is <a href="http://site/"[/COLOR][COLOR= #007700].[/COLOR] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$shortened[/COLOR][COLOR= #007700]) .[/COLOR][COLOR= #DD0000]"">http://site/"[/COLOR][COLOR= #007700].[/COLOR] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$shortened[/COLOR][COLOR= #007700]) .[/COLOR][COLOR= #DD0000]"</a>
"[/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]De volgende fouten zijn opgetreden:<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Error: "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]() .[/COLOR] [COLOR= #DD0000]" "[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$core[/COLOR][COLOR= #007700]->[/COLOR]weergeef_fouten[COLOR= #007700]();
}
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De volgende fouten zijn opgetreden:<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Error: "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]() .[/COLOR] [COLOR= #DD0000]" "[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$core[/COLOR][COLOR= #007700]->[/COLOR]weergeef_fouten[COLOR= #007700]();
}
}[/COLOR]
?> toevoeging op 29 september 2012, 13:29:03:
had je trouwens ook op google kunnen vinden.
Ik wist niet waar ik naar moest zoeken, maar bedankt 
