Jump to content

skym

Members
  • Posts

    253
  • Joined

  • Last visited

Everything posted by skym

  1. REQUEST also includes COOKIES, not only GET and POST.
  2. There is actually no $ operator in javascript. It could be used only in regular expressions.
  3. Also add id="user" to the username input and id="pass" to the password input.
  4. Depends on which one. I recently started to use fckEditor, but it doesn't have much of a documentation. They explain how to install the editor itself (which is very easy), but there is no documentation about how to configure the file-manager. It took me at least an hour to find it out.
  5. $query="select username from users where username='".mysql_real_escape_string($_REQUEST['requested_username'])."'";$result=mysql_query($query); if (mysql_affected_rows() > 0) { echo "Sorry that username is taken";} else { // Insert the username in the database} aspnetguy's solution would work too. Also mysql_affected_rows() can be replaced with mysql_num_rows($result). So you have at least 3 ways to do it.mysql_real_escape_string() is used to avoid SQL injections.
  6. It's not a problem the code between the input fields. Just add the <form ...> before the first field, and </form> after the submit button.You might also want to put form{display:inline;} in the CSS to take out the line brake that the </form> generates.
  7. I have shown you the way I would do it, there would be a php file of course to process the form data, anyway you don't want to use it, so it doesn't matter.Replace your inputs with: <form name="login" action="" method="get" onsubmit="LogIn(); return false;"><input name="username" id="user"><br><input name="password" type="password" id="pass"><br><input name="submit" type="submit" value=" GO "></form> Should work the same as your code if I understood it correctly, but with the 'enter' working too.
  8. <html><head><script type="text/javascript">function change(){document.getElementById('myBody').style.backgroundImage = 'url(img.gif)';}</script></head><body background="IMaGe.png" onLoad="change()" id="myBody"></body></html> http://www.w3schools.com/htmldom/dom_obj_style.aspBtw, use slashes, not backslashes for comments.
  9. Here's a code that works: <html><head><title></title></head><script type="text/javascript"><!--function checkFields(obj) { if (obj.username.value == "") alert("Please type your username!"); else if (obj.password.value == "") alert("Please type your password!"); else obj.submit(); }//--></script><body><form name="login" action="goto.php" method="get" onsubmit="checkFields(this); return false;"><input name="username"><br><input name="password" type="password"><br><input name="submit" type="submit" value=" GO "></form></body></html> You should not use Javascript for login, anybody can see the username and password.
  10. I did not test it, but there is the dl() function.http://ro.php.net/manual/en/function.dl.phpI think it has some limitations, though the comment of "endofyourself at yahoo dot com" might be interesting.
  11. If the button is submit type (type="submit") and the user did not focus outside the form fields, the Enter key should work.
  12. Hmm, sorry! I didn't see the setTimeout(), I saw your post when previewing my response for the topic.
  13. Use java script: http://www.w3schools.com/jsref/jsref_obj_date.asp (like aspnetguy just said before me).I have some code to show the date, day and clock, updates each second: <script type="text/javascript"><!--//var myMonths=new Array("January","February","March","April","May","June","July","August","September","October","November","December");var myDays= new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");today=new Date();thisDay=myDays[today.getDay()];thisMonth=myMonths[today.getMonth()];thisYear=today.getFullYear();thisDate=today.getDate();todaysDate=thisDay+", "+thisDate+" "+thisMonth+" "+thisYear;function myClock(){today=new Date();var theHours=today.getHours();if (theHours>11){theTimeSuffix="PM";}if (theHours>12)var theHours=theHours-12;else{theTimeSuffix="AM";}var theMinutes=today.getMinutes();if (theMinutes<10)var theMinutes="0"+theMinutes;var theSeconds=today.getSeconds();if (theSeconds<10)var theSeconds="0"+theSeconds;var theTimeNow=theHours+":"+theMinutes+":"+theSeconds+" "+theTimeSuffix;//document.formTime.textTime.value=theTimeNow;document.getElementById('time').innerHTML=theTimeNow;}var clockWork=setInterval("myClock()",1000);//--></script><script type="text/javascript"><!--document.write(todaysDate);//--></script>- <span id="time"></span>
  14. The only solution I see is to use XML as database. Javascript can read XML files. It's probably slow with large amount of data, but it doesn't need anything to be installed.
  15. Yes, and there already is a foreach to print the input fields, but those were not contained within the <form> tags. So this should be enough: <?phpforeach($_POST as $key => value){ $_POST[$key] = stripslashes(trim(str_replace("'","",$_POST[$key])));}print "Name: {$_POST['fieldname']}<br/>";print "Address: {$_POST['fieldaddress']}<br/>";print "City: {$_POST['fieldcity']}<br/>";print "State: {$_POST['fieldstate']}<br/>";print "Zip: {$_POST['fieldzip']}<br/>";print "Phone: {$_POST['fieldphone']}<br/>";print "Fax: {$_POST['fieldfax']}<br/>";print "Email: {$_POST['fieldemail']}<br/>";?><form action="/about/programs/rust-watchers/apply-for-rust-watchers/mailapp.php" method="post"><?phpforeach($_POST as $key => $value){ print "<input type=\"hidden\" name=\"{$key}\" value=\"{$value}\" />";}?><input type="submit" name="submit" value="Send Email"><input type="submit" name="submit" value="Edit Info"></form>
  16. skym

    Forms and Mailing them.

    That's completely wrong, and it's not that complicated. mail() has 5 parameters ("things") indeed, and the 3rd parameter is the message, and only the 3rd. In your case the correct code would be: <?php$email = $_REQUEST['email'];$message = $_REQUEST['message'];$name = $_REQUEST['name'];$name2 = $_REQUEST['name2'];$Land = $_REQUEST['Land'];$message="First Name: $name \r\nLast Name: $name2 \r\nCountry: $Land \r\nMessage: $message \r\n";mail( "andy@ichpuchtli.com", "Form Thing.",$message, "From: $email" );header( "Location: ... " );?>
  17. How about arsort() ?http://ro2.php.net/manual/en/function.arsort.phpTo access the keys of an array use can use foreach().
  18. You will find the answer here: http://dev.mysql.com/doc/refman/4.1/en/alter-table.html
  19. skym

    function error

    What error and which is the line 5?I guess it must be where the closing bracket is, the text after it isn't commented (those //).
  20. Not sure, I don't have yet much experience with regular expressions, so it might be wrong but try:SELECT * FROM dict WHERE word REGEXP '^[A-E]';http://dev.mysql.com/doc/refman/4.1/en/regexp.html
  21. skym

    encode php

    http://www.zend.com/products/zend_guard
  22. skym

    Case Sensitivity

    http://dev.mysql.com/doc/refman/4.1/en/case-sensitivity.html
  23. skym

    Blog-like DB structure

    I usually make a column named ID, int type, unsigned, auto_increment, primary key, for every table, even if it will never actually be used. So what you are saying sounds very logical.
×
×
  • Create New...