RP Name Check for PHP. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: RP Name Check for PHP. (
/showthread.php?tid=398880)
RP Name Check for PHP. -
Элиот - 11.12.2012
Hello.
I know that this section is meant to problems with SA-MP but actually this is related to SA-MP. : D
There are dozens of smart people who can help me, I know it.
Alright. I need a advice how to create a Role Play name check in PHP registration. I'm not familiar with PHP, that's why I'm asking this here.
Re: RP Name Check for PHP. -
Luis- - 11.12.2012
It is not related to Pawn if it is PHP. This isn't a PHP scripting discussion board.
Re: RP Name Check for PHP. -
Lz - 11.12.2012
Php help forum - ****** search
Re: RP Name Check for PHP. -
ReVo_ - 11.12.2012
This check if a "_" is in the name
PHP код:
<?
$name = "HelloWorld";
$pos = strpos($name, "_");
if ($pos === false)
{
echo "no:(";
}
else echo "yes";
?>
Re: RP Name Check for PHP. -
Элиот - 11.12.2012
Quote:
Originally Posted by ReVo_
This check if a "_" is in the name
PHP код:
<?
$name = "HelloWorld";
$pos = strpos($name, "_");
if ($pos === false)
{
echo "no:(";
}
else echo "yes";
?>
|
Thank you.
Re: RP Name Check for PHP. -
BrandyPenguin - 11.12.2012
Quote:
Originally Posted by ReVo_
This check if a "_" is in the name
PHP код:
<?
$name = "HelloWorld";
$pos = strpos($name, "_");
if ($pos === false)
{
echo "no:(";
}
else echo "yes";
?>
|
Not the best practice, try HelloWorld_
Better code (Untested)
PHP код:
<?php
$sName = "SomeName_YouWantCheck"
$aName = explode('_', $sName);
if(count($aName) < 2 || strlen($aName[0]) < 1 || strlen($aName[1]) < 1)
{
echo 'You not enter RP name';
}
else
{
echo 'You entered RP name';
}
?>