Jump to content

skym

Members
  • Posts

    253
  • Joined

  • Last visited

Posts posted by skym

  1. 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.

  2. $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.

  3. 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.

  4. 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.

  5. 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.

  6. 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>

  7. 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>

  8. 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: ... " );?>

  9. 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...