Getting many syntax errors in my PHP code -


this code. getting errors every time page loads , don't know wrong. if me appreciated.

<?php include ('steamauth/userinfo.php'); $myfile = fopen("userid.txt", "a+") or die("unable open file!");     if( strpos(file_get_contents("/userid.txt"),$_get[$steamprofile['steamid']]) !== false){         fwrite($myfile,$steamprofile['steamid']);}         fclose($myfile)     else( strpos(file_get_contents("/userid.txt"),$_get[$steamprofile['steamid']]) !== true){         fclose($myfile)         echo"<html lang="en-us">              <head>                 <meta charset="utf-8">                 <meta http-equiv="refresh" content="1;url=http://example.com">                 <script type="text/javascript">                      window.location.href = "http://example.com"                 </script>                 <title>page redirection</title>             </head>             <body>             <p>if not redirected automatically, follow <a href="http://example.com">link www.example.com</a></p>             </body>             </html>";} ?> 

here errors:

 [25-apr-2015 09:46:38 australia/perth] php parse error:  syntax error, unexpected '.', expecting ']' in /example.com/userid.php on line 4  [25-apr-2015 09:47:42 australia/perth] php parse error:  syntax error, unexpected '.', expecting ']' in /example.com/userid.php on line 4  [25-apr-2015 09:48:09 australia/perth] php parse error:  syntax error, unexpected '.', expecting ']' in /example.com/userid.php on line 4  [25-apr-2015 09:48:40 australia/perth] php parse error:  syntax error, unexpected '}' in /example.com/userid.php on line 7  [25-apr-2015 09:49:37 australia/perth] php parse error:  syntax error, unexpected '}' in /example.com/userid.php on line 7  [25-apr-2015 09:50:17 australia/perth] php parse error:  syntax error, unexpected t_elseif in /example.com/userid.php on line 7  [25-apr-2015 09:51:06 australia/perth] php parse error:  syntax error, unexpected t_elseif in /example.com/userid.php on line 7  [25-apr-2015 09:53:07 australia/perth] php parse error:  syntax error, unexpected '}' in /example.com/userid.php on line 6  [25-apr-2015 09:55:06 australia/perth] php parse error:  syntax error, unexpected '.' in /example.com/userid.php on line 6  [25-apr-2015 09:55:34 australia/perth] php parse error:  syntax error, unexpected '}' in /example.com/userid.php on line 6  [25-apr-2015 09:56:53 australia/perth] php parse error:  syntax error, unexpected ')' in /example.com/userid.php on line 7  [25-apr-2015 09:57:15 australia/perth] php parse error:  syntax error, unexpected t_string, expecting ',' or ';' in /example.com/userid.php on line 8  [25-apr-2015 09:58:19 australia/perth] php parse error:  syntax error, unexpected t_else in /example.com/userid.php on line 8  [25-apr-2015 09:59:23 australia/perth] php parse error:  syntax error, unexpected t_else in /example.com/userid.php on line 8  [25-apr-2015 10:00:02 australia/perth] php parse error:  syntax error, unexpected t_else in /example.com/userid.php on line 8 

there more (10 mb error log more), these recent , every time change new errors appear.

the code supposed open file (userid.txt) check if file contains steamid if doesn't writes in it, if redirects away.

if have no idea, @ least google search type , name of error - error log give plenty enough information solve error. +1 using error log, -1 not reading , using information gives you.

to give more detail: core of errors you're not writing php correctly, implies don't know php, should doing not running before can crawl , going away , reading php , structure , layout , methods behind language , how intended results code write.

pretty errors down bad syntax, rewrite whole code block , format correctly think it's better go away , read how structure if statements, how use strpos , how open , edit files starting points. read how structure arrays , google search info on how structure multidimensional arrays (as that's syntax fault in code).

and seriously, mean done using error log. many programmers in php merrily things working , ignore learning how detect , collect non-critical errors.

some further pointers specific code:

  • check each instruction ends ;
  • check difference between $_get , $_post, read them in php.net, read these identifiers (they're special).
  • be careful print , echo statements character open (" or ') escaped (ie preceded backslash) if found inside string.
  • check multidimensional arrays structured correctly - $array[0][1] not $array[0[1]]
  • check url files want use correct.
  • eat 5 different pieces of fruit or veg a day

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -