• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Coded

Junior Spellweaver
Joined
Jun 8, 2012
Messages
195
Reaction score
5
PHP:
<?php
include('config.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" />
		<?php 
$n="my_variable_{$userid}_name"; 
${$n} = true; 
?> 
     
    </head>
    <body>
    	<div class="header">
        	<a href="<?php echo $url_home; ?>"><img src="<?php echo $design; ?>/images/logo.png" alt="Members Area" /></a>
	    </div>
<?php
//We check if the user is logged
if(isset($_SESSION['username']))

{
	//We check if the form has been sent
	if(isset($_POST['username'], $_POST['password'], $_POST['passverif'], $_POST['email'], $_POST['avatar']))
	{


if (!$user_row)
{
    // User does not exist
}?>
</div>
<?php
	}
}
else
{
?>
<div class="message">To access this page, you must be logged.<br />
<a href="connexion.php">Log in</a></div>
<?php
}
?>
	



<?php
/* Database Connection (MySQLi) */
$conn =new mysqli('localhost','root','fartface1','habbocreds');
$query = $conn->query("SELECT * FROM users WHERE id = '" . $userid . "'");
$result = $query->fetch_assoc();

/* Make Database Into Variables */
$ID = $result['id'];
$Username = $result['username'];
$Password = $result['password'];
$Email = $result['email'];
$NoCredits = $result['credits'];


/* Display */
// echo($ID); // ID
// echo($Username); // Username
// echo($Password); // Password
// echo($Email); // Email
echo($NoCredits);

?>


<div class="foot"><a href="<?php echo $url_home; ?>">You Have <?php echo($NoCredits);?> credits available to spend!




</html>



with the $userid variable i haven't actually set a variable for it, das i dopnt know how to set a variable to get user id

everything else seems to be working but without the variable the credits count wont appear on a page
 
Experienced Elementalist
Joined
Jul 23, 2012
Messages
201
Reaction score
128
Somebody correct me if I'm wrong, but on PHP, I think you can't declare a variable like this:
PHP:
${$n} = true;
try just $n = true;

it's possible to define as variable variables as $$n = true;

 
Newbie Spellweaver
Joined
Jan 1, 2014
Messages
79
Reaction score
16
Somebody correct me if I'm wrong, but on PHP, I think you can't declare a variable like this:
PHP:
${$n} = true;
try just $n = true;
This is actually perfectly valid.
 
Last edited:
Intelligent DoucheBag
Loyal Member
Joined
Jan 5, 2008
Messages
1,698
Reaction score
288
how about actually learning the language, instead hacking some codes? This is why PHP is considered bad language, and we encourage this... it may seem as really easy to start things off in php, but actually it's not!

"Hacking some code"

Aw c'mon man!

Somebody correct me if I'm wrong, but on PHP, I think you can't declare a variable like this:
PHP:
${$n} = true;
try just $n = true;

You can if I remember it right.


Oh well, start off learning for yourself, you're pretty much spamming the section with threads against the rules.
 
◝(⁰▿⁰)◜Smile◝ (⁰▿⁰)◜
Developer
Joined
May 29, 2007
Messages
2,167
Reaction score
899
@bnmz4 Check out tutorials. They will help you a lot with understanding Php.
 
Newbie Spellweaver
Joined
Jan 3, 2014
Messages
24
Reaction score
4
you really need to learn a little more about it.
 
Elite Diviner
Joined
Jul 12, 2007
Messages
417
Reaction score
24
$n="my_variable_{$userid}_name";
${
$n} = true;

ahahaha this made my day

Why is it there anyway you arn't even using it as far as I can see
 
• ♠️​ ♦️ ♣️ ​♥️ •
Joined
Mar 25, 2012
Messages
909
Reaction score
464
When I see the code I want to cry and vomit the poop out of me. .____.
It hurts my eyes and rapes my sense of a stable valid ordered world.
When the worse code is not even formatted so you can see what condition ends on what point and everything is crushed together like Nazis flying on dragons ......
Just kill me pls.
 
Elite Diviner
Joined
Jul 12, 2007
Messages
417
Reaction score
24
When I see the code I want to cry and vomit the poop out of me. .____.
It hurts my eyes and rapes my sense of a stable valid ordered world.
When the worse code is not even formatted so you can see what condition ends on what point and everything is crushed together like Nazis flying on dragons ......
Just kill me pls.

Totally agreed..

Code:
<?php
die([COLOR=#000000][COLOR=#0000bb]$n[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#dd0000]"my_variable_[/COLOR][COLOR=#007700]{[/COLOR][COLOR=#0000bb]$userid[/COLOR][COLOR=#007700]}[/COLOR][COLOR=#dd0000]_name"[/COLOR][/COLOR]);
?>
 
Joined
Aug 14, 2009
Messages
1,097
Reaction score
134
Totally agreed..

Code:
<?php
die([COLOR=#000000][COLOR=#0000bb]$n[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#dd0000]"my_variable_[/COLOR][COLOR=#007700]{[/COLOR][COLOR=#0000bb]$userid[/COLOR][COLOR=#007700]}[/COLOR][COLOR=#dd0000]_name"[/COLOR][/COLOR]);
?>

o.o
Why are you setting a variable inside die()?
 
Back
Top