Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Tutorial: Unity and PHP login script - simple but useful

Discussion in 'Multiplayer' started by xandeck, Jun 10, 2009.

  1. Mark Liu

    Mark Liu

    Joined:
    Sep 27, 2011
    Posts:
    39
    good one!! thanks for share anyway
     
  2. killerscripteres

    killerscripteres

    Joined:
    Oct 18, 2011
    Posts:
    27
    Hey Man,
    My wuestion is:
    What am I need to edit to be able to login to the system?
    I mean, Witch user I'm need to be able to login to the system?
     
  3. Whyser

    Whyser

    Joined:
    Jun 3, 2011
    Posts:
    7
    I know this is old, but the php-script has a tiny fault! (I think) (You should change it since people apparently still checks this thread from time to time)

    The tag: "<?" in the beginning should be: "<?php"...Quite obvious if you've done php before but took me 20mins or so to figure out what was wrong! :)

    (I'm surprised noone else ran into that problem so maybe it's possible to write it that way :S)
     
  4. CorruptedHeart

    CorruptedHeart

    Joined:
    May 4, 2010
    Posts:
    379
    It depends on whether the server is setup to allow the shortened version or not. Both can be used if the hosting environment supports it.
     
  5. kevinseligmann

    kevinseligmann

    Joined:
    Mar 23, 2011
    Posts:
    68
    I ran with this problem and didn't know how to solved it. You saved my day sir :)
     
  6. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    The "<?" and "<?php" is not really something I forgot... most of the servers I run into (or some friends) accept for default the "<?" always.
    So, this is not really mandatory, it will depends on your server as CorruptedHeart said ;)

    I really don't know why UnityForums does not send me any email notification of any posts I'm in... :(
     
  7. kevinseligmann

    kevinseligmann

    Joined:
    Mar 23, 2011
    Posts:
    68
    I've moved the php script to a public server, tested on different machines through the browser if the script worked and it did. But averytime I try to run the application in other machines (By using a STANDALONE exe), it doesn't connect and the output of the standalone says "Couldn't connect to host".

    Any idea? It is working within the Unity Editor, but not when making a standalone player.
     
  8. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Hmmm... I dont really have an idea... can you post the code (or send to me a PM). I will answer asap...
    But it should work :)
     
  9. black6

    black6

    Joined:
    Jan 31, 2012
    Posts:
    45
  10. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    For array like vars, I made a concatenated string and send it back to Unity... I'm not sure about returning an array.
     
  11. protatoe

    protatoe

    Joined:
    Mar 12, 2012
    Posts:
    3
    There are a few ways to do this. If you are trying to pass objects or data structures then SOAP, which is designed for such a purpose. It can be a little bit more complicated to setup though. If it's just a list of values, it's pretty easy. Using XML or DOM you can do multidimensional arrays without much headache.

    If you have just a flat array, no multidimensional stuff, you can use the string parsing functions. This is the easiest. You can do multiple splits to make this work for more complicated stuff.
    Code (csharp):
    1.  
    2. <?
    3. //where $my_array is an array structed as array('value1','value2','value3');
    4. $my_str = implode(':', $my_array); //double check to make sure I didn't switch the argument order.
    5. echo $my_str;
    6. ?>
    7.  
    8. -- C# --
    9. //where s is the string you got back from the web request.
    10. string[] words = s.Split(':');
    11.  
    If you need to pass multi-dimensional arrays, formatting it as xml then parsing as such in C# would be the easiest. This would work well for a scoreboard or something if you didn't want to use SOAP.
    Code (csharp):
    1.  
    2. <?
    3. ...
    4. //you might need proper xml, this is generic.
    5. $html = '<array_container>';
    6. foreach($my_array as $return_array){
    7.    $html .= '<array_collection>';
    8.    foreach($return_array as $return_value){
    9.       $html .= '<array_item>'.$return_value.'</array_item>';
    10.    }
    11.    $html .= '</array_collection>';
    12. }
    13. $html .= '</array_container>';
    14. echo $html;
    15. ?>
    16.  
    You can then parse and iterate over your nodes using DOM or XML in C#. Example of doing this in C# from stackoverflow in the answers.
    http://stackoverflow.com/questions/1238528/parse-xml-document-in-c-sharp
     
  12. Mr.T

    Mr.T

    Joined:
    Jan 1, 2011
    Posts:
    546
    Hi xandeck,

    Thanks a lot for this invaluable contribution.

    I made a small spin-off from this and have a few questions about that. Since your original script is working fine for me without any problems, I did not want to muddle this thread and posted those questions in another thread here

    Unity and PHP: Question about using Session ID between different scenes
    http://forum.unity3d.com/threads/13...ut-using-Session-ID-between-different-scenes?

    If you happen to check back into this thread of yours sometime, I'll be happy to receive any input you or anyone else reading this thread might have on what I posted in that other thread.
     
  13. Flywin

    Flywin

    Joined:
    Aug 15, 2012
    Posts:
    1
    Hi xandeck,

    I came to thank you for the tutorial. It helped me a lot.

    I've used on a project and it worked fine. With some tweaking, I could put a online score on my game.

    Thank you!
     
  14. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Hey Flywin, thanks... as I said in another posts, I am not receiving email confirmation of replys -.-' so I dont know when people answer here (and also I cannot come back here everyday, lol)

    Cheers
     
  15. moinchdog

    moinchdog

    Joined:
    Apr 4, 2012
    Posts:
    15
    i got this when logging in

    <br><table border='1' cellpadding='2' bgcolor='#FFFFDF' bordercolor='#E8B900' align='center'><tr><td><font face='Arial' size='1' color='#000000'><b>PHP Error Message</b></font></td></tr></table><br />
    <b>Warning</b>: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Access denied for user 'myuser'@'localhost' (using password: YES) in <b>/home/a9204532/public_html/check_scores.php</b> on line <b>13</b><br />
    <br><table border='1' cellpadding='2' bgcolor='#FFFFDF' bordercolor='#E8B900' align='center'><tr><td><div align='center'><a href='http://www.000webhost.com/'><font face='Arial' size='1' color='#000000'>Free Web Hosting</font></a></div></td></tr></table>Cant connect into database

    please help
     
  16. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Hello moin,

    Its hard to say where it is wrong if I dont know your code.
    Please, post it here what you did... if you followed the steps, it should work.

    What I can see here is you cant connect to your database (locally or online, whatever you configured). Probably, your DB password is wrong, or your host is not accepting yout connection (maybe access, I dont know). Also, you are using the default data I put into the code. You should replace these data with your own (username from DB and password. Maybe even you have a wrong php code...

    Cheers
     
  17. MarsVisualDev

    MarsVisualDev

    Joined:
    Nov 17, 2012
    Posts:
    5
    Hey! I was wondering if you could help me after I hit login I want a go to lobby button that will transition scenes! Thanks!:D Big fan!
     
  18. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Hey man... yes, I can help you, but not write the code for you, lol
    Put here what do you have and I can help you get through the code...
     
  19. gardian06

    gardian06

    Joined:
    May 9, 2012
    Posts:
    13
    In your initial post you point to a cs tut, and when I look at the thread the original poster is off grid. if you still have those cs files could you please post them just the files is fine.
     
  20. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Hey Gardin... I am sorry, but I dont have it anymore... but if you build/make those scripts, I can help you get them running. Please, follow the steps and you should be fine, then post here if you find any errors ;)

    Cheers
     
  21. MR.NIX

    MR.NIX

    Joined:
    Mar 27, 2013
    Posts:
    1
    How can i load a new Scene after using the right login??
    I don´t know where I must write Application.LoadLevel(1);.

    thx for help
     
  22. Alexsander

    Alexsander

    Joined:
    Nov 26, 2012
    Posts:
    17
    Мой пример.


    IEnumerator login(WWW w)
    {
    yield return w;
    if (w.error == null)
    {
    if (w.text == "login-SUCCESS")
    {
    print("Application.LoadLevel(1);");
    }
    Application.LoadLevel(1);

    message += w.text;
    }
    else
    {
    message += "ERROR: " + w.error + "\n";
    }
    }
     
  23. parryt

    parryt

    Joined:
    Dec 4, 2012
    Posts:
    25
    hi i have tryed your tutorial but i get this error Assets/login.cs(8,13): error CS0116: A namespace can only contain types and namespace declarations
    9 times and also i get Assets/login.cs(29,11): error CS0128: A local variable named `w' is already defined in this scope
     
  24. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Hey parryt,

    You must have done something wrong when writing the scripts into the .cs file.
    Please, post here what you did and I let you know asap...
     
  25. maikmajestic

    maikmajestic

    Joined:
    May 6, 2013
    Posts:
    1
    Hey, i have 2 problems:
    1.- In the check_scores.php send me this error: Login or password cant be empty.
    2.- In the unity project send me this error: Rejected because no crossdomain.xml policy file was found.

    Please Help me. Thank you.
     
  26. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Hello maik,

    1) This is not a casual error, is a scripted error made by purpose. Probably you are lefting any field blank. Make a Debug.Log e check what are you sending.
    2) This is a Unity related problem, you must put the crossdomain.xml in the root of where your page is in case of WebPlayers, I think. Check Unity manual for this.

    Hope that helps
     
  27. Brians999

    Brians999

    Joined:
    Jun 17, 2013
    Posts:
    4
    Hi Xandeck can you please help me?
    The script worked fine untill my PC needed to install some new software for Windows..
    So now everytime I wan't to start it it gives an error message. (Hosted on my own PC)
    Then I decide to host it on the web and filled in:

    var URL = "http://eventists.dutch-solutions.net/beta/survivalusers.php";

    But this is resulting in the following error:

    you are trying to load data from a www stream which had the following error when downloading

    How can I fix this?
    By the way nice tutorial! Helped me a lot.

    Regards,
    Brian
     
  28. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Hello Brian...
    In your message you say "had the following error"... what is the error?
     
  29. Brians999

    Brians999

    Joined:
    Jun 17, 2013
    Posts:
    4
    The error is:

    you are trying to load data from a www stream which had the following error when downloading couldn't connect to host.

    But the host is online? Its an webhosting with DB in there since out of nothing the DB on my PC stopped working.. If I go to the file my self nothing seems wrong but in the project folder it still gives the message?

    (The .php file is hosted on here: http://eventists.dutch-solutions.net/beta/survivalusers.php
    and I got an MySQL DB and the right username password filled in and stuff)
     
  30. early

    early

    Joined:
    Jun 21, 2013
    Posts:
    2
    php is a server-side script, it's not like js or html that people can read its code.

    BTW, you still didn't tell what is the exact error message from this error. The exact error detail should be something like http://pastebin.com/fziJceei which has more details.
     
    Last edited: Jun 21, 2013
  31. Brians999

    Brians999

    Joined:
    Jun 17, 2013
    Posts:
    4
    Negative what I told 2 times IS the error code nothing else it just saying that and I KNOW PHP is server side thats why it has been uploaded on an server I have..
    It only says:

    you are trying to load data from a www stream which had the following error when downloading couldn't connect to host.

    Not more not less then that line..

    The server is online (Cause I placed it into a Datacenter) And all ports are working fine.. Every file works correct and still its giving me the above line.. Nothing more or less as I mentioned already.
    I looked everywhere and thats all..
     
    Last edited: Jun 23, 2013
  32. Pady

    Pady

    Joined:
    May 3, 2013
    Posts:
    1
    after making the described steps, now when I run the game a window with your nick,your pass , try login appears and under another window.After I type the nick and the password this appears in the window.What should I do from now?

    <?

    // CONNECTIONS =========================================================

    $host = ""; //put your host here

    $user = "root"; //in general is root

    $password = ""; //use your password here

    $dbname = "scores"; //your database

    mysql_connect($host, $user, $password) or die("Cant connect into database");

    mysql_select_db($dbname)or die("Cant connect into database");

    // =============================================================================

    // PROTECT AGAINST SQL INJECTION and CONVERT PASSWORD INTO MD5 formats

    function anti_injection_login_senha($sql, $formUse = true)

    {

    $sql = preg_replace("/(from|select|insert|delete|where|drop table|show tables|,|'|#|\*|--|\\\\)/i","",$sql);

    $sql = trim($sql);

    $sql = strip_tags($sql);

    if(!$formUse || !get_magic_quotes_gpc())

    $sql = addslashes($sql);

    $sql = md5(trim($sql));

    return $sql;

    }

    // THIS ONE IS JUST FOR THE NICKNAME PROTECTION AGAINST SQL INJECTION

    function anti_injection_login($sql, $formUse = true)

    {

    $sql = preg_replace("/(from|select|insert|delete|where|drop table|show tables|,|'|#|\*|--|\\\\)/i","",$sql);

    $sql = trim($sql);

    $sql = strip_tags($sql);

    if(!$formUse || !get_magic_quotes_gpc())

    $sql = addslashes($sql);

    return $sql;

    }

    // =============================================================================

    $unityHash = anti_injection_login($_POST["myform_hash"]);

    $phpHash = "hashcode"; // same code in here as in your Unity game



    $nick = anti_injection_login($_POST["myform_nick"]); //I use that function to protect against SQL injection

    $pass = anti_injection_login_senha($_POST["myform_pass"]);

    /*

    you can also use this:

    $nick = $_POST["myform_nick"];

    $pass = $_POST["myform_pass"];

    */

    if(!$nick || !$pass) {

    echo "Login or password cant be empty.";

    } else {

    if ($unityHash != $phpHash){

    echo "HASH code is diferent from your game, you infidel.";

    } else {

    $SQL = "SELECT * FROM scores WHERE name = '" . $nick . "'";

    $result_id = @mysql_query($SQL) or die("DATABASE ERROR!");

    $total = mysql_num_rows($result_id);

    if($total) {

    $datas = @mysql_fetch_array($result_id);

    if(!strcmp($pass, $datas["password"])) {

    echo "LOGADO - PASSWORD CORRECT";

    } else {

    echo "Nick or password is wrong.";

    }

    } else {

    echo "Data invalid - cant find name.";

    }

    }

    }

    // Close mySQL Connection

    mysql_close();

    ?>
     
  33. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Hey, sorry the delay on this... you mean this role text appears to you?
     
  34. Brians999

    Brians999

    Joined:
    Jun 17, 2013
    Posts:
    4
    Hi I know how to fix this one.. Its just simple! Its because you missed <?PHP its needed for the code to start an PHP what it is.. Now it won't read it that it is an PHP.

    The fixed code should be:











    <?php

    // CONNECTIONS ================================================== =======

    $host = ""; //put your host here

    $user = "root"; //in general is root

    $password = ""; //use your password here

    $dbname = "scores"; //your database

    mysql_connect($host, $user, $password) or die("Cant connect into database");

    mysql_select_db($dbname)or die("Cant connect into database");

    // ================================================== ===========================

    // PROTECT AGAINST SQL INJECTION and CONVERT PASSWORD INTO MD5 formats

    function anti_injection_login_senha($sql, $formUse = true)

    {

    $sql = preg_replace("/(from|select|insert|delete|where|drop table|show tables|,|'|#|\*|--|\\\\)/i","",$sql);

    $sql = trim($sql);

    $sql = strip_tags($sql);

    if(!$formUse || !get_magic_quotes_gpc())

    $sql = addslashes($sql);

    $sql = md5(trim($sql));

    return $sql;

    }

    // THIS ONE IS JUST FOR THE NICKNAME PROTECTION AGAINST SQL INJECTION

    function anti_injection_login($sql, $formUse = true)

    {

    $sql = preg_replace("/(from|select|insert|delete|where|drop table|show tables|,|'|#|\*|--|\\\\)/i","",$sql);

    $sql = trim($sql);

    $sql = strip_tags($sql);

    if(!$formUse || !get_magic_quotes_gpc())

    $sql = addslashes($sql);

    return $sql;

    }

    // ================================================== ===========================

    $unityHash = anti_injection_login($_POST["myform_hash"]);

    $phpHash = "hashcode"; // same code in here as in your Unity game



    $nick = anti_injection_login($_POST["myform_nick"]); //I use that function to protect against SQL injection

    $pass = anti_injection_login_senha($_POST["myform_pass"]);

    /*

    you can also use this:

    $nick = $_POST["myform_nick"];

    $pass = $_POST["myform_pass"];

    */

    if(!$nick || !$pass) {

    echo "Login or password cant be empty.";

    } else {

    if ($unityHash != $phpHash){

    echo "HASH code is diferent from your game, you infidel.";

    } else {

    $SQL = "SELECT * FROM scores WHERE name = '" . $nick . "'";

    $result_id = @mysql_query($SQL) or die("DATABASE ERROR!");

    $total = mysql_num_rows($result_id);

    if($total) {

    $datas = @mysql_fetch_array($result_id);

    if(!strcmp($pass, $datas["password"])) {

    echo "LOGADO - PASSWORD CORRECT";

    } else {

    echo "Nick or password is wrong.";

    }

    } else {

    echo "Data invalid - cant find name.";

    }

    }

    }

    // Close mySQL Connection

    mysql_close();

    ?>
     
  35. oslomon

    oslomon

    Joined:
    Aug 16, 2013
    Posts:
    6
    hello i did what you said step by step but the problem is when i click the log in button it just show the codes from the check_score.php from the formtext..
     
  36. oslomon

    oslomon

    Joined:
    Aug 16, 2013
    Posts:
    6
    i did what you said <?php but it just show the codes from check_scores.php
     
  37. oslomon

    oslomon

    Joined:
    Aug 16, 2013
    Posts:
    6
    yes even if we put <?php it also appear from the formtext is the code from check_scores.php
     
  38. tikyorules

    tikyorules

    Joined:
    Sep 28, 2012
    Posts:
    8
    hi i am developing a simple mobile game (android platform) and i am having a small problem with the server side high score, i used the unify community wiki server side high score as a sample.

    http://wiki.unity3d.com/index.php?title=Server_Side_Highscores

    so my problem is when i run the game on unity itself everything is OK, i can send data from unity to server and also retrieve data from server to unity and then show all top 10 scores using Gui text.

    but when i build and run the game on an android device lets say a tablet (i use lenovo k1 tablet), sure i can send data from unity to server but i can't seem to retrieve the data from the server to the android device, it does not show the scores from the server...

    that is why i am having a kinda confusing moment, cause i don't know if its the code itself or the device that is causing this problem, cause the sending and retrieving of data from pc to server/ server to pc when running the game on unity itself is going perfectly, but when i am using the android device i get to update the database with new score, it just can't seem to show the data of scores from the database server....

    does the code from this sample only applicable for pc and will not work on any mobile devices?

    i hope someone can enlighten me, thank you.
     
    Last edited: Sep 2, 2013
  39. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Hello Tikyorules,

    It should run in any platform.
     
  40. tikyorules

    tikyorules

    Joined:
    Sep 28, 2012
    Posts:
    8
    oh ok, but i really can't why it would show the scores on unity in pc and won't show the scores on my android device, i actually tried installing it on 2 android device a phone and a tablet, both same result it won't show the scores from the database server, but it can definitely post scores to the server...

    does the device have something that blocks data retrieval, much like a firewall? that inhibits the data from being showed?

    btw thanks for the confirmation, i can now breath much more easily...
     
  41. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    To be honest with you, I never tried this connection (with PHP) in Android devices, but it should work, I already tested such methods in iOS and it works =)
    Sorry that I cant help you much on this.
     
  42. tikyorules

    tikyorules

    Joined:
    Sep 28, 2012
    Posts:
    8
    no its ok, i know this is already working, but i can feel that something is blocking it from posting the scores on the device, cause it is already running perfectly on PC.

    lastly do IOS device have permissions? like in android devices? cause i was thinking maybe it has to do with permissions...

    cause right now there are only two permissions that i have set up on the androidmanifest.xml

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />

    and i thought that would already cut it, but maybe i am missing something in the permissions front....

    BTW sir you have already help me by confirming that the code can run on mobile devices. thank you.
     
  43. BenKurdziel

    BenKurdziel

    Joined:
    Nov 9, 2012
    Posts:
    8
    For people who are asking about Logging in immediately if the username/password is correct. Here's some code for unity to help you do that.

    This method requires a variable at the beginning of your script as follows:

    Code (csharp):
    1. public var successTest  : String;
    From here, you must do your login successfully (using whatever is the CORRECT data on your MySQL server). Make sure you don't have an Application.LoadLevel("myLevel"); running yet because you need to copy the output from the formText field that tells you your login is successful.

    Copy everything from the formText field and paste it into the Unity Inspector in the successTest variable you have defined.

    What this does is check if the MySQL Server has returned the exact 'success' message that would indicate a successful login.

    The bolded part below is where this check takes place.

    Note that this is the Login function found in the original post with a couple small changes. The change in the script is commented in the code below.

    Code (csharp):
    1. function Login() {
    2.     var form = new WWWForm(); //here you create a new form connection
    3.     form.AddField( "myform_hash", hash ); //add your hash code to the field myform_hash, check that this variable name is the same as in PHP file
    4.     form.AddField( "myform_nick", formNick );
    5.     form.AddField( "myform_pass", formPassword );
    6.     var w = WWW(URL, form); //here we create a var called 'w' and we sync with our URL and the form
    7.     yield w; //we wait for the form to check the PHP file, so our game dont just hang
    8.     if (w.error != null) {
    9.         Debug.Log("There was an error.");
    10.         print(w.error); //if there is an error, tell us
    11.     } else {
    12.         print("Test ok");
    13.         formText = w.data; //here we return the data our PHP told us
    14.        
    15.         Debug.Log(w.data);
    16.        
    17. //Here is the Important Change
    18.         if (w.data == successTest)
    19.         {
    20.             Application.LoadLevel("Client");
    21.         }
    22.        
    23.         w.Dispose(); //clear our form in game
    24.     }
    25.  
    26.     formNick = ""; //just clean our variables
    27.     formPassword = "";
    28. }
     
    Last edited: Sep 15, 2013
  44. Narcotic904

    Narcotic904

    Joined:
    Jun 11, 2013
    Posts:
    14
    Good starting point, however I suggest hashing/salting your passwords in the javascript rather then the php, you're essentially sending bare passwords out to the world with this method.

    Hash>Salt>Then send data to your php script.
     
  45. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    Totally right, I could not recommend better. As I said earlier, it is just an example how to make it work ;)
     
  46. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    194
    Guys, how does u fix problem: "crossdomain.xml policy file was not found" , I add it file(UTF-8: <?xml version="1.0"?>
    <cross-domain-policy> <allow-access-from domain="*"/> <allow-access-from secure="false"/> </cross-domain-policy> ) to Assets folder and build.. but still policy file was not found .. I put crossdomain.xml everywhere))) .. trying run build on web on host
     
  47. xandeck

    xandeck

    Joined:
    Apr 2, 2009
    Posts:
    563
    You have to put in the root of your web host ;)
     
  48. theFluff

    theFluff

    Joined:
    Dec 1, 2013
    Posts:
    2
    Can you show us how to make a register script also that would be very helpful.
     
  49. sidrakhalid

    sidrakhalid

    Joined:
    Oct 15, 2013
    Posts:
    1
    is php nesacary to connect the desktop application made in unity using c#. how to get that?
    i will be thakful for ur reply.
     
  50. mescalin

    mescalin

    Joined:
    Dec 19, 2012
    Posts:
    67
    this was EXTREMELY helpful to me, I'll worry about security concerns and refactoring this into c# if need be but you have bootstrapped a new universe for me, thanks so much!