collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 635
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: syntax error  (Read 6387 times)

0 Members and 1 Guest are viewing this topic.

Offline willemjan

  • Semi Newbie
  • *
  • Posts: 41
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
syntax error
« on: December 23, 2010, 10:22:33 AM »
I get an syntax error trying to add this code:

Code: [Select]
// Include all the output functions
require_once('fns.php');

// populate input fields into the session using a sub-array
// check http://www.scriptygoddess.com/archives/2007/05/28/how-to-use-session-cookies-in-php/
// also check the above link for remembering checkboxes values
$_SESSION['myForm'] = $_POST;
if (isset($_POST['submitted']) && ('true' == $_POST['submitted'])) {
// checks if the form is submitted and then processes it
    process_form();

} else {
// else prints the form
    print_form();
}

Why is that?

Offline grafitus

  • Comrade
  • *
  • Posts: 1554
  • Gender: Male
  • just looking for own old energy
  • SMF Version: None
  • SP Version: None
Re: syntax error
« Reply #1 on: January 06, 2011, 02:48:52 PM »
Do you get line number of the error?
my modsI don't reply support PMs. Please use support forums.

Offline willemjan

  • Semi Newbie
  • *
  • Posts: 41
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: syntax error
« Reply #2 on: January 06, 2011, 05:11:47 PM »
Nope, just an syntax error. The preview shows fine!

Got an idea?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: syntax error
« Reply #3 on: January 13, 2011, 11:56:20 AM »
That's always frustrating.
Try again, starting with a blank block, and adding only one line at a time.
 
