Jump to content

gristoi

Members
  • Posts

    840
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by gristoi

  1. ok, heres the revised function: <?php function register(){ $response = array(); $connect = mysql_connect("localhost", "username", "password"); if(!$connect){ $response[] = mysql_error(); return $response; } $select_db = mysql_select_db("db_name", $connect); if(!$select_db){ $response[] = mysql_error(); return $response; } $first = mysql_real_escape_string ($_POST['first']); $last = mysql_real_escape_string ($_POST['last']); $email = mysql_real_escape_string ($_POST['email']); $user = mysql_real_escape_string ($_POST['username']); $pass = mysql_real_escape_string ($_POST['password']); $conf_pass = mysql_real_escape_string ($_POST['conf_pass']); $ip = $_SERVER["REMOTE_ADDR"]; if(empty($username)){ $response[] = "Please enter your username!"; } if(empty($password)){ $response[] = "Please enter your password!<br>"; } if(empty($conf_pass)){ $response = "Please confirm your password!<br>"; } if(empty($email)){ $response[] = "Please enter your email!"; } $user_check = mysql_query("SELECT username FROM members WHERE username='$username'"); $do_user_check = mysql_num_rows($user_check); $email_check = mysql_query("SELECT email FROM members WHERE email='$email'"); $do_email_check = mysql_num_rows($email_check); if($do_user_check > 0){ $response[] = "Username is already in use!"; } if($do_email_check > 0){ $response[] = "Email is already in use!"; } if($password != $conf_pass){ $response[] = "Passwords don't match!"; } if(count($response) > 0 ){ return $response; }else { $insert = mysql_query("INSERT INTO members (`id`, `first`, `last`, `username`, `password`, `email`, `regIP`) VALUES (NULL , '$first', '$last', '$email', '$user', md5('$pass'), '$ip')"); if(!$insert){ $response[] = "There's a little problem: ".mysql_error(); } else { $response[] = "Congrats " . $username . "! You are now registered"; } return $response; } } how exactly are you executing this function, i cant see anyway for you to passs the data to the function. is the form on the same page as the function, and if it is you will need something like this at the top of the page: if($_POST['Register']){ $response = register(); } otherwise the function will never trigger. also the last part of the form will now need to handle an array: <?php if(isset($response)) echo "<p class='alert'>" . foreach($response as $r){ print $r.'</br>'; } . "</p>"; ?>
  2. SELECT bookings.*, refnums.* FROM bookings INNER JOIN refnums ON bookings.{whatever the foeign key column is called} = refnums.id WHERE bookings.date_booked = {whatever date you are looking for} ORDER BY refnums.id ASC
  3. your missing a comma between these two variables: , '$email' '$user', should be , '$email' , '$user', also you are trying to build up an error response, ie: if(empty($email)){ $response = "Please enter your email!"; } but you are not using the response variable correctly. just before you do the insert query you should be checking if response has a value, and if it does then dont execute the insert
  4. SELECT SUM(SUM(fieldhectares) + (SELECT SUM(landhectares) FROM tbllandutilities ) ) AS GrandTotal FROM `tblfield`; you can also use a join to get the required results
  5. grand total should start as an int or float, not as a string, and you need to make sure you are adding a number to a number, and that total is not returning a string - example: $grandTotal = 0; foreach($something as $sum){ $total = $total +$sum; $grandTotal += (float)$total; }
  6. is a long shot but do you have skype running on startup? I have had issues in the past where skype holds the port and stops apache starting
  7. phpretarded, i highy doubt thorpe needs to read up on encryption,seeing as he knows what he's talking about, but seeing as you want throw some insults around i would advise that YOU do some reading up on encryption as AES_DECRYPT and AES_ENCRYPT are both MYSQL functions and not PHP, so trying to meld them into a php statement is not going to work. you need to decrypt it in the sql statement. he forums here to help people with issues, not to insult one another. If you want to do that then by all means toddle of to facebook
  8. heres an example: SELECT details.* FROM Person INNER JOIN details USING(user_id) WHERE Person.user_id = 123 In plain english you are saying select everything from the details table where the user_id stored in the details table matches the one in the person table ADN where the persons user_id equals 123
  9. you will find that one of the most popular javascript frameworks used at the moments is JQuery. You should look into using that. I personally despise dreamweaver, and find it an appalling environment to code in. If you are looking for an IDE that supports javascript you can look at Aptana studio, spket and netbeans as alternatives to dreamweaver. But, even if you learn to use jquery , it is no replacement for learning the native javascript language too.
  10. you not handling the event correctly. you will need to pass the event into the function: $('a#home').click(function(e){ e.preventDefault()
  11. might be a bit of overkill, but have a look at wurfl: http://wurfl.sourceforge.net/php_index.php
  12. Short answer : yes. if you were using jquery then you could go something along the lines of $(document).keyDown(function(){ // check if the key pressed was the spacebar //if so run the function });
  13. Why are you using WAP? Am just curious as nearly every phone ( smartphones mainly) nowadays uses HTML5. Isnt WAP technology a bit redundant?
  14. you need to have a look at using a combination of PHP and AJAX, usually with something like JQUERY for managing the ajax. this will allow you to asynchronously refresh different areas of a page without having to reload
  15. have a google on using source control in projects, such as git, cvs, and subversion
  16. turn on your error chekcing and find out, add this to the top of your page: error_reporting(E_ALL);
  17. you need to serialise the data before you put it into the database: <?php //preparing for inserting into db $array = array(1,2,3,4,5,6,7); $readyForDb = serialize($array); //extracting from db $array = unserialize($row['from the db']);
  18. echo '<img class="placeMeLeft" src="'. $row['images'] .'" />'; and add this in your stylesheet: .placeMeLeft{ float:left; margin:5px }
  19. <form id="form1" name="form1" method="post" action="getdetails.php"> <input type="submit" name="Get Details" value="Get Details" /> </label> </p> </form> should be something like: <form id="form1" name="form1" method="post" action="getdetails.php"> username <input type="text" name="textfield" value ='' /> <input type="submit" name="Get Details" value="Get Details" /> </label> </p> </form>
  20. where are you declaring textfield in your form?
  21. for ($i=0, $n=count( $this->songs ); $i < $n; $i++) //for ($i=0, $n=count( $this->songs ); $i < $n; $i++) { if($k = 0){ break; }
  22. I agree with Chud37, works fine for me, must be somehing else in the script trimming it
  23. your trying to echo php within a string you are already building in php. try: <?php $imgsrc = get_post_custom_values("tj_video_img_url"); $igitwid_output .= '<div id="igit_wid_rpwt_main_image" style="float:left;"> <a href="' . get_permalink($igitwid_result->ID) . '" target="_top"><img src="'. $imgsrc[0] .'" id="igit_rpwt_thumb" ></a></div>'; as the last two lines of your code
  24. Before going thruogh all of the code you have posted, the one thing that stands out from your initial comment is that this worked on your dev environment. Have you checked that the file permissions on the new server are correct, and that the file can actually be uploaded / stored / read ?
  25. You will more than likely to listen for the keypress events being triggered, then when the Enter key i used trigger the send, so something like this: var message = $('#newMessage'); var code =null; message.keypress(function(e) { code= (e.keyCode ? e.keyCode : e.which); if (code == 13) { //code 13 is the enter key // run the send message event } e.preventDefault(); }); so you will be basically binding the listener to any even to do with the message window. hope this helps point you in the right direction
×
×
  • 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.