Jump to content

tartis

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tartis's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Here is what I am using for file uploads. ($_FILES["uploaded"]["size"] < 20000000))
  2. strtolower() did the trick. Thanks to both of you.
  3. I am trying to check for category names in my database using PHP and MYSQL. The problem is that if I enter a new platform name in lower case, I am still able to enter a duplicate in upper case, or just the opposite. As an example, if I create a platform named xxx, my code keeps me from creating a new one in the same case. If I try XXX it creates the new duplicate record. I can never again use xxx, but I can always duplicate XXX. I hope that that makes sense. Here is the code: <?php $con = mysql_connect("servername", "username", "password"); if (!$con) { echo "<h2>Sorry, we cannot process your request at this time, please try again later</h2>\n"; echo "<a href=\"index.php?content=newquestion\">Try again</a><br>\n"; echo "<a href=\"index.php\">Return to Home</a>\n"; exit; }mysql_select_db("knowledge", $con) or die('Could not connect to database'); $plat_name = $_POST['plat_name']; $baduser = 0; // Check if platform name was entered if (trim($plat_name) == '') { echo "<h2><br><br>Sorry, you must enter a new platform name.</h2><br>\n"; echo "<a href=\"index.php?content=newplatform\">Try again</a><br>\n"; echo "<a href=\"index.php\">Return to Home</a>\n"; $baduser = 1; exit; } //Check if Platform is already in database $query = "SELECT plat_name from platform where plat_name = '$plat_name'"; $result = mysql_query($query); $row = mysql_fetch_array($result, MYSQL_ASSOC);if ($row['plat_name'] == $plat_name) { echo "<h2>Sorry, that Platform name is already taken.</h2><br>\n"; echo "<a href=\"index.php?content=newplatform\">Try again</a><br>\n"; echo "<a href=\"index.php\">Return to Home</a>\n"; $baduser = 1; }if ($baduser != 1) { //Everything passed, enter question into database $query = "INSERT into platform (plat_name) VALUES ('$plat_name')"; $result = mysql_query($query) or die('Sorry, we are unable to process your request.' . mysql_error()); } ?>
  4. I found this code on the web a few weeks ago, and it creates a readable password. I would then insert it using encryption. //password generator function ae_gen_password($syllables = 3, $use_prefix = false) { // Define function unless it is already exists if (!function_exists('ae_arr')) { // This function returns random array element function ae_arr(&$arr) { return $arr[rand(0, sizeof($arr)-1)]; } } // 20 prefixes $prefix = array('aero', 'anti', 'auto', 'bi', 'bio', 'cine', 'deca', 'demo', 'dyna', 'eco', 'ergo', 'geo', 'gyno', 'hypo', 'kilo', 'mega', 'tera', 'mini', 'nano', 'duo'); // 10 random suffixes $suffix = array('dom', 'ity', 'ment', 'sion', 'ness', 'ence', 'er', 'ist', 'tion', 'or'); // 8 vowel sounds $vowels = array('a', 'o', 'e', 'i', 'y', 'u', 'ou', 'oo'); // 20 random consonants $consonants = array('w', 'r', 't', 'p', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm', 'qu'); $password = $use_prefix?ae_arr($prefix):''; $password_suffix = ae_arr($suffix); for($i=0; $i<$syllables; $i++) { // selecting random consonant $doubles = array('n', 'm', 't', 's'); $c = ae_arr($consonants); if (in_array($c, $doubles)&&($i!=0)) { // maybe double it if (rand(0, 2) == 1) // 33% probability $c .= $c; } $password .= $c; // // selecting random vowel $password .= ae_arr($vowels); if ($i == $syllables - 1) // if suffix begin with vovel if (in_array($password_suffix[0], $vowels)) // add one more consonant $password .= ae_arr($consonants); } // selecting random suffix $password .= $password_suffix; return $password; } $password = ae_gen_password(3, false); //end password
  5. Have you checked out the PayPal developers site? They have examples on how to do this. https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/home_US
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.