Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.6
Author Message
jazzfuser
Worker
Worker



Joined: Mar 30, 2006
Posts: 111

PostPosted: Fri Jun 29, 2007 1:14 am Reply with quote

I have a form which emails information to me submitted by my users to register for events. Included with their information I also collect their IP address using $REMOTE_ADDR to help ensure the validity of the submission. I would like to automatically collect their username as I have with the IP. Is there a simple way to do that? If so, could someone direct me to the code I would include in my mail function, or is there a universal reference like $REMOTE_ADDR for usernames? I've tried $username, $uname, and some others I've seen in other areas of nuke with no luck.

Here is a condensed version;

<?
$EmailTo = " support@mysite.com, $email";
$Subject = " [NEW REGISTRATION] $lname , $fname";
$Name = "$fname lname\n";
$App = "EVENT REGISTRATION\n----------------------------\n\nIP Address: $REMOTE_ADDR\nLast Name: $lname\nFirst Name: $fname";
mail($EmailTo,$Subject,$App,"From: $email\n");
?>


After the IP Address I would like to include the Username of the registered (logged in) user submitting the form.

I hope I've given you enough information. Thanks in advance for any help.
 
View user's profile Send private message
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6437

PostPosted: Fri Jun 29, 2007 6:12 am Reply with quote

Almost enough information...is the form a block? You may need to declare a global variable for the $user array. Note that it's an array, so you'll need to get the appropriate value from the array for the user name for your log or email.

_________________
I search, therefore I exist...
Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message
evaders99
Former Moderator in Good Standing



Joined: Apr 30, 2004
Posts: 3221

PostPosted: Fri Jun 29, 2007 8:27 am Reply with quote

You should be able to use this code
Code:


if (is_user($user)) {
   cookiedecode($user);
   $username = $cookie[1];
}

_________________
- Only registered users can see links on this board! Get registered or login! -

Need help? Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
jazzfuser







PostPosted: Fri Jun 29, 2007 11:55 am Reply with quote

Thank you both. I should declare I am not very savvy in regard to PHP. I certainly know enough to get into trouble, and enough to know to back up everything before I make changes Wink.

Kguske, the form is a module which refers to a file that contains the above sample. I'm assuming that is where I would apply the array.

Evaders99, I added your code to the file and received a Fatal error message referring to the line where that was added. I'm certain I'm missing something. Here is what it looked like;

<?
if (is_user($user)) {
cookiedecode($user);
$username = $cookie[1];
}
$EmailTo = " support@mysite.com, $email";
$Subject = " [NEW REGISTRATION] $lname , $fname";
$Name = "$fname lname\n";
$App = "EVENT REGISTRATION\n----------------------------\nUser: $username\nIP Address: $REMOTE_ADDR\nLast Name: $lname\nFirst Name: $fname";
mail($EmailTo,$Subject,$App,"From: $email\n");
?>

If you could, and it is not much trouble, would you explain in more detail or show me what it should look like?

Thank you.
 
evaders99







PostPosted: Fri Jun 29, 2007 12:13 pm Reply with quote

What exactly is the error?
That code equires the use of phpNuke, which means you need to include phpNuke's mainfile.php
 
jazzfuser







PostPosted: Fri Jun 29, 2007 12:26 pm Reply with quote

Thank you, that was all I needed. For the sake of other newbies, here is the code that worked;

Code:
<?

require_once("mainfile.php");
if (is_user($user)) {
cookiedecode($user);
$username = $cookie[1];
}
$EmailTo = " support@mysite.com, $email";
$Subject = " [NEW REGISTRATION] $lname , $fname";
$Name = "$fname lname\n";
$App = "EVENT REGISTRATION\n----------------------------\nUser: $username\nIP Address: $REMOTE_ADDR\nLast Name: $lname\nFirst Name: $fname";
mail($EmailTo,$Subject,$App,"From: $email\n");
?>


Thank you once again Evaders99!
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.6

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©