A small puzzling Error message about 'user'

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
User avatar
donjohnson24
 
 
Posts: 127
Joined: Thu Sep 27, 2012 9:32 pm
Location: Bridgwater, Somerset, UK
Contact:

A small puzzling Error message about 'user'

Post by donjohnson24 »

I created my website some versions ago of WWB, and with my advanced years have trouble remembering what I did - and have done since.
I only this evening noticed a tiny message at the top of my Home page donjohnson24.co.uk which states:
Notice: Undefined variable: user in /home/zo4j7dtqd36t/public_html/index.php on line 35
It appears to be associated with an insert that detects if the site is being accessed from my computer, and if so - or is a revisit by someone else - does NOT update the Visitor counter.
I changed the Ident Name in the Counter Extension from what I originally set as DON, to Don3 - my current login name, but the error persists.
I'm hampered by the fact that as the lines are not numbered when I view the html, as I cannot find a match between 'user' and line 35 ??

This is a trivial problem, but I know that when I was more 'with it' I enjoyed solving queries like this, so I hope someone younger might take pity on my plight and help me remove my error message.

The first part of the html is here: - spaced just as I see it when I view it using Edit in WinSCP

<?php



$revisit = "No";



//check if first visit

if(isset($_COOKIE["first"]))

{

$revisit = "Yes" ;

$play = " " ;

}

else

{

$cookie_name = "first";

$cookie_value = "XX";

setcookie($cookie_name, $cookie_value);

$play = "autoplay" ;

}



//check if MY computer

$cookie_name = "DONCHECK";

if(isset($_COOKIE[$cookie_name]))

{

$user = $_COOKIE[$cookie_name];

}





// get the visit count, and update if first visit and NOT on my computer

$file = fopen("Counter.txt", 'r');

$data = fread($file, filesize("Counter.txt"));

fclose($file);

if ($data !== false)

{

$hits = intval($data);



if ($user != "Don3" && $revisit != "Yes")

{

$hits++;

$file = fopen("Counter.txt", 'w');

flock($file, LOCK_EX);

fwrite($file, $hits);

flock($file, LOCK_UN);

fclose($file);

}



}

?>

<!doctype html>

<html>

<head>

<title>Don Johnson's Personal Website</title>
User avatar
jerryco
 
 
Posts: 896
Joined: Fri Mar 27, 2009 2:42 pm
Location: Purmerend, Holland

Re: A small puzzling Error message about 'user'

Post by jerryco »

Can't help you sorry but what a resource your site is!

https://www.donjohnson24.co.uk/projects.html

Made in retirement? Kids can learn from this!!
// Love is the acceptance of nothing / Account age is no guarantee of efficiency ;-) ->

Above, Beyond, and @wwonderfull! <- Genuinely helps you with a powered up site that counts! Four Times Excellence!
User avatar
donjohnson24
 
 
Posts: 127
Joined: Thu Sep 27, 2012 9:32 pm
Location: Bridgwater, Somerset, UK
Contact:

Re: A small puzzling Error message about 'user'

Post by donjohnson24 »

Thanks for the kind words, jerryco - I soldered the components to assemble my first computer - UK101 - in the early 70's, and have forgotten most of everything about programs such as BASIC, machine code for 6502 and Z80, c, Visual Basic, COBOL, unix and Informix, though my first actual programming was done on a Burroughs machine which used perforated tapes and punched cards. Despite 30-odd years of that stuff, I still struggle with smartphones :roll:
User avatar
Pablo
 
Posts: 23229
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: A small puzzling Error message about 'user'

Post by Pablo »

Typically, we do not provide support for custom code. However, in this instance, it appears that you just need to define the $user variable.

Code: Select all

$cookie_name = "DONCHECK";
$user  = "";
if(isset($_COOKIE[$cookie_name]))
{
   $user = $_COOKIE[$cookie_name];
}
User avatar
jerryco
 
 
Posts: 896
Joined: Fri Mar 27, 2009 2:42 pm
Location: Purmerend, Holland

Re: A small puzzling Error message about 'user'

Post by jerryco »

I don't want to go too far off topic, but maybe Sir, you are simply overwhelmed at how much ease happens at a single button press. I was raised in DOS using multiple floppies to get one game together in a directory. Now I can simply press "Search for updates" on my phone and it's all done in the background. Maybe you should not be afraid that so much happens without your interaction, approval or consent. It is what it is!
// Love is the acceptance of nothing / Account age is no guarantee of efficiency ;-) ->

Above, Beyond, and @wwonderfull! <- Genuinely helps you with a powered up site that counts! Four Times Excellence!
User avatar
donjohnson24
 
 
Posts: 127
Joined: Thu Sep 27, 2012 9:32 pm
Location: Bridgwater, Somerset, UK
Contact:

Re: A small puzzling Error message about 'user'

Post by donjohnson24 »

Pablo wrote: Wed Jun 12, 2024 6:00 am Typically, we do not provide support for custom code. However, in this instance, it appears that you just need to define the $user variable.

Code: Select all

$cookie_name = "DONCHECK";
$user  = "";
if(isset($_COOKIE[$cookie_name]))
{
   $user = $_COOKIE[$cookie_name];
}
I do understand about custom code, but you have kindly given me the answer, which is to amend the html that I previously inserted, but I cannot see how to access it in WWB. I can change the generated html on the website itself, but that is overwritten if I update the page from WWB. I can view Page/Page HTML to see the custom code in place, but I just can't find it to edit it. Your continued help would be much appreciated.

Later ....
Well I couldn't get to the suggested place to insert $user = " " in Page HTML, only as the first characters.
So I inserted this:
<?php
$user = " ";
//
to give
<?php
$user = " ";
//<?php

$revisit = "No"; . . . . . . .

Which does the trick, but I'm sure is not the correct way.
But thanks for your help Pablo
Post Reply