-BRAIDZ- Posted May 26, 2015 Posted May 26, 2015 I'm looking for a welcome message to send to new players as soon as they join from the admin. Can anyone help me please? Quote
sniko Posted May 26, 2015 Posted May 26, 2015 (edited) This has been explained and posted on this forum many times. Nevertheless; Using MySQL trigger # Set default unread mail to 1 because we will have a trigger ALTER TABLE `users` MODIFY COLUMN `new_mail` int(5) NOT NULL DEFAULT 1 AFTER `new_events`; # On INSERT into users table, it will insert a new event record for the user. CREATE TRIGGER `send_event_from_admin` AFTER INSERT ON `users` FOR EACH ROW INSERT INTO events (evUSER,evTIME,evREAD,evTEXT) VALUES (new.id, unix_timestamp(), 0, 'Welcome to the game. This is a message from the admins! Yay.'); # On INSERT, send them a new mail CREATE TRIGGER `send_mail_from_admin` AFTER INSERT ON `users` FOR EACH ROW INSERT INTO mail (mail_read,mail_from,mail_to,mail_time,mail_subject,mail_text) VALUES (0, 1, new.id, unix_timestamp(), 'A welcome subject', 'Welcome to the game. This is a message from the admins! Yay.'); Using code $userid = $db->insert_id(); //... //Send the user an event event_add($userid, 'Welcome to the game. This is a message'); //Send the user a mail $db->query("INSERT INTO `mail` (`mail_read`,`mail_from`,`mail_to`,`mail_time`,`mail_subject`,`mail_text`) VALUES (0, 1, ". $userid .", unix_timestamp(), 'Welcome to the game', 'This is a message from the admins! Yay.')"); $db->query("UPDATE users SET `new_mail` = `new_mail` + 1 WHERE `userid`=". $userid); Edited May 26, 2015 by sniko Quote
-BRAIDZ- Posted May 26, 2015 Author Posted May 26, 2015 (edited) This has been explained and posted on this forum many times. Nevertheless; Using MySQL trigger # Set default unread mail to 1 because we will have a trigger ALTER TABLE `users` MODIFY COLUMN `new_mail` int(5) NOT NULL DEFAULT 1 AFTER `new_events`; # On INSERT into users table, it will insert a new event record for the user. CREATE TRIGGER `send_event_from_admin` AFTER INSERT ON `users` FOR EACH ROW INSERT INTO events (evUSER,evTIME,evREAD,evTEXT) VALUES (new.id, unix_timestamp(), 0, 'Welcome to the game. This is a message from the admins! Yay.'); # On INSERT, send them a new mail CREATE TRIGGER `send_mail_from_admin` AFTER INSERT ON `users` FOR EACH ROW INSERT INTO mail (mail_read,mail_from,mail_to,mail_time,mail_subject,mail_text) VALUES (0, 1, new.id, unix_timestamp(), 'A welcome subject', 'Welcome to the game. This is a message from the admins! Yay.'); Using code $userid = $db->insert_id(); //... //Send the user an event event_add($userid, 'Welcome to the game. This is a message'); //Send the user a mail $db->query("INSERT INTO `mail` (`mail_read`,`mail_from`,`mail_to`,`mail_time`,`mail_subject`,`mail_text`) VALUES (0, 1, ". $userid .", unix_timestamp(), 'Welcome to the game', 'This is a message from the admins! Yay.')"); $db->query("UPDATE users SET `new_mail` = `new_mail` + 1 WHERE `userid`=". $userid); Thanks what do I save the php file as? And possibly explain it a little clearer please? Do I add the sql? Is there a code I can save as a .doc or .txt file and it alters the tables or whatever. Sorry I'm just new to most of this, I know some basic stuff, but not everything haha Edited May 26, 2015 by -BRAIDZ- Quote
sniko Posted May 26, 2015 Posted May 26, 2015 Thanks what do I save the php file as? And possibly explain it a little clearer please? Do I add the sql? Is there a code I can save as a .doc or .txt file and it alters the tables or whatever. Sorry I'm just new to most of this, I know some basic stuff, but not everything haha Thanks what do I save the php file as? That PHP snippet is supposed to go into register after a user is inserted in the database. Choose 1 solution out of the 2. And possibly explain it a little clearer please? I'm not sure what part needs explaining Do I add the sql? Yes, execute the SQL statements once (if you choose the trigger approach) Is there a code I can save as a .doc or .txt file and it alters the tables or whatever. What? Just run it in your MySQL client (PHPMyAdmin, SQLBuddy, Navicat, w/e) Quote
Coly010 Posted May 26, 2015 Posted May 26, 2015 It honestly couldn't be any clearer.. If you don't know what triggers are: http://lmgtfy.com/?q=MySQL+triggers Quote
realmoflegends Posted May 26, 2015 Posted May 26, 2015 The explanation was very clear...nice, Sniko! I prefer the MySQL trigger method personally. If you're struggling to implement this after a clearly explained method like this, maybe time to grab some assistance from someone. :) Quote
krballard94 Posted May 26, 2015 Posted May 26, 2015 [MENTION=65371]sniko[/MENTION] - Both ways are good, but I personally would go for the code approach.. MySQL triggers, are good but for this example I wouldn't use it. I would rather explicitly show it in my code as this can make editing it a lot easier as well and you might not even remember the trigger being called a month down the line. Not to mention that if you made an error in your trigger, you'd have to drop it to re-create it. Just my opinion though. Quote
-BRAIDZ- Posted May 26, 2015 Author Posted May 26, 2015 Thanks what do I save the php file as? That PHP snippet is supposed to go into register after a user is inserted in the database. Choose 1 solution out of the 2. And possibly explain it a little clearer please? I'm not sure what part needs explaining Do I add the sql? Yes, execute the SQL statements once (if you choose the trigger approach) Is there a code I can save as a .doc or .txt file and it alters the tables or whatever. What? Just run it in your MySQL client (PHPMyAdmin, SQLBuddy, Navicat, w/e) Okay, I might just use the code, do I just enter it into my header.php file? And add something like "starter_message" to the user's table so it prevents it from triggering all the time. I only was the mmessage, no need for an event add Quote
realmoflegends Posted May 26, 2015 Posted May 26, 2015 I believe the insert users thing is in the register.php, if I recall correctly (been awhile). Quote
Zettieee Posted May 26, 2015 Posted May 26, 2015 Damn people who need babying need to stop posting. Try and learn something yourself x.x Quote
-BRAIDZ- Posted May 26, 2015 Author Posted May 26, 2015 I believe the insert users thing is in the register.php, if I recall correctly (been awhile). Will have test it out, thank you Quote
-BRAIDZ- Posted May 26, 2015 Author Posted May 26, 2015 (edited) Damn people who need babying need to stop posting. Try and learn something yourself x.x I have learnt some things, don't like it? Piss off and stop being a keyboard warrior. Never hurt anyone asking for help did it? That is the whole point of this section of the forum "support" or do I need to give you a dictionary meaning of the word "support" because I will happily do so ;) Edited May 26, 2015 by -BRAIDZ- Quote
Zettieee Posted May 26, 2015 Posted May 26, 2015 Support and babying are 2 very different things. Simply I'm saying. If your not willing to learn. Stop asking for help. Because it's not really what your after. Your looking for FREE work. Quote
sniko Posted May 26, 2015 Posted May 26, 2015 [MENTION=65371]sniko[/MENTION] - Both ways are good, but I personally would go for the code approach.. MySQL triggers, are good but for this example I wouldn't use it. I would rather explicitly show it in my code as this can make editing it a lot easier as well and you might not even remember the trigger being called a month down the line. Not to mention that if you made an error in your trigger, you'd have to drop it to re-create it. Just my opinion though. Valid point :) Quote
sniko Posted May 26, 2015 Posted May 26, 2015 I have learnt some things, don't like it? Piss off and stop being a keyboard warrior. Never hurt anyone asking for help did it? That is the whole point of this section of the forum "support" or do I need to give you a dictionary meaning of the word "support" because I will happily do so ;) I don't mind providing help/support/spoonfeeding, just as long as the receiver uses their brain. For example; My Reply states "That PHP snippet is supposed to go into register after a user is inserted in the database. " and your reply included " do I just enter it into my header.php file?" - my reply states it's the register file, yet you overlooked that part. That's probably what [MENTION=69001]Zettieee[/MENTION] picked up on too. Quote
Coly010 Posted May 26, 2015 Posted May 26, 2015 Okay, I might just use the code, do I just enter it into my header.php file? And add something like "starter_message" to the user's table so it prevents it from triggering all the time. I only was the mmessage, no need for an event add I sort of agree with parts of what [MENTION=69001]Zettieee[/MENTION] is saying. [MENTION=65371]sniko[/MENTION] told you in his explanation to open up register, yet you are asking if you put it in header.php? You don't need the extra column in the database as the code is 1.) in register and players should only be registering once and therefore the code will only fire once per new user, and 2.) the code uses $db->insert_id(); to find the newly registered players Id therefore the code is only going to affect that new user. Like did you read the code or just copy and paste it? If you want to learn, read the code samples your given, line by line and ask yourself what is happening at each line. If you don't know, Google is a great tool - - - Updated - - - [MENTION=65371]sniko[/MENTION], and I picked up on it, you just got your post sent before me, making me look like a twat :( Quote
-BRAIDZ- Posted May 27, 2015 Author Posted May 27, 2015 I don't mind providing help/support/spoonfeeding, just as long as the receiver uses their brain. For example; My Reply states "That PHP snippet is supposed to go into register after a user is inserted in the database. " and your reply included " do I just enter it into my header.php file?" - my reply states it's the register file, yet you overlooked that part. That's probably what [MENTION=69001]Zettieee[/MENTION] picked up on too. Okay thanks. Now I'm hopeless with this stuff, where would I put it? <?php require "core.php"; function valid_email($email) { // First, we check that there's one @ symbol, and that the lengths are right if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. return false; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } print <<<EOF <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>{$set['game_name']} - $metar </title> <meta name="keywords" content="RPG, Online Games, Online Mafia Game" /> <meta name="description" content=" {$set['game_name']} - Online Mafia Game " /> <meta name="author" content="Ravan Scripts " /> <meta name="copyright" content="Copyright {$_SERVER['HTTP_HOST']} " /> <link rel="SHORTCUT ICON" href="favicon.ico" /> <link rel="stylesheet" href="css/stylenew.css" type="text/css"/> <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen"/> <!--<script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" src="js/lightbox.js"></script>--> </head> <body> <div id="pagecontainer"> <!-- Header Part Starts --> <div class="headerpart"> <div ></div> <div class="toplist"> </div> </div> <script language="JavaScript"> <!-- function getCookieVal (offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function SetCookie (name,value,expires,path,domain,secure) { document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } function DeleteCookie (name,path,domain) { if (GetCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } } // --> </script> <script language="JavaScript"> var usr; var pw; var sv; function getme() { usr = document.login.username; pw = document.login.password; sv = document.login.save; if (GetCookie('player') != null) { usr.value = GetCookie('username') pw.value = GetCookie('password') if (GetCookie('save') == 'true') { sv[0].checked = true; } } } function saveme() { if (usr.value.length != 0 && pw.value.length != 0) { if (sv[0].checked) { expdate = new Date(); expdate.setTime(expdate.getTime()+(365 * 24 * 60 * 60 * 1000)); SetCookie('username', usr.value, expdate); SetCookie('password', pw.value, expdate); SetCookie('save', 'true', expdate); } if (sv[1].checked) { DeleteCookie('username'); DeleteCookie('password'); DeleteCookie('save'); } } else { alert('$javaerr1'); return false; } } </script> <script type="text/javascript"> var xmlHttp // xmlHttp variable function GetXmlHttpObject(){ // This function we will use to call our xmlhttpobject. var objXMLHttp=null // Sets objXMLHttp to null as default. if (window.XMLHttpRequest){ // If we are using Netscape or any other browser than IE lets use xmlhttp. objXMLHttp=new XMLHttpRequest() // Creates a xmlhttp request. }else if (window.ActiveXObject){ // ElseIf we are using IE lets use Active X. objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") // Creates a new Active X Object. } // End ElseIf. return objXMLHttp // Returns the xhttp object. } // Close Function function CheckPasswords(password){ // This is our fucntion that will check to see how strong the users password is. xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object. if (xmlHttp==null){ // If it cannot create a new Xmlhttp object. alert ("Browser does not support HTTP Request") // Alert Them! return // Returns. } // End If. var url="check.php?password="+escape(password) // Url that we will use to check the password. xmlHttp.open("GET",url,true) // Opens the URL using GET xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done. if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text. document.getElementById("passwordresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php } // End If. }; // Close Function xmlHttp.send(null); // Sends NULL insted of sending data. } // Close Function. function CheckUsername(password){ // This is our fucntion that will check to see how strong the users password is. xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object. if (xmlHttp==null){ // If it cannot create a new Xmlhttp object. alert ("Browser does not support HTTP Request") // Alert Them! return // Returns. } // End If. var url="checkun.php?password="+escape(password) // Url that we will use to check the password. xmlHttp.open("GET",url,true) // Opens the URL using GET xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done. if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text. document.getElementById("usernameresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php } // End If. }; // Close Function xmlHttp.send(null); // Sends NULL insted of sending data. } // Close Function. function CheckEmail(password){ // This is our fucntion that will check to see how strong the users password is. xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object. if (xmlHttp==null){ // If it cannot create a new Xmlhttp object. alert ("Browser does not support HTTP Request") // Alert Them! return // Returns. } // End If. var url="checkem.php?password="+escape(password) // Url that we will use to check the password. xmlHttp.open("GET",url,true) // Opens the URL using GET xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done. if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text. document.getElementById("emailresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php } // End If. }; // Close Function xmlHttp.send(null); // Sends NULL insted of sending data. } // Close Function. function PasswordMatch() { pwt1=document.getElementById('pw1').value; pwt2=document.getElementById('pw2').value; if(pwt1 == pwt2) { document.getElementById('cpasswordresult').innerHTML="<font color='green'>$rrerr5</font>"; } else { document.getElementById('cpasswordresult').innerHTML="<font color='red'>$rrerr6</font>"; } } </script> <!-- //Header Part End --> <!-- Flash Part Starts --> <div class="flashpart"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1000" height="460" title="Ravan Scripts"> <param name="movie" value="images/mafia.swf" /> <param name="quality" value="high" /> <param name="wmode" value="Transparent" /> <embed src="images/mafia.swf" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1000" height="460"></embed> </object> </div> <!-- //Falsh Part End --> <!-- Menu Part Starts --> <div class="menu"> <ul> <li class="home_active"><a href="login.php" title="Home">Â </a></li> <li class="story"><a href="story.php" title="The Story">Â </a></li> <li class="contact"><a href="contact.php" title="Contact Us">Â </a></li> <li class="signup"><a href="signup.php" title="Sign Up">Â </a></li> </ul> </div> <!-- Menu Part End --> <!-- Register Page Start --> <br><br> <div align='center' style='width: 1000px;height:600px; background-image:url(images/reg_para_bg.jpg); border:0px solid #999;'> <div class='reg_container'> <form action=signup.php method=post> <div class='reg_frmpart'> <div class='regtop'> <div class='reg_nametxt'> EOF; $IP = $_SERVER['REMOTE_ADDR']; $IP=addslashes($IP); $IP=mysql_real_escape_string($IP); $IP=strip_tags($IP); if(file_exists('ipbans/'.$IP)) { die("<b><font color=red size=+1>$ipban</font></b></body></html>"); } if($_POST['username']) { if($set['regcap_on']) { if(!$_SESSION['captcha'] or $_SESSION['captcha'] != $_POST['captcha']) { unset($_SESSION['captcha']); print " <p> $rrerr0 </p> "; exit; } unset($_SESSION['captcha']); } if(!valid_email($_POST['email'])) { print " <P ALIGN='CENTER'> $rrerr1 <br><br><b><a href=signup.php>$rrerr2</a> </p> "; exit; } if(strlen($_POST['username']) < 4) { print " <P ALIGN='CENTER'> $rrerr3b <br><br><b><a href=signup.php>$rrerr2</a> </p> "; exit; } $sm=100; if($_POST['promo'] == "mafia") { $sm+=100; } $username=$_POST['username']; $username=str_replace(array("<", ">"), array("<", ">"), $username); $q=$db->query("SELECT * FROM users WHERE username='{$username}' OR login_name='{$username}'"); $q2=$db->query("SELECT * FROM users WHERE email='{$_POST['email']}'"); if($db->num_rows($q)) { print " <P ALIGN='CENTER'> $rrerr3 <br><br><b><a href=signup.php>$rrerr2</a> </p> "; exit; } else if($db->num_rows($q2)) { print " <P ALIGN='CENTER'> $rrerr3a <br><br><b><a href=signup.php>$rrerr2</a> <br><br><b><a href=signup.php>$rrerr2</a> </p> "; exit; } else if($_POST['password'] != $_POST['cpassword']) { print " <P ALIGN='CENTER'> $rrerr4 <br><br><b><a href=signup.php>$rrerr2</a> </p> "; exit; } else { $_POST['ref'] = abs((int) $_POST['ref']); $IP = $_SERVER['REMOTE_ADDR']; $IP=addslashes($IP); $IP=mysql_real_escape_string($IP); $IP=strip_tags($IP); $q=$db->query("SELECT * FROM users WHERE lastip='$IP' AND userid={$_POST['ref']}"); if($db->num_rows($q)) { print " <P ALIGN='CENTER'> $nomulti <br><br><b><a href=signup.php>$rrerr2</a> </p>"; exit; } if($_POST['ref']) { $q=$db->query("SELECT * FROM users WHERE userid={$_POST['ref']}"); $r=$db->fetch_row($q); } $db->query("INSERT INTO users (username, display_pic, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup) VALUES( '{$username}', 'http://{$_SERVER['HTTP_HOST']}/images/avatar.gif', '{$username}', md5('{$_POST['password']}'), 1, $sm, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, '{$_POST['gender']}', unix_timestamp(), '{$_POST['email']}', -1, '$IP', '$IP')"); $i=$db->insert_id(); $db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10, 5)"); if($_POST['ref']) { require "global_func.php"; $db->query("UPDATE users SET crystals=crystals+50 WHERE userid={$_POST['ref']}"); event_add($_POST['ref'],"For refering $username to the game, you have earnt 50 valuable crystals!",$c); $db->query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$IP')"); } print " <P ALIGN='CENTER'>$regsucess <br><br><b><a href=login.php>$reglogin</a> </p> "; } } else { if($set['regcap_on']) { $chars="123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!?\\/%^"; $len=strlen($chars); $_SESSION['captcha']=""; for($i=0;$i<6;$i++) $_SESSION['captcha'].=$chars[rand(0, $len - 1)]; } print " <table width='100%' class='table' cellspacing='1'> <tr> <td width='25%'>$ruser</td> <td width='25%'> <div class='reg_namebox'> <input type=text name=username onkeyup='CheckUsername(this.value);'></td> </div> </div> <td width='50%'><div id='usernameresult'></div></td> </tr> <tr> <td>$rpass</td> <td><div class='reg_namebox'><input type=password id='pw1' name=password onkeyup='CheckPasswords(this.value);PasswordMatch();'></td> </div> <td><div id='passwordresult'></div></td> </tr> <tr> <td>$rcpass</td><td><div class='reg_namebox'><input type=password name=cpassword id='pw2' onkeyup='PasswordMatch();'></td> </div> <td><div id='cpasswordresult'></div></td> </tr> <tr> <td>$remail</td><td> <div class='reg_namebox'> <input type=text name=email onkeyup='CheckEmail(this.value);'></td> </div> <td><div id='emailresult'></div></td> </tr> <tr> <td>$rgender</td> <td ><div class='reg_namebox'><select name='gender' style='width: 120px; height:23px; border:0px; padding:3px 0px 0px 6px; color: white; background-color: #111;' type='dropdown'> <option value='Male'>$rmal</option> <option value='Female'>$rfem</option></select></td></div> </tr> <tr> <td>$rpromo</td><td colspan=2><div class='reg_namebox'><input type=text value='$rnocode' name=promo></td> </div> </tr> <input type=hidden name=ref value='"; if($_GET['REF']) { print $_GET['REF']; } print "' />"; if($set['regcap_on']) { print " <tr> <td colspan=2><img src='captcha_verify.php?bgcolor=C3C3C3' width='170' height='88'/><br /></td> <td><b>Enter Captcha Code</b></td><td colspan=2><div class='reg_namebox'><input type='text' name='captcha' /></td> </tr> "; } print " <tr> <td colspan=3 align=center><div class='reg_nametxt'><input type=submit value=$rreg id='reg_btn' style='color:#000;></td> </tr> </table><div class='regtop'> </div> </form><br />"; } print <<<OUT <!-- Do Not Remove Powered By Ravan Scripts without permission . However, if you would like to use the script without the powered by links you may do so by purchasing a Copyright removal license for a very low fee. --> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> OUT; include "lfooter.php"; ?> Quote
realmoflegends Posted May 27, 2015 Posted May 27, 2015 As far as I know (not an expert), it should go right after these lines: $i=$db->insert_id(); $db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10, 5)"); Quote
-BRAIDZ- Posted May 27, 2015 Author Posted May 27, 2015 As far as I know (not an expert), it should go right after these lines: $i=$db->insert_id(); $db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10, 5)"); Thank you, I will give it a go. I did put it in and created a new user, but didn't insert user stats or send the message. Maybe I inserted it into the wrong part of the code Quote
realmoflegends Posted May 27, 2015 Posted May 27, 2015 Post up your new register.php and i'll adjust it as best as I know how. Quote
NonStopCoding Posted May 27, 2015 Posted May 27, 2015 Your register.php is already using the insert id so look for $i=$db->insert_id(); $db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10, 5)"); below the insert into userstats add (You can go with the send event or send pm) event_add($i, 'Welcome to my game etc'); or as sniko used in his first post $db->query("INSERT INTO `mail` (`mail_read`,`mail_from`,`mail_to`,`mail_time`,`ma il_subject`,`mail_text`) VALUES (0, 1, ". $i .", unix_timestamp(), 'Welcome to the game', 'This is a message from the admins! Yay.')"); Quote
-BRAIDZ- Posted June 1, 2015 Author Posted June 1, 2015 (edited) Your register.php is already using the insert id so look for $i=$db->insert_id(); $db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10, 5)"); below the insert into userstats add (You can go with the send event or send pm) event_add($i, 'Welcome to my game etc'); or as sniko used in his first post $db->query("INSERT INTO `mail` (`mail_read`,`mail_from`,`mail_to`,`mail_time`,`ma il_subject`,`mail_text`) VALUES (0, 1, ". $i .", unix_timestamp(), 'Welcome to the game', 'This is a message from the admins! Yay.')"); $i=$db->insert_id(); $db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10, 5)"); $db->query("UPDATE users SET mail_new=mail_new+1 WHERE userid=$userid"); $db->query("INSERT INTO `mail` (`mail_read`,`mail_from`,`mail_to`,`mail_time`,`mail_subject`,`mail_text`) VALUES (0, 1, ". $i .", unix_timestamp(), 'Welcome To The Game', 'Welcome to Game Name Here, if you need any help with anything please do not hesitate to message an admin, we are here to help! Please accept our welcome package Click <a href=bonus.php>Here!</a> to collect your free welcome pack.')"); I noticed I needed to add into users that they have an unread mail, will this do? Or remove the user ID part? [MENTION=65371]sniko[/MENTION] ? Edited June 1, 2015 by -BRAIDZ- Quote
-BRAIDZ- Posted June 1, 2015 Author Posted June 1, 2015 $i=$db->insert_id(); $db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10, 5)"); $db->query("UPDATE users SET mail_new=mail_new+1 WHERE userid=$userid"); $db->query("INSERT INTO `mail` (`mail_read`,`mail_from`,`mail_to`,`mail_time`,`mail_subject`,`mail_text`) VALUES (0, 1, ". $i .", unix_timestamp(), 'Welcome To The Game', 'Welcome to Game Name Here, if you need any help with anything please do not hesitate to message an admin, we are here to help! Please accept our welcome package Click <a href=bonus.php>Here!</a> to collect your free welcome pack.')"); I noticed I needed to add into users that they have an unread mail, will this do? Or remove the user ID part? [MENTION=65371]sniko[/MENTION] ? [MENTION=53425]Magictallguy[/MENTION] how should I have the mail_new query? Is it correct, or should it be different? Quote
sniko Posted June 1, 2015 Posted June 1, 2015 [MENTION=53425]Magictallguy[/MENTION] how should I have the mail_new query? Is it correct, or should it be different? See this. Have you tried it?What went wrong? Was there an error message? Did you try and debug? If so, what did you do? The forum software is adding spaces randomly in the code, so here's a mirror 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.