Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Not drinking, chasing women, or doing drugs won't make you live longer -- it just seems that way.


rocksolid / rocksolid.shared.helpdesk / Notice: Undefined Variable (continued)

Notice: Undefined Variable (continued)

<f91d608450459e34165aeca8ed6fbb23$1@news.novabbs.com>

 copy mid

https://novabbs.com/rocksolid/article-flat.php?id=144&group=rocksolid.shared.helpdesk#144

 copy link   Newsgroups: rocksolid.shared.helpdesk
Path: i2pn2.org!.POSTED!not-for-mail
From: Anonym...@novabbs.i2p (Anonymous)
Newsgroups: rocksolid.shared.helpdesk
Subject: Notice: Undefined Variable (continued)
Date: Mon, 21 Dec 2020 00:57:31 +0000
Organization: novaBBS
Message-ID: <f91d608450459e34165aeca8ed6fbb23$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="30129"; mail-complaints-to="usenet@i2pn2.org"
User-Agent: Rocksolid Light (news.novabbs.com/getrslight)
X-Rslight-Site: $2y$10$qk047Q4yXajUPSPhzkdKAOUlgTUuOA.A8dalG4u/UnSzwVIlKnpSO
 by: Anonymous - Mon, 21 Dec 2020 00:57 UTC

Hello. This is a continuation of all the errors that I'm getting in code of mine. I was finally able to solve the _SESSION problem, but there was also another error that came below _SESSION, which was "Notice: Undefined Variable: q". After fixing the _SESSION error, I still noticed that this error was still in my code when I tried to get an account.

Another thing that I should mention is that I tried removing the $_SESSION['captcha_code'] and <img src="cap.php"><br/><label for="code">captcha:</label><input type="text" name="code" /> in index.php to find out more about my problem. When I did this, the "Notice: Undefined Variable: q" error was gone when I tried to register an account. Therefore, I believe that the error lies within the captcha that I made. However, even with this error gone, I still, for some reason, get {text2}. Even though I get {text2} with a username and password, I don't get any error logs about this whatsoever. Here's some 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
session_start();
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) ;

?>

connect.php:

<?php

$con = mysqli_connect("{host}", "{username}", "{password}", "{database}")

?>

Error log output before removing captcha elements:

Notice: Undefined variable: q in {directory} on line {number}

Error log output after removing captcha elements:

Nothing...

Please note that the different {number}, {color}, {text}, {directory}, {host}, {username}, {password}, {database}, and {variable} brackets are supposed to represent different elements in my code that I believe aren't too necessary to type out and are also elements that I feel somewhat insecure sharing. As said before, once again, if there's any information that I can provide to you or anything that you're confused about, then please feel free to ask. I also would've put hashtags around the main parts of my code to focus on, but I SERIOUSLY don't know what's wrong when I removed the parts of my code that was related to the captcha, so I believe that everything is up for analysis.

Please also note that php is the main code here and that the INSERT INTO value is basically used for a database in order for users to register. The mysqli_connect value connects to a database in phpmyadmin, which is where the database for user registration is located.

Here's my process of making this table:

The table for this is named user, and this table has Collation and has a total of 3 columns. The first column is named id, and it has the type as INT, has the length/values of 5, has the default value as none, has collation and attributes blank, the null checkbox unchecked, the virtuality was left blank when making this, and has the index as PRIMARY, in which A_I is also enabled.

The second column is named user_name, has the type as VARCHAR, has the length/values of 100, has the default value as none, has all of collation, attributes, and index blank, has the null and A_I checkboxes unchecked, and virtuality was also left blank when making this.

The third column is named password, and has the type as VARCHAR, has length/values as 100, has default as none, has collation, attributes, and index blank, and had the null and A_I checkboxes unchecked. Virtuality was left blank.

So, I think that I might've been a bit too specific with phpmyadmin, but I want you to really imagine me making this table. I also believe that I may be calling cap.php wrong in index.php, which might be why I'm getting undefined variable q. However, I honestly have NO idea why I get {text2} when I try to register for an account without the captcha that I made implemented in index.php. Please help me with these two errors, as I feel very confused with my code. Once again, if you have any possible idea why I might be getting these two errors, see any mistake in the code, see any mistake made in my method of making the table mentioned above, and/or know any links/websites that may help, then please feel free to share your thoughts. Advice would be MUCH appreciated.

Last post I made for anyone who needs it:
{DON'T BOTHER READING ANOTHER WHOLE ESSAY IF YOU DON'T REQUIRE IT}

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

SubjectRepliesAuthor
o Notice: Undefined Variable (continued)

By: Anonymous on Mon, 21 Dec 2020

3Anonymous
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor