Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Laugh at your problems; everybody else does.


rocksolid / Helpdesk / Re: Notice: Undefined variable:

SubjectAuthor
* Notice: Undefined variable:Anonymous
+- Could it be a typo ?trw
+* Notice: Undefined variable:Retro Guy
|`- Notice: Undefined variable:Retro Guy
`* Notice: Undefined variable:Anonymous
 `- Notice: Undefined variable:Anonymous

1
Notice: Undefined variable:

<00178a157a08fbb015413efe9715b88b$1@news.novabbs.com>

 copy mid

https://www.rocksolidbbs.com/rocksolid/article-flat.php?id=135&group=rocksolid.shared.helpdesk#135

 copy link   Newsgroups: rocksolid.shared.helpdesk
Path: i2pn2.org!.POSTED!not-for-mail
From: Anonymous@novabbs.i2p (Anonymous)
Newsgroups: rocksolid.shared.helpdesk
Subject: Notice: Undefined variable:
Date: Sun, 20 Dec 2020 00:43:32 +0000
Organization: novaBBS
Message-ID: <00178a157a08fbb015413efe9715b88b$1@news.novabbs.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org; posting-account="retrobbs1";
logging-data="18097"; mail-complaints-to="usenet@i2pn2.org"
User-Agent: Rocksolid Light (news.novabbs.com/getrslight)
X-Rslight-Site: $2y$10$4.8yl8YZBfEStW8uDNxJQuN3Yd3sdIuJoJ9dtJMiJ5aPoevg7AcES
 by: Anonymous - Sun, 20 Dec 2020 00:43 UTC

Hello. I'm in a need of a bit of help. I'm trying to make a website in php. However, in order for users to access a page in this website, they'll need to have an account. This account requires a captcha. However, whenever I try to get an account, my error logs say that a variable is undefined. Here's part of my code:

index.php:

<!doctype html>
<html>
<head>
<style>
*{margin:{number}px; padding:{number}px;}
#account{border-radius: {number}px {number}px {number}px {number}px; border: {number}px solid {color}; width:
{number}px; margin-top: {number}px; margin-left: {number}px; }
#login{border-radius: {number}px {number}px {number}px {number}px; border: {number}px solid {color}; width: {number}px; margin-top: {number}px; margin-left: {number}px; margin-right: {number}px; }
</style>
</head>

<body style="background-color:{color}">
#####<?PHp
require_once("connect.php") ;

if(isset($_POST['register'])){
$user_name = $_POST['user_name'] ;
$password = $_POST['password'] ;

if($user_name != "" and $password != "" and $_POST['code'] === $_SESSION['captcha_code'])

$q= "INSERT INTO `user` (`id`, `user_name`, `password`)
VALUES(' ' , ' ".$user_name." ' , ' ".$password." ')
" ;
if(mysqli_query($con, $q)){
echo '{text1}' ;
}else{
echo "(text2)" ;
}

}

?>#####
<h1><strong>{Some Text}<strong></h1>
<div id="registration">
<h2>{Some Text}</h2>
<form method="post">
Intended username:<br>
<input type="text" name="user_name" /><br>
Intended password:<br>
<input type="text" name="password" /><br>
#####<img src="cap.php"><br/><label for="code">captcha:</label><input type="text" name="code" />#####
<input type="submit" name="register" value="Submission" />

</form>
</div>
</body>
</html>

cap.php:

<?php
session_start( ) ;

#####$captcha = ' ' ;

for($x = 0 ; $x< 7 ; $x++){

$captcha .=chr(rand(97, 122)) ;

} $_SESSION['captcha_code'] = $captcha ;#####

$font = '/fonts/ttf/28dayslater.ttf' ;

$image = imagecreatetruecolor(170, 60) ;

${variable1} = imagecolorallocate($image, {number}, {number}, {number}) ;
${variable2} = imagecolorallocate($image, {number}, {number}, {number}) ;
${variable3} = imagecolorallocate($image, {number}, {number}, {number}) ;

imagefilledrectangle($image, 0, 0, 200, 100, ${variable3}) ;
#####imagettftext($image, 30, 5, 10, 40, ${variable}, $font, $_SESSION['captcha_code']) ;#####

header("Content-type: image/png") ;
imagepng($image) ;

?>

Error Log Output:

#####Notice: Undefined variable: _SESSION in {directory}/index.php on line {number}#####

For what connect.php is and what the INSERT INTO values are as mentioned above in index.php, they're databases that are used in order for users to register, and I also believe that they're unimportant in terms of my issue. The different {number}, {color}, {text}, {directory}, and {variable} brackets are supposed to represent different elements in my code that I believe aren't necessary to type out and are also elements that I feel somewhat insecure sharing. Of course, if there's any information that I can provide you or anything that you're confused about, then please feel free to ask. Since the code may be a bit long to some, I put hashtags around sections of code that I think are especially important to read. Anyway, I believe that with the code that I wrote out, the SESSION variable shouldn't be undefined, as it was defined in cap.php (captcha). However, here I am, not knowing why I keep on getting this error and {text2}. If you have any idea why I may be getting this error, if you see a mistake in the code, and/or if you know any links and websites that might help, please reply. I would love some advice, as I don't know what's wrong at all. Thanks.

--
Posted on novaBBS
news.novabbs.com

Could it be a typo ?

<b57b69c78175acb392f5039503868450@def4>

 copy mid

https://www.rocksolidbbs.com/rocksolid/article-flat.php?id=137&group=rocksolid.shared.helpdesk#137

 copy link   Newsgroups: rocksolid.shared.helpdesk
Path: i2pn2.org!rocksolid2!def5!POSTED.localhost!not-for-mail
From: trw@anon.com (trw)
Newsgroups: rocksolid.shared.helpdesk
Message-ID: <b57b69c78175acb392f5039503868450@def4>
Subject: Could it be a typo ?
Date: Sun, 20 Dec 2020 01:12:10+0000
Organization: def5
In-Reply-To: <00178a157a08fbb015413efe9715b88b$1@news.novabbs.com>
References: <00178a157a08fbb015413efe9715b88b$1@news.novabbs.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
 by: trw - Sun, 20 Dec 2020 01:12 UTC

>session_start( ) ;
When I do copy and paste, there is a whitespace between the brackets, where it should say:
session_start();

cheers

trw

--
Posted on def4

Re: Notice: Undefined variable:

<20201220032137.1412dd1a@desktop14.dt>

 copy mid

https://www.rocksolidbbs.com/rocksolid/article-flat.php?id=140&group=rocksolid.shared.helpdesk#140

 copy link   Newsgroups: rocksolid.shared.helpdesk
Path: i2pn2.org!rocksolid2!.POSTED.localhost!not-for-mail
From: retro_guy@retrobbs.rocksolidbbs.com (Retro Guy)
Newsgroups: rocksolid.shared.helpdesk
Subject: Re: Notice: Undefined variable:
Date: Sun, 20 Dec 2020 03:21:37 -0700
Organization: RetroBBS
Message-ID: <20201220032137.1412dd1a@desktop14.dt>
References: <00178a157a08fbb015413efe9715b88b$1@news.novabbs.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: novabbs.org; posting-account="retrobbs1"; posting-host="localhost:127.0.0.1";
logging-data="13421"; mail-complaints-to="usenet@novabbs.org"
X-Newsreader: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu)
 by: Retro Guy - Sun, 20 Dec 2020 10:21 UTC

On Sun, 20 Dec 2020 00:43:32 +0000
Anonymous@novabbs.i2p (Anonymous) wrote:

> Hello. I'm in a need of a bit of help. I'm trying to make a website
> in php. However, in order for users to access a page in this website,
> they'll need to have an account. This account requires a captcha.
> However, whenever I try to get an account, my error logs say that a
> variable is undefined. Here's part of my code:

Usually the log would tell you which variable is undefined. Then you
know which variable you need to trace back to see when it should get
defined. Does the log provide this info?

Re: Notice: Undefined variable:

<65f85e14e588904d442f0de127cbe004$1@news.novabbs.org>

 copy mid

https://www.rocksolidbbs.com/rocksolid/article-flat.php?id=141&group=rocksolid.shared.helpdesk#141

 copy link   Newsgroups: rocksolid.shared.helpdesk
Path: i2pn2.org!i2pn.org!rocksolid2!.POSTED.localhost!not-for-mail
From: retro.guy@rocksolidbbs.com (Retro Guy)
Newsgroups: rocksolid.shared.helpdesk
Subject: Re: Notice: Undefined variable:
Date: Sun, 20 Dec 2020 10:38:02 +0000
Organization: Rocksolid Light
Message-ID: <65f85e14e588904d442f0de127cbe004$1@news.novabbs.org>
References: <00178a157a08fbb015413efe9715b88b$1@news.novabbs.com> <20201220032137.1412dd1a@desktop14.dt>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: novabbs.org; posting-account="retrobbs1"; posting-host="localhost:127.0.0.1";
logging-data="21856"; mail-complaints-to="usenet@novabbs.org"
User-Agent: Rocksolid Light (news.novabbs.com/getrslight)
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on novabbs.org
X-Rslight-Site: $2y$10$iK2NYzEzWdoiExXvJlJNluEQax6pVoNokQM4Ad2rIdcfgW1Uj1pgO
 by: Retro Guy - Sun, 20 Dec 2020 10:38 UTC

Retro Guy wrote:

> Usually the log would tell you which variable is undefined. Then you
> know which variable you need to trace back to see when it should get
> defined. Does the log provide this info?

I somehow missed the bottom of your post where you say it's _SESSION that's undefined.

Do you have session_start() also in index.php? Without it you won't have $_SESSION variables available.

--
Posted on Rocksolid Light
news.novabbs.org

Re: Notice: Undefined variable:

<he.660.48msjb@anon.com>

 copy mid

https://www.rocksolidbbs.com/rocksolid/article-flat.php?id=142&group=rocksolid.shared.helpdesk#142

 copy link   Newsgroups: rocksolid.shared.helpdesk
Path: i2pn2.org!rocksolid2!.POSTED.127.117.190.215!not-for-mail
From: poster@anon.com (Anonymous)
Newsgroups: rocksolid.shared.helpdesk
Subject: Re: Notice: Undefined variable:
Date: Sun, 20 Dec 2020 05:07:12 -0800
Organization: rocksolid2 (novabbs.org)
Message-ID: <he.660.48msjb@anon.com>
References: <00178a157a08fbb015413efe9715b88b$1@news.novabbs.com>
Content-Type: text/plain; charset=UTF-8
Injection-Info: novabbs.org; posting-account="def.i2p"; posting-host="127.117.190.215";
logging-data="27027"; mail-complaints-to="usenet@novabbs.org"
 by: Anonymous - Sun, 20 Dec 2020 13:07 UTC

>>50d90268088e7734ea
>Do you have session_start() also in index.php? Without it you won't have $_SESSION variables available.

Are you sure ? I thought $_SESSION is a superglobal.

--
Posted on def2

Re: Notice: Undefined variable:

<2e7dc8318d17415313085feea1e3ae0b$1@www.novabbs.com>

 copy mid

https://www.rocksolidbbs.com/rocksolid/article-flat.php?id=143&group=rocksolid.shared.helpdesk#143

 copy link   Newsgroups: rocksolid.shared.helpdesk
Path: i2pn2.org!.POSTED!not-for-mail
From: Anonymous@novabbs.i2p (Anonymous)
Newsgroups: rocksolid.shared.helpdesk
Subject: Re: Notice: Undefined variable:
Date: Sun, 20 Dec 2020 23:19:07 +0000
Organization: novaBBS
Message-ID: <2e7dc8318d17415313085feea1e3ae0b$1@www.novabbs.com>
References: <00178a157a08fbb015413efe9715b88b$1@news.novabbs.com> <he.660.48msjb@anon.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org; posting-account="retrobbs1";
logging-data="17066"; mail-complaints-to="usenet@i2pn2.org"
User-Agent: Rocksolid Light (news.novabbs.com/getrslight)
X-Rslight-Site: $2y$10$bk6LULWpmz.WfGd/RhsACeDHqULmOxmFF.slYBOH2mL.XKJwpx79C
 by: Anonymous - Sun, 20 Dec 2020 23:19 UTC

Anonymous wrote:

>>>50d90268088e7734ea
>>Do you have session_start() also in index.php? Without it you won't have $_SESSION variables available.

> Are you sure ? I thought $_SESSION is a superglobal.

It is as long as you session_start()

https://errorsea.com/what-is-the-php-session-and-how-to-use-_session/

--
Posted on novaBBS
www.novabbs.com

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor