Advertisement:

Author Topic: how do i add peoples usernames to a script?  (Read 1028 times)

Offline steve51184

  • Sr. Member
  • ****
  • Posts: 781
how do i add peoples usernames to a script?
« on: January 27, 2010, 09:23:47 PM »
hey all i have this script and i want to know is there a way i can have the value="" bit of the 'from' imput box auto filled with the users username?

Code: [Select]
<form action="http://pushme.to/myusername/" method="POST"><input type="hidden" name="_encoding" value="UTF-8"></input>Message: <input type="text" name="message"> From: <input type="text" name="signature" value=""/> <input type="submit" value="Push"/></form>

Offline hadesflames

  • SMF Hero
  • ******
  • Posts: 2,773
  • Gender: Male
  • C++ Coder
Re: how do i add peoples usernames to a script?
« Reply #1 on: January 27, 2010, 09:35:04 PM »
Assuming this is a custom php page, include SSI.php then global $context and you would have something like:

Code: [Select]
<?php
require_once('path/to/SSI.php');
global 
$context;

echo 
'<input type="text" name="name" value="' $context['user']['username'] . '" />';
?>

Offline steve51184

  • Sr. Member
  • ****
  • Posts: 781
Re: how do i add peoples usernames to a script?
« Reply #2 on: January 27, 2010, 09:41:34 PM »
perfect thank you :)

Offline hadesflames

  • SMF Hero
  • ******
  • Posts: 2,773
  • Gender: Male
  • C++ Coder
Re: how do i add peoples usernames to a script?
« Reply #3 on: January 27, 2010, 09:57:01 PM »
Glad I could help =]

Offline steve51184

  • Sr. Member
  • ****
  • Posts: 781
Re: how do i add peoples usernames to a script?
« Reply #4 on: January 30, 2010, 02:04:29 PM »
hey if this is for usernames how do i show display names?

Code: [Select]
$context['user']['username']