to call a function: pnModURL()
pnModURL('joinproject', 'user', 'main')
to redirect a page: pnRedirect()
pnRedirect(pnModURL('joinproject', 'admin', 'main'));
PN uses ADODB library for SQL and below one can find the most basic pieces of code needed:
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$projectstable = $pntable['joinproject_projects'];
$result1=$dbconn->Execute("SELECT * FROM $projectstable");
PN has an internal system to manage exceptions ("system" and "user") and it is at your interest to use it.
PN has a very elaborated system to manage permissions (see online manual). For this reason, there is an API function and it is better to be called in the very beginning of every function in order to avoid security holes:
if (!pnSecAuthAction(0, 'joinproject::', '::', ACCESS_ADMIN)) {
$output->Text(_TEMPLATENOAUTH);
return $output->GetOutput(); }
There are several levels of access (according to official doc):
ACCESS_NONE No access
ACCESS_OVERVIEW Allowed to get an overview of the content
ACCESS_READ Allowed to read the content
ACCESS_COMMENT Allowed to comment on the content
ACCESS_MODERATE Allowed to moderate the content
ACCESS_EDIT Allowed to edit the content
ACCESS_ADD Allowed to add content
ACCESS_DELETE Allowed to delete content
ACCESS_ADMIN Full access
NEVER use "echo" or "print", instead use "pnHTML" methods that will take care of the HTML tags (and thus guarantee clean, correct and compliant HTML).
There are many methods for all kinds of HTML elements, some are listed below:
$output = new pnHTML();
$output->Start();
$output->End();
$output->TableStart();
$output->TableEnd();
$output->TableAddRow();
$output->Text();
$output->Title();
$output->BoldText();
$output->FormStart();
$output->FormEnd();
$output->FormText();
$output->FormTextArea();
$output->FormHidden();
$output->FormList();
$output->FormSubmit();
$output->PrintPage();
$output->setInputMode();
$output->setOutputMode();
$output->Redirect();
$output->LineBreak();
$output->URL();
return $output->GetOutput();