Jump to content

moltm4785

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by moltm4785

  1. Nevermind I figured it out, when your talking about a type jquery everything is accessed by index so ui.sender[0] gives the object as being an li object which then allows for ui.sender[0].id which gives that li objects id.
  2. I get that but in any instance when you have an object don't they always state there name? So how do you access this one since its this. The item I am trying to work with is sender. ui Type: Object helper Type: jQuery The jQuery object representing the helper being sorted item Type: jQuery The jQuery object representing the current dragged element offset Type: Object The current absolute position of the helper represented as { top, left } position Type: Object The current position of the helper represented as { top, left } originalPosition Type: Object The original position of the element represented as { top, left } sender Type: jQuery The sortable that the item comes from if moving from one sortable to another
  3. What I am trying to do is once you have activated sortable there is a piece called recieve which is an event that is triggered when the connected sortable list accepts something once that is activated you get function(event, ui) the ui has a element in it called sender so ui.sender and sender in itself has an element that is an object that is the sender itself but when you use a loop of $.each(ui.sender, function(name, sender) to see each element in it all it gives is 0:object but I dont' understand how to access this object outside of the $.each since when I do a loop on say ui it stats each piece like sender:object and a view others wchich means to access each you do ui.element like ui.sender. but ui.sender.something is what I'm confused on because all i have is a 0: here and not sure how to grab that. I tried .item(0) this errors out the page and i tried .0 that errors out the page .id gives null of course because the ui.sender.element where element is still technically an object. Hope this helps you understand what I am looking for.
  4. Why don't you use ajax with jquery I'm pretty sure there is a way to do cross site interaction.
  5. A bit of background I am working with the jquery.ui sortable and have run against a bump. When you do the below code you get the following: 0:[object HTMLUListElement]. I need to know how you are supposed to access this objects elements. I don't understand the 0 part for the name. I've tried .item(0) but that errors the page out. $(function() { $('#sort1, #sort2').sortable({ connectWith : '.sort', receive : function(event, ui) { $.each(ui.sender, function(name, value) { alert(name + ': ' + value); }); } }); });
  6. Wait thats confusing ok, you want $high1name == "open" $high1name == "ANYTHING ELSE" $high1name == "" if the second one is going to be anything else what is the logic situation that would occur to reach the else statement?
  7. So here is the code with changes, I highlighted what I was talking about with the sanitizing factor. Something that always confused me if $current_table is empty or doesn't exist the page will still run fine and the point or error would still be the same would it not, the query is going to error out. I get its good coding but is that generally a good take on it? <?php mb_internal_encoding("UTF-8"); session_start(); $ROOT_URL = $_SESSION['ROOT_URL']; $ROOT_DIR = $_SESSION['ROOT_DIR']; include $ROOT_DIR . 'dbconnection/dbconnection.php'; $current_table = $_POST['table_name']; $SALT = 'aB1cD2eF3G'; $date_time = date('Y/m/d H:i'); $column_names_array = array(); $column_values_array = array(); $query = $mysqli -> query("SHOW COLUMNS FROM `$current_table`;"); while ($fetch = $query -> fetch_array()) { $_POST[$fetch[0]] = (!is_array($_POST[$fetch[0]])) ? $mysqli->real_escape_string($_POST[$fetch[0]]) : $_POST[$fetch[0]]; if (preg_match('/(created|modified)/', $fetch[0])) { array_push($column_names_array, $fetch[0]); array_push($column_values_array, $date_time); } elseif (is_array($_POST[$fetch[0]])) { array_push($column_names_array, $fetch[0]); array_push($column_values_array, $mysqli -> real_escape_string(join(',', $_POST[$fetch[0]]))); } elseif (!empty($_POST[$fetch[0]])) { $_POST[$fetch[0]] = (preg_match('/password/i', $fetch[0])) ? sha1($SALT . $_POST[$fetch[0]]) : $_POST[$fetch[0]]; array_push($column_names_array, $fetch[0]); array_push($column_values_array, $_POST[$fetch[0]]); } } $query = "INSERT INTO " . $current_table . "(`" . join("`,`", $column_names_array) . "`) VALUES ('" . join("','", $column_values_array) . "')"; $query_result = ($mysqli -> query($query)) ? true : false; echo $query_result; ?>
  8. I agree thats what I'm building is my own framework. First Thanks for the info but two things 1. Your right I don't really need to unset the table but for other reasons 2. Can you go into more detail on 2b of first section I had it setup to sanitize everything regardless of what it was but the array would error everything out and so I set it up so that it gets bypassed and then sanitized within the if statement of if(isarray($var)) I will go ahead and put those changes you talked about, also I have my full paths starting at the index page itself. Is there a better way to set your paths in one spot and then allow them to propgate throughout the entire site without using sessions?
  9. Your issue is either here $result= mysql_query($db,$query) or die("Error in insertion"); normally you should have the below: $mysqli = new mysqli("localhost", "USERNAME", "PASSWORD", "DATABASE"); $query = $mysqli -> query("insert into info (first, last, email) values ('$first','$last','$email')"); OR $query= "insert into info (first, last, email) values ($first,$last,$email)"; you are stating "($first,$last,$email)" this should be: ('$first', '$last', '$email')
  10. Well for one it doesn't appear that your calling the function any where i.e.: function test(){ echo 'hi'; } test(); and also your missing a "}" for one of your items not sure which one also if your running $_POST you need to retrieve the data to I'm assuming push into that function so: activites($_POST['paintballing'], $_POST['ice_skating'], $_POST['horse_riding'], $_POST['para_gliding'], $_POST['water_rafting'] ); would be your function call. Is this useful?
  11. Wondering if the below can be made any more efficient and just for those wondering I like writing my own functions I don't like using frameworks. mb_internal_encoding("UTF-8"); session_start(); $ROOT_URL = $_SESSION['ROOT_URL']; $ROOT_DIR = $_SESSION['ROOT_DIR']; include $ROOT_DIR . 'dbconnection/dbconnection.php'; //UNSETS THE TABLE NAME AND ID SO IT ISN'T PART OF THE LOOP $current_table = $_POST['table_name']; $SALT = 'xxxxxxxxxx'; $date_time = date('Y/m/d H:i'); $column_names_array = array(); $column_values_array = array(); $query = $mysqli -> query("SHOW COLUMNS FROM `$current_table`;"); while ($fetch = $query -> fetch_array()) { $_POST[$fetch[0]] = (!is_array($_POST[$fetch[0]])) ? $mysqli->real_escape_string($_POST[$fetch[0]]) : $_POST[$fetch[0]]; if (preg_match('/(created|modified)/', $fetch[0])) { array_push($column_names_array, $fetch[0]); array_push($column_values_array, $date_time); } elseif (is_array($_POST[$fetch[0]])) { array_push($column_names_array, $fetch[0]); array_push($column_values_array, $mysqli -> real_escape_string(join(',', array_unique($_POST[$fetch[0]])))); } elseif (!empty($_POST[$fetch[0]])) { $_POST[$fetch[0]] = (preg_match('/password/i', $fetch[0])) ? sha1($SALT . $_POST[$fetch[0]]) : $_POST[$fetch[0]]; array_push($column_names_array, $fetch[0]); array_push($column_values_array, $_POST[$fetch[0]]); } } $query = "INSERT INTO " . $current_table . "(`" . join("`,`", $column_names_array) . "`) VALUES ('" . join("','", $column_values_array) . "');"; $query_result = ($mysqli -> query($query)) ? true : false; echo $query_result;
×
×
  • 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.