Jump to content

Jerzxu

Members
  • Posts

    53
  • Joined

  • Last visited

Everything posted by Jerzxu

  1. Your if statement doesn't have the {}'s in it. unlink('config.php'); move_uploaded_file($_FILES['upload']); if ($_FILES['upload']['name']!=config.php){ rename("$_FILES['upload']['name']","config.php"); echo "ok"; }
  2. Hello and Good Morning, so here's my question. Basically, I need an alternative to mime_content_type and fileinfo. Reason behind Fileinfo is becuase for some reason I can't get it to work whatsoever, and it's installed on my webserver (Host installed it). It says: Fatal error: Call to undefined function finfo_open(). I asked a fellow PHP programmer and she said that it sounds like they didn't install it. They reinstalled it and it's still the same. As for the mime_content_type, which works well, except it only returns the mimes .jpg, and .gif, meaning that .png, .zip, .rar etc. get put out as text/plain which is bad. Becuase I am trying to limit the mime types to certain ones. So basically if theres a fix for either of these or an alternative to those it would be helpful to have.
  3. Okay basically I want AJAX and PHP to communicate together to real time update things. The problem is that it updates, but if I type in the user name I want to register (I have one put in the database) it doesn't change the text to: "User name unavailable" Below are my codes: <p><b>Email</b><br /> <input type="text" onkeyup="showEmail(this.value)" name="email" align="absmiddle"/><span id="txtemail"></span> <br /> That is the email form text box // JavaScript Document var xmlHttp function showEmail(str) { if (str.length==0) { document.getElementById("txtemail").innerHTML=" No Email Entered" return } xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="email.php" url=url+"?q="+str url=url+"&sid="+Math.random() xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtemail").innerHTML=xmlHttp.responseText } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } the javascript code <?php $dbh=mysql_connect ("localhost", "**********", "******") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("********"); $q=$_REQUEST["q"]; $result=""; if (strlen($q) > 0) { $result = mysql_query("SELECT * FROM emails"); { if ($q != $result) { $response=" Email is Avaible"; } else { $response=" Email is Already Regristered"; } } } echo $response; ?> the PHP code. The database has one user added into it but when typed it doesn't change the text to: Email is Already Regristered.
×
×
  • 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.