Mhari Posted May 20, 2016 Share Posted May 20, 2016 Hello,can anybody explain what's the meaning of"Parse error: syntax error, unexpected end of file in /home/user/public_html/file.php on line..."thanks in advance Quote Link to comment Share on other sites More sharing options...
wolstech Posted May 20, 2016 Share Posted May 20, 2016 The code is broken. That error usually means you're missing a closing symbol somewhere. likely a missing } or ) symbol. Make sure you have a matching ) or } for every ( or { in your code. A missing semicolon on the last line can also cause it. Quote Link to comment Share on other sites More sharing options...
Mhari Posted May 20, 2016 Author Share Posted May 20, 2016 Okay thank you! I still cannot fix it sir,,i have checked it many times and i think it looks correct but php still show the error..Here is my code http://gthom.ga/h.phpplease help.. Thanks, Quote Link to comment Share on other sites More sharing options...
wolstech Posted May 20, 2016 Share Posted May 20, 2016 Your very first if statement has no closing } : if (isset($_POST['btn'])) { You need to add one to close that if statement. Quote Link to comment Share on other sites More sharing options...
Mhari Posted May 20, 2016 Author Share Posted May 20, 2016 Wow thank you so mu wolstech, it is working now Quote Link to comment Share on other sites More sharing options...
Mhari Posted May 24, 2016 Author Share Posted May 24, 2016 Hi,why i cannot use header fuction? It's always show an error? Am i did wrong?This is the error,Warning: Cannot modify header information - headers already sent by (output started at /home1/mhr2/public_html/system/fnc.php:52) in /home1/mhr2/public_html/profile.php on line 3please help me Quote Link to comment Share on other sites More sharing options...
wolstech Posted May 24, 2016 Share Posted May 24, 2016 Headers must be sent before any output (text, HTML, even an error) is sent. Once you send some type of content, you cannot use the header function. Whatever is on line 52 of fnc.php sent some form of output. I'd expect to find either an echo statement, part of the page body or an include that points such, or a broken line of code that's producing an error. You need to make sure your header function is called before that line of code runs, otherwise normal HTTP headers are automatically sent along with the output. Quote Link to comment Share on other sites More sharing options...
Mhari Posted May 25, 2016 Author Share Posted May 25, 2016 Ok i will check Ok i will check it. Thanks Quote Link to comment Share on other sites More sharing options...
Mhari Posted May 25, 2016 Author Share Posted May 25, 2016 Hi, what about this sir?Warning: preg_match() [ function.preg-match]: Compilation failed: range out of order in character class at offset 13 in /home1/mhr2/public_html/system/signup.php on line 26i just want to validating input form.Help me please Quote Link to comment Share on other sites More sharing options...
wolstech Posted May 25, 2016 Share Posted May 25, 2016 It means your regular expression is incorrect. Can you post that line of code so I can see the expression in question? Quote Link to comment Share on other sites More sharing options...
Mhari Posted May 25, 2016 Author Share Posted May 25, 2016 Ok.. I have knew what the cause of. The cause is that after i am extracting my file, it's changed to other expression. I dont know why.Now the issue is that i want to restrict users to inputing characters such as [(#...etc. But i always failed.. can you help me please, to restrict the users to do it and just _ and - that allowed? Quote Link to comment Share on other sites More sharing options...
wolstech Posted May 25, 2016 Share Posted May 25, 2016 If you want to only allow a single - or _ symbol as the input, use an IF statement instead. There is no "range" for symbols in a regexp, and you'll probably have to escape a bunch of them with a \ since some are modifiers in regexps. Regexps really are most useful when doing complex searches/pattern matching or when you need to accept large ranges like a-z or 0-9, as opposed to a few allowed characters. An IF like this would be easier if a single - or _ should be the only thing allowed: <?php if ($input = "_" || $input = "-") { //Do something } else { //Error message } ?> Quote Link to comment Share on other sites More sharing options...
Mhari Posted May 26, 2016 Author Share Posted May 26, 2016 No. I mean symbols is only - and _ that allowed. And support numeric, letters (uppercase lowercase) also.I am it for validating nick name.Here is the lineif (!empty($nick) && preg_match("/^([a-zA-Z0-9\ _\-] )*$/", $nick))but i thing it is correct, but still not work.What is wrong? Quote Link to comment Share on other sites More sharing options...
wolstech Posted May 26, 2016 Share Posted May 26, 2016 The start of line and end of line are not required. Also, it's easier to check for the presence of bad characters as opposed to making sure they're all good. <?php $nick = "TEST33%"; if (!empty($nick) && preg_match("/([^a-zA-Z\d_-])/", $nick)) { echo "Invalid characters"; } else { echo " It's good. "; } /* Produces output: Invalid Characters */ Change the first line to a valid name and it will produce "It's good" instead. Quote Link to comment Share on other sites More sharing options...
Mhari Posted May 26, 2016 Author Share Posted May 26, 2016 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.