gldss_games Posted April 11, 2013 Posted April 11, 2013 If any expert can help me Skyfire Soap?An sending system of "gold" "txt" "item" In order to deploy a CMS helped everyone.Thank you! I found these functions phpNot know to use soap<?phpfunction sendmail($playername,$playerguid, $subject, $text, $item, $shopid=0, $money=0, $realmid='1') //returns, IMPORTANT: do not remove <!-- success --> if success{ global $server,$ra_user,$ra_pass,$db,$a_user,$se_c,$realm; $playername = clean_string($playername); $subject = preg_replace( "/[^A-Za-z0-9]/", "", clean_string($subject)); //no whitespaces $item = preg_replace( "/[^0-9]/", "", $item); //item id $realmid = preg_replace( "/[^0-9]/", "", $realmid); //item id if ($item<>'') $item = " ".$item; $text = clean_string($text); $money= preg_replace( "/[^0-9]/", "", $money); $telnet = fsockopen($server, $realm[$realmid]['port_ra'], $error, $error_str, 3); if($telnet) { fgets($telnet,1024); // Motd fputs($telnet, $ra_user."n"); sleep(3); //fgets($telnet,1024); // PASS fputs($telnet, $ra_pass."n"); sleep(3); $remote_login = fgets($telnet,1024); if(strstr($remote_login, "Logged in.")) { if ($item<>'' && $item<>'0')//send item { //sendmail to RA console fputs($telnet, ".send items ".$playername." "".$subject."" "".$text.""".$item."n"); $easf=time(); $mailtext="Mail with item sent! No money was sent."; } elseif ($money>'0' && $money<>'')//send money { fputs($telnet, ".send money ".$playername." "".$subject."" "".$text."" ".$money."n"); $moneytext="Mail with money sent! No item was sent."; } else //send letter { fputs($telnet, ".send mail ".$playername." "".$subject."" "".$text.""n"); $moneytext="Normal Mail sent!"; } //check database if actuall item is there //WebsiteVoteShopREFXXXXXXX ->this is unique $check=$db->query("SELECT * FROM mail WHERE receiver = '".$playerguid."' AND subject ='".$subject."' LIMIT 1")or die(mysql_error()); if(mysql_num_rows($check)=='0') $status="Recheck script (just to make sure mail is actually sent):<br><br><center><iframe style='width:96%; height:100px' src='./include/core/mangos_iframe_mailcheck.php?shopid=".$shopid."&reciver=".$playerguid."&subject=".$subject."&realmid=".$realmid."&shash=".sha1($a_user['id'].$playerguid.$subject.$se_c.$shopid)."'><a href='./include/core/mangos_iframe_mailcheck.php?shopid=".$shopid."&reciver=".$playerguid."&subject=".$subject."&realmid=".$realmid."&shash=".sha1($a_user['id'].$playerguid.$subject.$se_c.$shopid)."'>Check here if your mail is here.</a></iframe></center>"; return "<!-- success --><span class="colorgood">".$mailtext.$moneytext."<br></span><br>".$status; } else return "<span class="colorbad">Remote Login Problem: ".$remote_login."</span><br>Used login: ".$ra_user; fclose($telnet); } else return "<span class="colorbad">MaNGOS server is offline, you must do this when server is online.</span>";}function sendmail($playername,$playerguid, $subject, $text, $item, $shopid=0, $money=0, $realmid='1') //returns, IMPORTANT: do not remove <!-- success --> if success{ global $server,$ra_user,$ra_pass,$db,$a_user,$se_c,$realm; $playername = clean_string($playername); $subject = preg_replace( "/[^A-Za-z0-9]/", "", clean_string($subject)); //no whitespaces $item = preg_replace( "/[^0-9]/", "", $item); //item id $realmid = preg_replace( "/[^0-9]/", "", $realmid); //item id if ($item<>'') $item = " ".$item; $text = clean_string($text); $money = preg_replace( "/[^0-9]/", "", $money); $username = 'GMNAME'; $password = 'GMPASS'; $host = "localhost"; $soapport = 7878;if ($item<>'' && $item<>'0') //send item { $command = 'send items '.$playername.' "'.$subject.'" "'.$text.'" '.$item.''; $moneytext = "<strong>Your reward has been sent.</strong> Please check your mailbox in game!"; $client = new SoapClient(NULL, array( "location" => "http://$host:$soapport/", "uri" => "urn:MaNGOS", "style" => SOAP_RPC, 'login' => $username, 'password' => $password )); try { $result = $client->executeCommand(new SoapParam($command, "command")); return "<!-- success --><span class="colorgood">".$mailtext.$moneytext."<br /></span><br />".$status; } catch (Exception $e) { echo "Command failed! Reason:<br />n"; echo $e->getMessage(); }} elseif ($money>'0' && $money<>'')//send money { $command = 'send money '.$playername.' "'.$subject.'" "'.$text.'" '.$money.''; $client = new SoapClient(NULL, array( "location" => "http://$host:$soapport/", "uri" => "urn:MaNGOS", "style" => SOAP_RPC, 'login' => $username, 'password' => $password )); try { $result = $client->executeCommand(new SoapParam($command, "command")); $moneytext = "<strong>Your money has been sent.</strong> Please check your mailbox in game!"; } catch (Exception $e) { $moneytext = "Failed to send any money. <br />Please contact support!"; }}else //send mail { $command = 'send mail '.$playername.' "'.$subject.'" "'.$text.'"'; $client = new SoapClient(NULL, array( "location" => "http://$host:$soapport/", "uri" => "urn:MaNGOS", "style" => SOAP_RPC, 'login' => $username, 'password' => $password )); try { $result = $client->executeCommand(new SoapParam($command, "command")); $moneytext = "<strong>Your mail was sent.</strong> Please check your mailbox in game!"; } catch (Exception $e) { $moneytext = "Failed to send your mail. <br />Please contact support!"; }} $check=$db->query("SELECT * FROM mail WHERE receiver = '".$playerguid."' AND subject ='".$subject."' LIMIT 1")or die(mysql_error()); if(mysql_num_rows($check)=='0') { $status="Rechecking, just to make sure mail is actually sent:<br><br><center><iframe style='width:96%; height:100px' src='./include/core/mangos_iframe_mailcheck.php?shopid=".$shopid."&reciver=".$playerguid."&subject=".$subject."&realmid=".$realmid."&shash=".sha1($a_user['id'].$playerguid.$subject.$se_c.$shopid)."'><a href='./include/core/mangos_iframe_mailcheck.php?shopid=".$shopid."&reciver=".$playerguid."&subject=".$subject."&realmid=".$realmid."&shash=".sha1($a_user['id'].$playerguid.$subject.$se_c.$shopid)."'>Check here if your mail is here.</a></iframe></center>"; return "<!-- success --><span class="colorgood">".$mailtext.$moneytext."<br></span><br>".$status; } else return "<span class="colorbad">Mail Problem: ".$remote_login."</span><br>Used login: ".$ra_user;}$username = 'GMNAME'; $password = 'GMPASS'; $host = "localhost"; $soapport = 7878;  Quote
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.