spdwrench Posted August 24, 2007 Share Posted August 24, 2007 I do not know where this function is called in the script... but can I return the $login variable somehow within this function? like could I set a global $theloginwas and record the value of $login in the function? I am looking for a quick way to modify this function so I can read the $login variable outside of the function please help function doImport($importer_class,$login,$name) { global $_CONFIG; $oRespX = new xajaxResponse(); $classFile = $_CONFIG['BASE_DIR'].'/include/classes/importer/'.$importer_class.'.php'; if (file_exists($classFile)) { require_once($classFile); $oImporter = new $importer_class(); $bImporter = true; } else{ $bImporter = false; } $sTxt = ''; if($bImporter){ $result_array = $oImporter->run($login,$name);//array() if(is_array($result_array)) { $names = array_shift($result_array); $emails = array_shift($result_array); if(count($emails)>0){ $sTxt .= '<form action="" onsubmit="javascript:do_send(this);return false;" id="send_form" name="send_form"> <table width="100%" border="0" cellspacing="0" cellpadding="2" style="background-color: #e9e9e9;"> <tr> <td width="25%" align="left"><input type="checkbox" name="all1" id="all1" value="1" onclick="select_all(this);" checked="true"> <b>Select All</b></td> <td width="50%" align="left"><b>Email Address</b></td> <td width="25%" align="left"><b>Name</b></td> </tr> <tr> <td bgcolor="#FFFFFF" height="1" colspan="3"></td> </tr> '; for ($i = 0; $i < count($emails) ; $i++) { if(strpos($emails[$i], '@')){ $sTxt .='<tr> <td align="left"> <input type=checkbox name="email_array[]" id="email_array[]" value="'.$emails[$i].'" checked="true"> </td> <td align="left"> '.$emails[$i].' </td> <td align="left"> '.$names[$i].' </td> </tr> <tr> <td bgcolor="#FFFFFF" height="1" colspan="3"></td> </tr> '; } } $sTxt .= '<tr> <td align="left"><input type="checkbox" name="all2" id="all2" value="1" onclick="select_all(this);" checked="true"> <b>Select All</b></td> <td> </td> <td> </td> </tr> <tr> <td bgcolor="#FFFFFF" height="1" colspan="3"></td> </tr> <tr> <td><div align="right"><b>Subject</b></div></td> <td colspan="2"><div align="left"> <input type="text" name="subject" readonly id="subject" value="'.$_CONFIG['MAIL_SUBJECT'].'" size="50"> </div></td> </tr> <tr> <td valign="top"><div align="right"><b>Content</b></div></td> <td colspan="2" valign="top"><div align="left"> <textarea name="body" id="body" readonly cols="50" rows="15">'.$_CONFIG['MAIL_BODY'].'</textarea> </div></td> </tr> <tr> <td> </td> <td colspan="2" align="left"> <input type="submit" name="send_bn" value="Send"> <input name="send_bn2" type="reset" id="send_bn2" value="Reset"> </td> </tr> </table> </form> '; }else{ $sTxt .= '<p>not any contact on your account.</p>'; } } else if($result_array==1) { $sTxt .= '<p>Invalid login name or password.</p>'; } else { $sTxt .= '<p>An Unknown error has occurred .</p>'; } } else { $sTxt .= '<p>Not this webmail importer installed.</p>'; } $sTxt .= ''; $oRespX->addAssign("login_form_div","innerHTML", $sTxt); return $oRespX; } Quote Link to comment Share on other sites More sharing options...
spdwrench Posted August 24, 2007 Author Share Posted August 24, 2007 I just need the $login value stored into a golabal somehow within the function is that possible? Quote Link to comment Share on other sites More sharing options...
trq Posted August 24, 2007 Share Posted August 24, 2007 I dont se any $login variable. Maybe you should take a look at the manual in relation to functions and impliment it yourself. Quote Link to comment Share on other sites More sharing options...
rofl90 Posted August 24, 2007 Share Posted August 24, 2007 Am i missing the point or.. <?php echo '$login' ?> if the variable $login is already created.. but you havn't written that code if you're stuck with this, the best guide is php.net Quote Link to comment Share on other sites More sharing options...
Neptunus Maris Posted August 24, 2007 Share Posted August 24, 2007 If possible put the two strings for print/return into an array return array("$string1", "$string2"); ...aahhh i dont know but i agree with rofl90 Quote Link to comment Share on other sites More sharing options...
lemmin Posted August 24, 2007 Share Posted August 24, 2007 Yes, Neptunus, you could, but it would likely mess up the other code that uses the function, as it is expecting a class. The function accepts the variable $login, so if you find where the function is called, it will already have the value you are looking for in that scope. Something like: doImport($aclass, $alogin, $aname); You can use $aname as the login that is passed to that function. Quote Link to comment Share on other sites More sharing options...
spdwrench Posted August 24, 2007 Author Share Posted August 24, 2007 ok I am on to a fix for my problem the function asigns an outgoing email to be sent... I need to squeez the $login variable into this and I will have achieved my goal... the following line is returned in part of the function. <input type="text" name="subject" readonly id="subject" value="'.$login.'" size="50"> this puts the $login variable in the subject line of the outgoing email my only problem now is I need it to say for example if $login=paul value needs to be: paul has invited you.. how can I ad invited you to the end of the $login when setting the value? I tried . and " and all kinds of ways but cant seem to get it..... also how would I set a value like if I wanted login in the middle of some text also... thanks guys... if I get this im all set to modify the function easily. Paul Quote Link to comment Share on other sites More sharing options...
trq Posted August 25, 2007 Share Posted August 25, 2007 Your question is pretty vague. Does this help you? <input type="text" name="subject" readonly id="subject" value="'.$login.' has invited you" size="50"> Quote Link to comment Share on other sites More sharing options...
spdwrench Posted August 25, 2007 Author Share Posted August 25, 2007 yea ... if that works... I was just having a problem with the actual sytanx... If figured another way to do it in the meantime but I was going to ask if there was an easier way..... this is how I got it to work $ssub=$login." Has Invited You"; and I used $ssub as the value... hehe anyway thanks I will use your method... Paul Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.