Jump to content

denismm778

New Members
  • Posts

    2
  • Joined

  • Last visited

denismm778's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. This is my HTML code: <form class="stdform" action="php/sp1img.php" method="post"> <p name="title"> <label>Image:</label> <span class="field"> <input type="file" name="sponsupload1" /> </span> <p class="stdformbutton"><button class="btn btn-primary">Save!</button></p> </p></form> And here is my PHP script called "sp1img.php" : <?php session_start(); $con = mysql_connect("localhost","***","***"); mysql_query("SET NAMES UTF8"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("***", $con); $allowedExts = array("jpg", "jpeg", "gif", "png"); $extension = end(explode(".", $_FILES["file"]["name"])); if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000) && in_array($extension, $allowedExts)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br>"; echo "Type: " . $_FILES["file"]["type"] . "<br>"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); $sql = mysql_query("TRUNCATE TABLE sp1img"); $qry= "INSERT INTO `sp1img` (`ImgCode`) VALUES ('". www.dsaidov.com/velto/admin/upload/$_FILES["file"]["name"] ."')"; header("location: ../sponsors.php"); exit(); } } } else { echo "Invalid file"; } mysql_close($con); ?> And when I choose file and click Save! it is always giving me Invalid File!, I really can't understand what is wrong. I hope you can help me. Kind Regards, Denis Saidov
  2. Hey guys, I've created a script that generate a random word of many words. For example I click the mix button and I receive the word: "book" ------------ I would like to create another button that, when I click it to show me the translation of the word (which is added in the script manually) When I click mix again, to remove the old translation "book" and the english word "book", and to randomly appear another word, for ex. "green", when I click the second button to show again a box with translation and so on... --------- I've created only the english word mixer, and I don't know how to create the translation. I'll be very happy and pleased if you can help me with making this, cuz will help me a lot. <script language="Javascript"> <!-- // Use the following variable to specify the number of random words var NumberOfWords = 28 var words = new BuildArray(NumberOfWords) // Use the following variables to define your random words: words[1] = "czarevitch" words[2] = "brightwork" words[3] = "verkrampte" words[4] = "protectrix" words[5] = "nudibranch" words[6] = "grandchild" words[7] = "newfangled" words[8] = "flugelhorn" words[9] = "mythologer" words[10] = "pluperfect" words[11] = "jellygraph" words[12] = "quickthorn" words[13] = "rottweiler" words[14] = "technician" words[15] = "cowpuncher" words[16] = "middlebrow" words[17] = "jackhammer" words[18] = "triphthong" words[19] = "wunderkind" words[20] = "dazzlement" words[21] = "jabberwock" words[22] = "witchcraft" words[23] = "pawnbroker" words[24] = "thumbprint" words[25] = "motorcycle" words[26] = "cryptogram" words[27] = "torchlight" words[28] = "bankruptcy" function BuildArray(size){ this.length = size for (var i = 1; i <= size; i++){ this[i] = null} return this } function PickRandomWord(frm) { // Generate a random number between 1 and NumberOfWords var rnd = Math.ceil(Math.random() * NumberOfWords) // Display the word inside the text box frm.WordBox.value = words[rnd] } //--> </script> <form name="WordForm" align="center"> <input type="TEXT" size="40" name="WordBox"><br><br> <input type="BUTTON" onclick="PickRandomWord(document.WordForm)" value="Разбъркай!"> </form> Kind Regards, D.Saidov
×
×
  • 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.