• 0

login display username


Question

Recommended Posts

  • 0

It would be beneficial to not only yourself, but the many helpful people on Neowin if you made one topic and kept in in it. Your never going to get support if you constantly keep creating topics.

To answer your question; it depends how your login system works. Form your previous posts, I believe your using sessions, so it would simple work as follows:

echo 'Hello: '.$_SESSION['username'];

(Replace username with whatever your usernames session is stored as. And keep the ''.

  • 0

It would be beneficial to not only yourself, but the many helpful people on Neowin if you made one topic and kept in in it. Your never going to get support if you constantly keep creating topics.

To answer your question; it depends how your login system works. Form your previous posts, I believe your using sessions, so it would simple work as follows:

echo 'Hello: '.$_SESSION['username'];

(Replace username with whatever your usernames session is stored as. And keep the ''.

Thanks, how would i place this within my code. its for my home page and at the moment its just coming up as text on the page.

  • 0

well without the code you are using we cannot help now can we?

Okay i have just copied the table it is in

        <tbody>
          <tr height="54" valign="top">
            <td style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px">
              <br/>
              <a href="Untitled1.html">
                <font size="4" face="Tempus Sans ITC">
                  <strong>Home</strong> </font></a>
              <font size="4" face="Tempus Sans ITC">
                <strong> | Forum | </strong> </font>
              <a href="Untitled3.html"></a>
              <a href="Untitled3.html">
                <font size="4" face="Tempus Sans ITC">
                  <strong>Hottest Uni's</strong> </font></a>
              <font size="4" face="Tempus Sans ITC">
                <strong>|</strong> </font>
              <font size="4" face="Tempus Sans ITC">
                <strong>
                  <a href="Untitled3.html">
                    <font size="4" face="Tempus Sans ITC">
                      <strong>Rate your Uni </strong>
                    </font></a>
                </strong>
              </font>
              <font size="4" face="Tempus Sans ITC">
                <strong>| Uni LAD test | Events |</strong> </font>
              <a href="Untitled6.html">
                <font size="4" face="Tempus Sans ITC">
                  <strong>Buy</strong> </font></a>            <font size="4" face="Tempus Sans ITC"> echo 'Hello: '.$_SESSION['username'];</td>
          </tr>
        </tbody>
      </table><br/><br/><br/></div>
    <div style="TEXT-ALIGN: left; PADDING-BOTTOM: 0px; TEXT-INDENT: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">
      <div style="TEXT-ALIGN: left; PADDING-BOTTOM: 0px; TEXT-INDENT: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">
        <table style="BACKGROUND-COLOR: #ffffff" border="1" cellspacing="2" cellpadding="2" width="250" align="right" height="495">
          <tbody>

  • 0

Uh, this is just HTML code. What Tjcrazy provided you with was some PHP.

What kind of system are you using as a backend? I assume it's some kind of forum system. How do you handle the login and how do you store the user details?

  • 0

Yes the login and registration page work 100% fine. I thought maybe it was for .php page but the page i have at the mo for my homepage is .HTML so should i change the file type?

For my database i use XAMPP which has myphp and mySQL etc

for login / registration i use seperate .PHP files

  • 0

jamessyfx is correct, the code I gave was for a .php file.

From what I've seen in your stupid-amount of previous topics, The code I gave you should work with your system. Obviously, without your entire .html file, I can't give you the full code, but this should work:

        <tbody>
          <tr height="54" valign="top">
            <td style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px">
              <br/>
              <a href="Untitled1.html">
                <font size="4" face="Tempus Sans ITC">
                  <strong>Home</strong> </font></a>
              <font size="4" face="Tempus Sans ITC">
                <strong> | Forum | </strong> </font>
              <a href="Untitled3.html"></a>
              <a href="Untitled3.html">
                <font size="4" face="Tempus Sans ITC">
                  <strong>Hottest Uni's</strong> </font></a>
              <font size="4" face="Tempus Sans ITC">
                <strong>|</strong> </font>
              <font size="4" face="Tempus Sans ITC">
                <strong>
                  <a href="Untitled3.html">
                    <font size="4" face="Tempus Sans ITC">
                      <strong>Rate your Uni </strong>
                    </font></a>
                </strong>
              </font>
              <font size="4" face="Tempus Sans ITC">
                <strong>| Uni LAD test | Events |</strong> </font>
              <a href="Untitled6.html">
                <font size="4" face="Tempus Sans ITC">
                  <strong>Buy</strong> </font></a>      
      <font size="4" face="Tempus Sans ITC"> <?php echo 'Hello: '.$_SESSION['username']; ?></td>
          </tr>
        </tbody>
      </table><br/><br/><br/></div>
    <div style="TEXT-ALIGN: left; PADDING-BOTTOM: 0px; TEXT-INDENT: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">
      <div style="TEXT-ALIGN: left; PADDING-BOTTOM: 0px; TEXT-INDENT: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">
        <table style="BACKGROUND-COLOR: #ffffff" border="1" cellspacing="2" cellpadding="2" width="250" align="right" height="495">
          <tbody>

Change the file extension to .php and make sure at the very top of the page you have:

<?php
session_start();
?>

I'm happy to give help, but also should comment on your website structure. The HTML tables you used... awful.

  • 0

Come on guys, let's wind back the "rawr" somewhat. ;)

Hopefully, louismoore16 will realise the, awesome and free, skills that you guys are offering up and will be as helpful as they can.

Anthony.

I made clear my favourite part of that post ;)

Error

Notice: Undefined index: username in C:\xampp\htdocs\mywebsite\Untitled1.php on line 146

You haven't changed the $_SESSION variable to the name of your session. Because I'm a nice, friendly chap; I looked at a previous post and deduced that your variable is 'myusername'.

So simply, change

$_SESSION['username']

TO

$_SESSION['myusername']

  • 0

I made clear my favourite part of that post ;)