You might also like to fiddle with the setting "Disable PHP validation" (http://simpleportal.net/index.php?action=docs;area=general_settings). It might help you get a better error message.
 
I can't see your syntax error, but that doesn't mean anything.  I would bet it has trouble including the file.
You may need to give it a directory.  See how this is done in SSI.php, and in may files in the Sources directory.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline willemjan

  • Semi Newbie
  • *
  • Posts: 41
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: syntax error
« Reply #4 on: January 14, 2011, 04:41:05 AM »
Well thats odd.. By disabeling the validation, it does work. It even functions the way it should!

There is an strange error in the log BTW. It is produced by the page... Maybe that will help us to get an hold of where the syntax error comes from:

Code: [Select]
8: Use of undefined constant ’PHP_SELF’ - assumed '’PHP_SELF’'

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: syntax error
« Reply #5 on: January 14, 2011, 08:41:43 AM »
That's a clue to search the web for information about php_self.
http://php.net/manual/en/reserved.variables.php#48860
 
PHP_SELF is not a standard php constant.
Your problem is in the block or page containing PHP_SELF.
 
 
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline willemjan

  • Semi Newbie
  • *
  • Posts: 41
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: syntax error
« Reply #6 on: January 14, 2011, 10:11:23 AM »
I found that piece in the page that gets included:
Code: [Select]
<form method="post" action="<?php echo $_SERVER[’PHP_SELF’];?>" id="uploadform" enctype="multipart/form-data">

Are those ’ codes right? I've never seen them before in any php code. It could be that there has been an conversion problem...

Offline grafitus

  • Comrade
  • *
  • Posts: 1554
  • Gender: Male
  • just looking for own old energy
  • SMF Version: None
  • SP Version: None
Re: syntax error
« Reply #7 on: January 16, 2011, 09:45:30 AM »
"’" should be "'" (an apostrophe).
my modsI don't reply support PMs. Please use support forums.

Offline willemjan

  • Semi Newbie
  • *
  • Posts: 41
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: syntax error
« Reply #8 on: January 18, 2011, 08:38:58 AM »
I tried changing it. I tried ' and ", but both don't work... After I canged it, the whole function doesn't work anymore. Very odd...

I guess the simpleportal pages don't support PHP_SELF?
« Last Edit: January 18, 2011, 08:43:09 AM by willemjan »

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: syntax error
« Reply #9 on: January 18, 2011, 09:26:36 AM »
This is not a SimplePortal issue. This is a server issue.
Your server may not support PHP_SELF. I don't know, but you can check.
 
Code: (find) [Select]
<form method="post" action="<?php echo $_SERVER[’PHP_SELF’];?>" id="uploadform" enctype="multipart/form-data">
Code: (replace) [Select]
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>" id="uploadform" enctype="multipart/form-data">
 
Use the php_version and php_info commands to find out what your server does support.
 
That's a clue to search the web for information about php_self.
http://php.net/manual/en/reserved.variables.php#48860
 
PHP_SELF is not a standard php constant.
Your problem is in the block or page containing PHP_SELF.


 
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline willemjan

  • Semi Newbie
  • *
  • Posts: 41
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: syntax error
« Reply #10 on: January 18, 2011, 09:44:01 AM »
by using the PHP info command:

_SERVER["PHP_SELF"] /info.php

Wich means the command itself does work.

No it's not an simpleportal question. Thats why I added it in custom coding ;)

After pushing the submit button I get redirected to index.php, instead of the page it should load.

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: syntax error
« Reply #11 on: January 18, 2011, 10:57:42 AM »
In your custom php block, add this line of php
Code: [Select]
echo 'when you push the submit button, you will go to ', $SERVER['PHP_SELF'], '<br/>';
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline willemjan

  • Semi Newbie
  • *
  • Posts: 41
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: syntax error
« Reply #12 on: January 19, 2011, 03:47:36 AM »
This gives an empty output for the PHP_SELF function:

Quote
when you push the submit button, you will go to

Edit:

I get this in my errorlog:
Quote
8: Undefined variable: SERVER
« Last Edit: January 19, 2011, 05:04:17 AM by willemjan »

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: syntax error
« Reply #13 on: January 19, 2011, 07:30:33 AM »
Sorry for my typo. This should be
Code: [Select]
echo 'when you push the submit button, you will go to ', $_SERVER['PHP_SELF'], '<br/>';
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline willemjan

  • Semi Newbie
  • *
  • Posts: 41
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: syntax error
« Reply #14 on: January 19, 2011, 07:42:00 AM »
That worked:

when you push the submit button, you will go to /index.php

Edit: I found the original code of the script I used (not modified), and there it is the same code as in this post:
I found that piece in the page that gets included:
Code: [Select]
<form method="post" action="<?php echo $_SERVER[’PHP_SELF’];?>" id="uploadform" enctype="multipart/form-data">

Are those ’ codes right? I've never seen them before in any php code. It could be that there has been an conversion problem...
« Last Edit: January 19, 2011, 07:56:30 AM by willemjan »

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: syntax error
« Reply #15 on: January 19, 2011, 09:22:50 AM »
It should be $_Server['PHP_SELF']
 
However -- for putting it in your custom block I am not sure PHP_SELF is correct.
 
When you push the button -- it does not go to the correct place.
 
So just have a look at WHERE that URL is telling the form to go to.
 
You may wish to use one of the other URL variables.  One that gives the full and complete URL of where you wish to go when you push the button.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline willemjan

  • Semi Newbie
  • *
  • Posts: 41
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: syntax error
« Reply #16 on: January 19, 2011, 09:30:45 AM »
I could do an work-around. After I press submit, I want the form to stay on the same page. I used an SP page for this. Normally you would do something like: action="your-page.php". What should I do now?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: syntax error
« Reply #17 on: January 19, 2011, 09:49:18 AM »
Exactly. You need to tell it which page.
Code: [Select]
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"  id="uploadform" enctype="multipart/form-data">
the problem with PHP_SELF is it doesn't have the whole query string that defines where you actually are in SMF.
 
So what you probably want, instead of PHP_SELF, is $_SERVER['REQUEST_URL'], which SMF does its best to fix up correctly.  function cleanRequest in QueryString does this.
Code: [Select]
<form method="post" action="<?php echo $_SERVER['REQUEST_URL'];?>"  id="uploadform" enctype="multipart/form-data">
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline willemjan

  • Semi Newbie
  • *
  • Posts: 41
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: syntax error
« Reply #18 on: January 19, 2011, 09:56:40 AM »
Thank you very much! That did it!!  ;D