Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Letters in codes? (http://www.mysidiaadoptables.com/forum/showthread.php?t=3419)

SilverDragonTears 02-24-2012 05:26 PM

Can't wait for this!!

Hall of Famer 03-06-2012 01:20 AM

I created a function that allows you to generate an alphanumeric code of any length. You can also enable/disable generation of symbols. This function will be included in the functions.php file for Mys v1.3.0 release, but you can have it now if you cant wait for this. The symbols list does not include all available symbols, since some mess up the script. But anyway, Id say at least 80% of symbols can be generated successfully with this function.

SilverDragonTears 03-07-2012 01:17 AM

*makes grabby hands*

Hall of Famer 03-07-2012 02:03 AM

Sent to your PM box already, the function will be available in Mys v1.3.0 anyway.

SilverDragonTears 03-07-2012 03:36 PM

I must be missing some steps. It isn't working for me. Where do I put the example and do I need to change or add anything else?

Hall of Famer 03-07-2012 03:39 PM

umm first of all, if you have a field called code in database, make sure its type is varchar instead of int, since the latter only accepts numbers. You will need to copy/paste the function passgenerator() into your functions.php file, and then call it whenever you want to generate an alphanumeric code.

SilverDragonTears 03-07-2012 03:46 PM

Ok I see. But you never see that code. I guess I want the $aid to be letters.

Hall of Famer 03-07-2012 04:11 PM

I see, the id to be letters? This can be done too, but a bit more complicated. First of all, you must disable the primary key auto_increment setting for this field. Next, edit the aid data type from phpmyadmin to make it varchar(15). The last thing to do is to use the following script, which you should not have problem with:

PHP Code:

$aid passgenerator(15,0

Assume you do not want symbols in this field, since it is an id this should make sense. Be careful with what you do with adoptables id though, this field is predefined to be an auto-increment number and modifying this can lead to many potential problems in future.

SilverDragonTears 03-07-2012 09:20 PM

I got it working but I had to remove the is_numeric part through out a lot of the scripts. Hope that wasn't very important :ooo:

Hall of Famer 03-09-2012 07:49 AM

I dont suppose its important, since is_numeric() checks if a variable contains only numbers.


All times are GMT -5. The time now is 08:26 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.