You haven't changed the $_SESSION variable to the name of your session. Because I'm a nice, friendly chap; I looked at a previous post and deduced that your variable is 'myusername'.

So simply, change

$_SESSION['username']

TO

$_SESSION['myusername']

im affraid its still displaying the same message

  • 0

It would be helpful if you gave us the rest of the code. Us friendly guys struggle to help when we can't find out whats wrong.

That error code is gone now, its now saying

Notice: Undefined variable: _SESSION in C:\xampp\htdocs\mywebsite\Untitled1.php on line 142

do you still need code?

  • 0

Back so soon

Parse error: syntax error, unexpected T_DNUMBER in C:\xampp\htdocs\mywebsite\logout.php on line 3

<?php   

if (isset($_SESSION['loggedIn')) {   

$tmp = $_SESSION['myusername'];   
session_destroy();   
session_regenerate_id();   
$_SESSION['userName'] = $tmp;   
}   
?>  

  • 0

<?php   

if (isset($_SESSION['loggedIn'])) {   

$tmp = $_SESSION['myusername'];   
session_destroy();   
session_regenerate_id();   
$_SESSION['userName'] = $tmp;   
}   
?>  

Use that. You were missing a ']'.

What should i change 'if (isset($_SESSION['loggedIn'])) ' too coz i took this code of a website and i dont think it is relevant to mine

Also it is still displaying the same message

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • HONOR Robot Phone unveils first Cinematic Video at Shanghai International Film Festival by Steven Parker Global AI device ecosystem company HONOR announced on June 13 that its revolutionary HONOR Robot Phone made its professional imaging debut at the 28th Shanghai International Film Festival (SIFF), demonstrating the result of its mobile videography capabilities for the first time. As the official mobile photography and videography partner of the 28th Shanghai International Film Festival, HONOR empowers this premier cinematic event with cutting-edge mobile imaging technology. Marking the global debut of the first cinematic video it captured, Robot Phone breaks down the boundaries between mobile imaging and professional filmmaking, ushering in a new paradigm for the deep integration of technology and cinematic art. In the video published on HONOR’s official channel (above), Robot Phone was used byELLEMEN to capture cinematic video portraits for the SIFF jury members. With its exceptional stability and cinema-grade imaging capabilities, the device redefines the art of portrait filmmaking, faithfully reproducing the rich tonal gradations and nuanced color transitions associated with film photography. The result is a new level of visual sophistication, creating high-end cinematic imagery that seamlessly blends atmosphere with narrative tension. The video released for the Robot Phone showcases the powerful stabilization capabilities of its built-in gimbal system, delivering exceptionally smooth handheld camera movement while preserving full image quality. By minimizing reliance on electronic image stabilization, the device effectively avoids the image cropping and quality loss typically associated with digital stabilization methods. Representing an innovative leap in form factor, the HONOR Robot Phone features the industry's smallest titanium alloy gimbal, delivering ultra-precision, extreme flexibility, and superior stability. Driven by high-performance motors, the gimbal rises dynamically, breaking free from the physical limitations of traditional camera modules. Combined with advanced AI algorithms that enable intelligent object tracking and various movements with stable shots, the device significantly simplifies video creation and reshapes both the equipment choices and creative habits of modern users. Notably, the Robot Phone will be the first product that features the results of HONOR's strategic technological partnership with ARRI, the world-renowned designer and manufacturer of professional camera technology for cinematic storytelling. From Cannes to Shanghai, the HONOR Robot Phone continues to lead the mobile imaging industry into an entirely new stage of development. Moving forward, HONOR will leverage cutting-edge AI and mobile imaging technologies to unlock new creative possibilities and extend cinematic standards for visual expression from the world of high-end filmmaking to the next generation of content creators. Learn more about the HONOR Robot Phone here: https://www.honor.com/global/events/honor-robot-phone/
    • I'll wait for the root cause analysis. Looks like it's HP, Lenova, and certain configurations that are askew, hardly "all of windows." Time will tell.
    • Loading Topaz Photo AI freezes my system since this update...
    • I had issues with my NVME, it was running really slow (like 2/3 mb bandwidth) ... had to reverted via System Restore and all is fine now.
  • Recent Achievements

    • Week One Done
      Jeroen Wilms earned a badge
      Week One Done
    • Week One Done
      rolfus earned a badge
      Week One Done
    • One Month Later
      Leroy Jethro Gibbs earned a badge
      One Month Later
    • Conversation Starter
      flexorcist earned a badge
      Conversation Starter
    • One Month Later
      AndreaB earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      510
    2. 2
      +Edouard
      200
    3. 3
      PsYcHoKiLLa
      137
    4. 4
      ATLien_0
      91
    5. 5
      Steven P.
      83
  • Tell a friend

    Love Neowin? Tell a friend!