SQLCRUD and login using embedded database

All WYSIWYG Web Builder support issues that are not covered in the forums below.
Forum rules
IMPORTANT NOTE!!

DO YOU HAVE A QUESTION OR PROBLEM AND WANT QUICK HELP?
THEN PLEASE SHARE A "DEMO" PROJECT.



PLEASE READ THE FORUM RULES BEFORE YOU POST:
http://www.wysiwygwebbuilder.com/forum/viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
Post Reply
GeraintR
 
 
Posts: 6
Joined: Thu Jan 09, 2025 4:29 pm
Location: Manchester

SQLCRUD and login using embedded database

Post by GeraintR »

Hi,

Am I correct to assume that I cannot use both SQLCRUD and a 'Protect page' extension on the same page without amending the system generated code? I have created a database to be accessed by a small number of members, and I'm using an embedded database to control access. I have a separate login page that directs these members to the database input screens, but when I put a 'Protect page' extension onto the same page as an SQLCRUD extension, I get the system generated message:

"Notice: session_start(): Ignoring session_start() because a session is already active (started from /homepages/34/d472519093/htdocs/cawos/testform/Projects.php on line 7)....."

I've done some coding in the past (not php!), and I'm happy to learn to amend the code to prevent a new session being created when a user goes to one of the database input screens, but I don't want to do this if there's a simpler answer, or if amending the code is unlikely to work.

Regards,

Geraint
User avatar
wwonderfull
 
 
Posts: 1555
Joined: Fri Aug 21, 2020 8:27 am
Contact:

Re: SQLCRUD and login using embedded database

Post by wwonderfull »

That error generally refers when for example you have 2 php codes where on both code session_start(): has been used so server tries to ignore the duplication as it already started. Maybe you can go to the converted form and remove it, or you can also remove it after the files are published and then try.
WWBman
 
 
Posts: 909
Joined: Fri Jan 08, 2010 6:10 pm

Re: SQLCRUD and login using embedded database

Post by WWBman »

This is a NOTICE error which indicates a minor error in PHP that does not halt script execution.
You can suppress this by adding the following code at the start of the page.
Use the Page HTML option then add it to the Start of Page section.

<?php
error_reporting(E_ALL & ~E_NOTICE);
?>
User avatar
Pablo
 
Posts: 23222
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: SQLCRUD and login using embedded database

Post by Pablo »

The extension generates its own code so it's not aware of other code on the page.
Therefor it may cause conflicts with other scripts.

As a workaround this may work:

Site Properties -> User Defined Variables -> Add
Name:

Code: Select all

session_start();
Value:

Code: Select all

if (session_id() == "") session_start();
GeraintR
 
 
Posts: 6
Joined: Thu Jan 09, 2025 4:29 pm
Location: Manchester

Re: SQLCRUD and login using embedded database

Post by GeraintR »

Thanks for the suggestions, I went with WWbman and added the code to turn off NOTICES. It didn't work, but I assume that's because the auto-generated code (shown below) that I didn't include in my original post has a line that presumably overrides it by setting error_reporting to E_ALL. I don't expect people to teach me php coding, but I assume that I can just remove this line, or amend it on the server to make the '~E_NOTICE' 'change suggested by WWbman. I will have to do this for several pages.

Pablo, I didn't understand where I could make the change you suggested relating to 'Site Properties'.

Regards,

Geraint

<?php
error_reporting(E_ALL & ~E_NOTICE);
?><?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if (session_id() == "")
{
session_start();
}
require_once("wb.mysql.crud.php");
session_start();
if (!isset($_SESSION['username']))
{
$_SESSION['referrer'] = $_SERVER['REQUEST_URI'];
header('Location: ./Failed-login.php');
exit;
}
if
User avatar
Pablo
 
Posts: 23222
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: SQLCRUD and login using embedded database

Post by Pablo »

Image
GeraintR
 
 
Posts: 6
Joined: Thu Jan 09, 2025 4:29 pm
Location: Manchester

Re: SQLCRUD and login using embedded database

Post by GeraintR »

Thanks Pablo, works perfectly, and gives me an insight into how I can resolve these php conflict problems in the future

Geraint
Post Reply