Jump to content

mikeweb

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mikeweb's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Those were the first commands i tried on this journey but the page kept returning blank as i was accessing the server's env vars. Surely there's got to be a way of doing this aside from having my users log onto the web page with their long user ids. ultimately that would help me setup the proper email "sent from" when using mail(). Thanks for all your efforts. I've learnt alot from this site and all of you. :-) [quote author=Barand link=topic=105378.msg421005#msg421005 date=1156366006] Haven't tried ENV variables. I can have a try but not till next Monday when I'll be back in the office and on the network. There are $_ENV['USERDOMAIN'] and $_ENV['USERNAME'] but I'm currently on my own PC running server and client on 1 PC so I don't know what values will be on a network server. [/quote]
  2. I will check with network admin about the settings mentioned. Can i get the username from environment variables instead ? They are set locally and may be ideal for what i'm trying to do. Thanks [quote author=Barand link=topic=105378.msg420983#msg420983 date=1156364319] Did you check if your anonymous access was off? "Directory Security" tab in website properties in IIS control panel It should work- I use it regularly for controlling access. and getting email address from active directory PS And make sure Intgrated Windows authenrication is ON [/quote]
  3. Here the full code... all works fine except for that username field... isn't it always the last part of the project that seems to be the hardest ?...lol [code] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <?php //to obtain user id session_start(); ?> <html> <head> <title>Corporate RMA Request Form - Submit Form</title> <?php function sendForm() { //ob_start(); $_SESSION['user'] = $_SERVER['LOGON_USER'];    // --> domain\username //form vars $newLine = "<br>"; //populate vars from post $txtDate = $_POST["txtDate"]; $txtAgentName=$_POST["txtAgentName"]; $txtBanNum=$_POST["txtBanNum"]; $txtWirelessNum=$_POST["txtWirelessNum"]; $txtCustomerName=$_POST["txtCustomerName"]; $txtTicketNum=$_POST["txtTicketNum"]; $txtContactName=$_POST["txtContactName"]; $txtContactPhone=$_POST["txtContactPhone"]; $txtContactEmail=$_POST["txtContactEmail"]; $drpWirelessDevice=$_POST["drpWirelessDevice"]; $txtPinNum=$_POST["txtPinNum"]; $txtIMEI=$_POST["txtIMEI"]; $txtSimNum=$_POST["txtSimNum"]; $txtDefectNote=$_POST["txtDefectNote"]; $txtShipAttentionTo=$_POST["txtShipAttentionTo"]; $txtShipCompanyName=$_POST["txtShipCompanyName"]; $txtShipAddress=$_POST["txtShipAddress"]; $txtShipCity=$_POST["txtShipCity"]; $txtShipProv=$_POST["txtShipProv"]; $txtShipPostal=$_POST["txtShipPostal"]; $formData=' <table width="200" border="1" cellspacing="1" bordercolor="#D40139">     <tr> <td width=300 valign=top bgcolor="#D40139" align="right"> <b><span style="font-size:9.0pt;color:white">Corporate RMA</span></b> </td> <td width=300 valign=top bgcolor="#D40139" align="left"><b><span style="font-size:9.0pt;color:white">Request form</span> </td>     </tr>   <tr>     <td> <div align="right"> Date: <br> RMA #: <br> User: <br> </div> </td> <td> <input name="txtDate" type="text" value="'.$txtDate.'" readonly="true"><br> <input name="txtShowTicketNum" type="text" value="'.$txtTicketNum.'" readonly="true"><br> <input name="txtUser" type="text" value="'.$_SESSION['user'].'" readonly="true"> </td> </tr>     <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Customer Information</span></b> </td> <td width=300 valign=top bgcolor="#D40139">&nbsp; </td>     </tr>   <tr>     <td> <div align="right"> Ban: <br> Wireless #: <br> Customer Name: <br> </div> </td> <td> <input name="txtBanNum" type="text" value="'.$txtBanNum.'" readonly="true"><br> <input name="txtWirelessNum" type="text" value="'.$txtWirelessNum.'" readonly="true"><br> <input name="txtCustomerName" type="text" value="'.$txtCustomerName.'" readonly="true"> </td> </tr>     <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Contact Information</span></b> </td> <td width=300 valign=top bgcolor="#D40139">&nbsp; </td>     </tr>   <tr>     <td> <div align="right"> Contact Name: <br> Contact Phone: <br> Contact Email: </div> </td> <td> <input name="txtContactName" type="text" value="'.$txtContactName.'" readonly="true"><br> <input name="txtContactPhone" type="text" value="'.$txtContactPhone.'" readonly="true"><br> <input name="txtCustomerName" type="text" value="'.$txtContactEmail.'" readonly="true"> </td>   </tr>     <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Device Information</span></b> </td> <td width=300 valign=top bgcolor="#D40139">&nbsp; </td>     </tr>   <tr>     <td> <div align="right"> Pin: <br> IMEI: <br> Sim Card #: </div> </td> <td> <input name="txtPinNum" type="text" value="'.$txtPinNum.'" readonly="true"><br> <input name="txtIMEI" type="text" value="'.$txtIMEI.'" readonly="true"><br> <input name="txtSimNum" type="text" value="'.$txtSimNum.'" readonly="true"> </td>   </tr>     <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Shipping Information</span></b> </td> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Defect Information</span></b> </td>     </tr>   <tr>     <td> <textarea name="txtAddressFull" cols="35" rows="6" readonly="true">'.$txtShipAttentionTo.' '.$txtShipCompanyName.' '.$txtShipAddress.' '.$txtShipCity.' '.$txtShipProv.' '.$txtShipPostal.' </textarea> </td>     <td> <textarea name="txtDefectNote" cols="35" rows="6" readonly="true">'.$txtDefectNote.'</textarea> </td>   </tr> </table> '; //populate email vars echo $newLine; $to = "michael.webster@rci.rogers.com"; //$headers = "From: michael.webster@rci.rogers.com"; $headers = "From: michael.webster@rci.rogers.com\r\nContent-type: text/html\r\n"; $subject = "Corporate RMAA request form - ".$txtTicketNum; $body=$formData; echo "To: ".$to.$newLine; echo "From: ".$headers.$newLine; echo "Subject: ".$subject.$newLine.$newLine; echo "Body: ".$newLine.$body.$newLine; if (mail($to, $subject, $body, $headers)) {   echo("<p>Message successfully sent!</p>"); } else {   echo("<p>Message delivery failed...</p>"); } }//function end //Send the completed form sendForm(); ?> [/code]
  4. Thank you Tried the below as well ... still an empty username field. But the below code looked promising... is there something else I need to do for it to work ? Also tried the other suggestions by other members... you're all brilliant thanks again for the replies :-) Mike [quote author=Barand link=topic=105378.msg420967#msg420967 date=1156362997] [code] echo $_SERVER['LOGON_USER'];    // --> domain\username [/code] If you are using IIS you will have to disable anonymous logins, either at wwwroot level for the site or for the folder your app is in. [/quote]
  5. no not formally logging onto the site. but logging onto domain I was hoping to grab the windows user id even from local environment vars. Seems like such a task but definately valuable on my form. Thanks for all the responses so far :-) [quote author=rallokkcaz link=topic=105378.msg420920#msg420920 date=1156360516] first of all are you even logged in? second can you login through the login.php(.html .htm ext.) that might help the problem [/quote]
  6. Here's my code... still has empty field for username: what am i doing wrong ? [code] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php //to obtain user id session_start(); ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <?php function sendForm() { //ob_start(); $_SESSION['user'] = $_POST['username']; $formData=' <table width="400" border="1" cellspacing="1" bordercolor="#D40139">   <tr>     <td> User: <input name="txtUser" type="text" value="'.$_SESSION['user'].'" readonly="true"> </td> </tr> </table> '; //Send the completed form sendForm(); ?> <body> </body> </html> [/code]
  7. Thanks Cratgo :-) I tried that (novice user). but got the follow message... =============== Warning: session_start(): Cannot send session cookie - headers already sent by (output started at E:\Techassist\RMA\sendForm.php:6) in E:\Techassist\RMA\sendForm.php on line 141 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at E:\Techassist\RMA\sendForm.php:6) in E:\Techassist\RMA\sendForm.php on line 141 =============== Where is the best place to put this function ? (please excuse my ignorance, i'm new to php) [quote author=craygo link=topic=105378.msg420878#msg420878 date=1156357124] You will either have to pass it on thru hidden form variables or you can use session or cookies. Personally I have used sessions. To use sessions you would have to start EVERY one of your pages with [code]session_start();[/code] then you would assign the session value [code]$_SESSION['user'] = $_POST['username'];[/code] once that is assigned you can call on the username at anytime by calling [code]$_SESSION['user'][/code] Ray [/quote]
  8. how to get user id of user using php server side web page. I need to add it to my web page and use it to autofill the "Sent from" for php email. Username: [  ] thanks in advance Mike
  9. You are a champion and a scholar sir ! That worked just fine. I was down to one hair left on my head. THANK YOU ! [quote author=hitman6003 link=topic=105339.msg420803#msg420803 date=1156350453] Change all of your vars in the email from <?php echo $varname; ?> to ' . $varname . ': [code]Customer Information<br> Ban: <?php echo $txtBanNum; ?> txtWirelessNum <?php echo $txtWirelessNum; ?><br> txtCustomerName <?php echo $txtCustomerName; ?>[/code] should be: [code]Customer Information<br> Ban: ' . $txtBanNum . ' txtWirelessNum ' . $txtWirelessNum . '<br> txtCustomerName ' . $txtCustomerName . '[/code] [/quote]
  10. *Bump my vars show up as (for example) $txtDate ... instead of the date that was sent I just figured out to properly post my code. Here it is... [code] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Corporate RMA Request Form - Submit Form</title> <?php function sendForm() { //form vars $newLine = "<br>"; //populate vars from post $txtDate = $_POST["txtDate"]; $SYSN["theDate"] = $_POST["txtDate"]; $txtAgentName=$_POST["txtAgentName"]; $txtBanNum=$_POST["txtBanNum"]; $txtWirelessNum=$_POST["txtWirelessNum"]; $txtCustomerName=$_POST["txtCustomerName"]; $txtTicketNum=$_POST["txtTicketNum"]; $txtContactName=$_POST["txtContactName"]; $txtContactPhone=$_POST["txtContactPhone"]; $txtContactEmail=$_POST["txtContactEmail"]; $drpWirelessDevice=$_POST["drpWirelessDevice"]; $txtPinNum=$_POST["txtPinNum"]; $txtIMEI=$_POST["txtIMEI"]; $txtSimNum=$_POST["txtSimNum"]; $txtDefectNote=$_POST["txtDefectNote"]; $txtShipAttentionTo=$_POST["txtShipAttentionTo"]; $txtShipCompanyName=$_POST["txtShipCompanyName"]; $txtShipAddress=$_POST["txtShipAddress"]; $txtShipCity=$_POST["txtShipCity"]; $txtShipProv=$_POST["txtShipProv"]; $txtShipPostal=$_POST["txtShipPostal"]; $formData=' <table width="400" border="1" cellspacing="1" bordercolor="#D40139">     <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Corporate RMA Request form</span></b> </td>     </tr>   <tr>     <td> Date: <?php= echo "$txtDate; ?><br> TicketNum <?php echo $txtTicketNum; ?> </td>     <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Customer Information</span></b> </td>     </tr>   <tr>     <td> Customer Information<br> Ban: <?php echo $txtBanNum; ?> txtWirelessNum <?php echo $txtWirelessNum; ?><br> txtCustomerName <?php echo $txtCustomerName; ?> </td>     <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Contact Information</span></b> </td>     </tr>   <tr>     <td> txtContactName <?php echo $txtContactName; ?> txtContactPhone <?php echo $txtContactPhone; ?><br> txtContactEmail <?php echo $txtContactEmail; ?> </td>   </tr>     <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Device Information</span></b> </td>     </tr>   <tr>     <td> txtPinNum <?php echo $txtPinNum; ?> txtIMEI <?php echo $txtIMEI; ?><br> txtSimNum <?php echo $txtSimNum; ?> </td>   </tr>     <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Defect Information</span></b> </td>     </tr>   <tr>     <td> <textarea name="txtDefectNote" cols="35" rows="6">"<?php echo $txtDefectNote ?>"</textarea> </td>   </tr>     <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Shipping Information</span></b> </td>     </tr>   <tr>     <td> txtShipAttentionTo <?php echo $txtShipAttentionTo; ?><br> txtShipCompanyName <?php echo $txtShipCompanyName; ?><br> txtShipAddress <?php echo $txtShipAddress; ?><br> txtCityProvPostal <?php echo $txtShipCity; ?> </td>   </tr> </table> '; //populate email vars echo $newLine; $to = "michael.webster@rci.rogers.com"; //$headers = "From: michael.webster@rci.rogers.com"; $headers = "From: michael.webster@rci.rogers.com\r\nContent-type: text/html\r\n"; $subject = "Corporate RMAA request form - ".$txtTicketNum; $body=$formData; echo "To: ".$to.$newLine; echo "From: ".$headers.$newLine; echo "Subject: ".$subject.$newLine.$newLine; echo "Body: ".$newLine.$body.$newLine; if (mail($to, $subject, $body, $headers)) {   echo("<p>Message successfully sent!</p>"); } else {   echo("<p>Message delivery failed...</p>"); } }//function end //Send the completed form sendForm(); ?> [/code]
  11. not a problem lessthanthree :-) Seems to be a real challenge or it just can't be done. Just want my php vars to show up in the table i send via mail() ... sounds easy enough huh ?
  12. sorry guys ... my message somehow got deleted... I'm having trouble getting my php variables to show up in the table that I'm trying to email using mail(). I've done alot of research on the web but no good clues. Any suggestions p.s. newLine=<<br>> but doesn't show up in my post as it's html as well
  13. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Corporate RMA Request Form - Submit Form</title> <? function sendForm() { //form vars $newLine = "<br>"; //populate vars from post $txtDate = $_POST["txtDate"]; $SYSN["theDate"] = $_POST["txtDate"]; $txtAgentName=$_POST["txtAgentName"]; $txtBanNum=$_POST["txtBanNum"]; $txtWirelessNum=$_POST["txtWirelessNum"]; $txtCustomerName=$_POST["txtCustomerName"]; $txtTicketNum=$_POST["txtTicketNum"]; $txtContactName=$_POST["txtContactName"]; $txtContactPhone=$_POST["txtContactPhone"]; $txtContactEmail=$_POST["txtContactEmail"]; $drpWirelessDevice=$_POST["drpWirelessDevice"]; $txtPinNum=$_POST["txtPinNum"]; $txtIMEI=$_POST["txtIMEI"]; $txtSimNum=$_POST["txtSimNum"]; $txtDefectNote=$_POST["txtDefectNote"]; $txtShipAttentionTo=$_POST["txtShipAttentionTo"]; $txtShipCompanyName=$_POST["txtShipCompanyName"]; $txtShipAddress=$_POST["txtShipAddress"]; $txtShipCity=$_POST["txtShipCity"]; $txtShipProv=$_POST["txtShipProv"]; $txtShipPostal=$_POST["txtShipPostal"]; $formData=' <table width="400" border="1" cellspacing="1" bordercolor="#D40139">     <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Corporate RMA Request form</span></b> </td>     </tr>   <tr>     <td> Date: <?php "$txtDate; ?><br> TicketNum <?php echo $txtTicketNum; ?> </td>     <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Customer Information</span></b> </td>     </tr>   <tr>     <td> Customer Information<br> Ban: <?php echo $txtBanNum; ?> txtWirelessNum <?php echo $txtWirelessNum; ?><br> txtCustomerName <?php echo $txtCustomerName; ?> </td>     <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Contact Information</span></b> </td>     </tr>   <tr>     <td> txtContactName <?php echo $txtContactName; ?> txtContactPhone <?php echo $txtContactPhone; ?><br> txtContactEmail <?php echo $txtContactEmail; ?> </td>   </tr>     <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Device Information</span></b> </td>     </tr>   <tr>     <td> txtPinNum <?php echo $txtPinNum; ?> txtIMEI <?php echo $txtIMEI; ?><br> txtSimNum <?php echo $txtSimNum; ?> </td>   </tr>     <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Defect Information</span></b> </td>     </tr>   <tr>     <td> <textarea name="txtDefectNote" cols="35" rows="6">"<?php echo $txtDefectNote ?>"</textarea> </td>   </tr>     <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Shipping Information</span></b> </td>     </tr>   <tr>     <td> txtShipAttentionTo <?php echo $txtShipAttentionTo; ?><br> txtShipCompanyName <?php echo $txtShipCompanyName; ?><br> txtShipAddress <?php echo $txtShipAddress; ?><br> txtCityProvPostal <?php echo $txtShipCity; ?> </td>   </tr> </table> '; //populate email vars echo $newLine; $to = "michael.webster@rci.rogers.com"; //$headers = "From: michael.webster@rci.rogers.com"; $headers = "From: michael.webster@rci.rogers.com\r\nContent-type: text/html\r\n"; $subject = "Corporate RMA request form - ".$txtTicketNum; $body=$formData; echo "To: ".$to.$newLine; echo "From: ".$headers.$newLine; echo "Subject: ".$subject.$newLine.$newLine; echo "Body: ".$newLine.$body.$newLine; if (mail($to, $subject, $body, $headers)) {   echo("<p>Message successfully sent!</p>"); } else {   echo("<p>Message delivery failed...</p>"); } //function end } //Send the completed form sendForm(); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.