Geekerd
10 years ago

0

Hi,

I have created a code like this …. and I want to put in between a text depending on a parameter. In particular I want to insert the username of a site you login to ( for example if I enter to hakcthis I want the html to insert “Geekerd”. Thank you for your reply.

11replies
4voices
231views
???Roun512 [roun512]
10 years ago | edited 10 years ago

0

Hi,

You said parameter, i will suppose you mean GET parameter as for the rest sorry but i didn’t understand it, something like that will do the job
<?php if(isset($_GET['username'])) { echo "<em>" . $_GET['username'] . "</em>"; } ?>

Ops for some reasons [‘username’] doesn’t appear after the $_GETs :p

[deleted user]
10 years ago

0

Hi @roun512

Does the above code works.

Reply has been removed
Cyan Wind [freewind1012]
10 years ago | edited 10 years ago

0

@tlotr: Yes, @roun512’s code does work. However, how much that code is compatible with @Geekerd’s idea is really up to his knowledge.

???Roun512 [roun512]
10 years ago | edited 10 years ago

0

Hi @tlotr,

Yes my code works but the [ ‘name’ ] without spaces is not appearing (BBcode Problem) after the $_GETs :)

and @freewind1012, i didn’t understand the rest of the OP post :) but maybe he wants something like this :/

<?php  
if(isset($_GET[ 'name' ])) {  
    if($_GET[ 'name' ] == 'hackthis') {  
        echo "<em>Geekard</em>";  
    }  
}  
?>  
Geekerd
10 years ago

0

I really appreciate your response. I’ll try to be more clear ( I am not English and so I have some problems to explain myself ).

Geekerd
10 years ago

0

So, the entire code is <!DOCTYPE HTML>


Geekerd
10 years ago

0

And I want the code to write the name of the person who login in between . So, if someone else ( Gigio fro example ), log in I want the code to write “Gigio”. I do not know hot to insert a code that make the page make this. I hope it is more clear.

???Roun512 [roun512]
10 years ago | edited 10 years ago

1

Aah, now i understand.

That can be done Using sessions in PHP, for eample:

<em><font color = "40E0D0"><?=$_SESSION[ 'username' ];?></font></em>  
Cyan Wind [freewind1012]
10 years ago | edited 10 years ago

0

@Geekerd: Yeah, @roun512’s method is correct: using $_SESSION to display username. I assume that you are using PHP as server-side language, right? If you want to do that, make sure that you know about session and its built-in functions.

Geekerd
10 years ago

0

Thank you all!

[deleted user]
10 years ago

0

Can I also add that ANY user supplied data which is either stored in a database or output to page really needs to be cleaned to avoid SQLi and XSS injections.

You must be logged in to reply to this discussion. Login
1 of 12

This site only uses cookies that are essential for the functionality of this website. Cookies are not used for tracking or marketing purposes.

By using our site, you acknowledge that you have read and understand our Privacy Policy, and Terms of Service.

Dismiss