Jump to content

dawsba

Members
  • Posts

    180
  • Joined

  • Last visited

    Never

Everything posted by dawsba

  1. sorry to take so long to reply, tis a saturday night afterall lol, asign your div id to somthing like id="thisdiv" or whichever have a script with the output code ready to generate such as ajaxresponse1.php in your running script do a js call either by function call or onclick event assign JS VAR getvars to whatever you need sending to remote script such as display=2&frog=froggy such as onclick="sndReq('thisdiv','ajaxresponse1.php?'+getvars)" now thisdiv should display what ever output ajaxresponse1.php has have fun function createRequestObject() { var ro; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ ro = new ActiveXObject("Microsoft.XMLHTTP"); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); var returnDiv function sndReq(divRet,file) { var date = new Date(); var timestamp = date.getTime(); returnDiv = divRet; http.open('get', file+'&time='+timestamp); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; document.getElementById(returnDiv).innerHTML = response; } }
  2. dude for an 80k salary if you cant figure your own scripting they will within a few weeks, so check the test before or else fails or deposit the money in my account before i do any work, but i think they'll notice a difference in coding level and CONFIDENCE. at the end of the day you'll be only cheating yourself.
  3. OK. but please post the get passkeys echos pre escape and after and if you can please echo the following code <?php $arr = array("_POST","_GET","_REQUEST"); foreach($arr as $k){foreach($$k as $k2=>$v){echo $k." -> ".$k2."--".$v."<BR>";} ?>
  4. wow theres alot of ajax stuff today works all browser supporting JS function createRequestObject() { var ro; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ ro = new ActiveXObject("Microsoft.XMLHTTP"); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); var returnDiv function sndReq(divRet,file) { var date = new Date(); var timestamp = date.getTime(); returnDiv = divRet; http.open('get', file+'&time='+timestamp); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; document.getElementById(returnDiv).innerHTML = response; } } function resetdefault(a,b) { document.getElementById(a).innerHTML = document.getElementById(b).innerHTML; }
  5. use this in your onclick event as onclick="sndReq('mydivthingymebob','pointstomyphp.php?thisvar=something')" <script> function createRequestObject() { var ro; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ ro = new ActiveXObject("Microsoft.XMLHTTP"); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); var returnDiv function sndReq(divRet,file) { var date = new Date(); var timestamp = date.getTime(); returnDiv = divRet; http.open('get', file+'&time='+timestamp); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; document.getElementById(returnDiv).innerHTML = response; } } function resetdefault(a,b) { document.getElementById(a).innerHTML = document.getElementById(b).innerHTML; } </script>
  6. ummmm, face book dont use true ajax, more or a beaten up version, chopped down crappy similarity FBML:// . you could write in javascript/ajax/php very simple i can send you a basic script that will do that, or you can use the old fashioned way of iframe refresh. let me know
  7. I agree with mchl, but I dont think best practise is to ask for the answers, if he were to figure out 95% of the problem and one small part eluded him/herself then being a home test seeking help is more than justified, why else would i sit here and try and help others. There is a fine line between asking for help and being given a handout!!!
  8. I dont have the extensions you have obviously so i just commeted them out, but uploads without error <?php session_start(); error_reporting(E_ALL); // Variables //----------------------------------------------------------------------------------------------------------- // DATABASE CONNECTIVITY //----------------------------------------------------------------------------------------------------------- $dbserver = "127.0.0.1"; $dbusername = "*******"; $dbpassword = "*******"; $dbname ="********"; $link=mysql_connect ($dbserver,$dbusername,$dbpassword) or die ('DB ERROR -> ' . mysql_error()); mysql_select_db ($dbname); /* mysql table CREATE TABLE `webdesig_upload`.`tbl_files` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `filename` TEXT NOT NULL , `path` TEXT NOT NULL , `size` INT NOT NULL , `ext` VARCHAR( 5 ) NOT NULL , `date` INT NOT NULL , `time` INT NOT NULL , `viewed` TINYINT NOT NULL DEFAULT '0', `downloaded` TINYINT NOT NULL DEFAULT '0', `locked` TINYINT NOT NULL DEFAULT '0' ) ENGINE = MYISAM */ //--------------------------------------------------------------------------------------------------------- // FUNCTIONS AND CLASSES etc function q($query,$assoc=1) { $r = @mysql_query($query); if( mysql_errno() ) { $error = 'MYSQL ERROR #'.mysql_errno().' : <small>' . mysql_error(). '</small><br><VAR>$query</VAR>'; echo($error); return FALSE; } if( strtolower(substr($query,0,6)) != 'select' ) return array(mysql_affected_rows(),mysql_insert_id()); $count = @mysql_num_rows($r); if( !$count ) return 0; if( $count == 1 ) { if( $assoc ) $f = mysql_fetch_assoc($r); else $f = mysql_fetch_row($r); mysql_free_result($r); if( count($f) == 1 ) { list($key) = array_keys($f); return $f[$key]; } else { $all = array(); $all[] = $f; return $all; } } else { $all = array(); for( $i = 0; $i < $count; $i++ ) { if( $assoc ) $f = mysql_fetch_assoc($r); else $f = mysql_fetch_row($r); $all[] = $f; } mysql_free_result($r); return $all; } } ?> <h2>Add Product</h2><? if(isset($_POST['action']) && $_POST['action'] == 'add_product'){ //Product Variables $cat_id = $_POST['cat_id']; $product_name = $_POST['product_name']; //main image $product_image[0] = $_FILES['product_image0']; //closeup images $product_image[1] = $_FILES['product_image1']; $product_image[2] = $_FILES['product_image2']; $product_image[3] = $_FILES['product_image3']; $product_image[4] = $_FILES['product_image4']; $product_image[5] = $_FILES['product_image5']; $product_image[6] = $_FILES['product_image6']; $product_image[7] = $_FILES['product_image7']; $product_image[8] = $_FILES['product_image8']; $product_description = $_POST['product_description']; //Image Types $AllowedImages = array('image/jpeg','image/pjpeg'); //Preverification of image filetypes for ($i=0; $i<count($product_image); $i++){ if (in_array($product_image[$i]['type'], $AllowedImages)){ $product_image_allowed = 1; //current image type is allowed } else { $product_image_allowed = 0; //current image type is not allowed break; //found an image type that's denied - quit the loop } } //Verification if(!empty($cat_id) && !empty($product_name) && !empty($product_description) && $product_image['error'] == 0 && $product_image_allowed == 1){ //Continue & Add to DB /* //process the images for ($i=0; $i<count($product_image); $i++){ $product_image_name[$i] = md5(microtime()).'.jpg'; //generate the filename if($product_image[$i]['error'] != 0) die('Error on Upload: '. $product_image[$i]['error']); //Write Original File //WriteFile($cfg['productimages']['original']['folder'].$product_image_name[$i], file_get_contents($product_image[$i]['tmp_name'])); //Create medium sized thumbnail $ImageFunctions->Open($cfg['productimages']['original']['folder'].$product_image_name[$i]); $ImageFunctions->Resize(245,184); $ImageFunctions->RawOutput(); WriteFile($cfg['productimages']['medium']['folder'].$product_image_name[$i], $ImageFunctions->Output['Content']); //Get Dimensions $Image[$i]['medium']['width'] = $ImageFunctions->Width; $Image[$i]['medium']['height'] = $ImageFunctions->Height; //Create smaill sized thumbnail $ImageFunctions->Open($cfg['productimages']['original']['folder'].$product_image_name[$i]); $ImageFunctions->Resize(65,49); $ImageFunctions->RawOutput(); //WriteFile($cfg['productimages']['small']['folder'].$product_image_name[$i], $ImageFunctions->Output['Content']); //Get Dimensions $Image[$i]['small']['width'] = $ImageFunctions->Width; $Image[$i]['small']['height'] = $ImageFunctions->Height; //End Image Processing }*/ for($i=0;$i<=8;$i++){$Image[$i]['small']['width']=1;$Image[$i]['small']['height']=1;$Image[$i]['medium']['width']=1;$Image[$i]['medium']['height']=1;$product_image_name[$i]="bob".$i;$product_name=$i."bobbys";$product_description="frogs";$cat_id=12;} $Query = "INSERT INTO `product_products`( `product_id`, `cat_id`, `product_name`, `product_slug`, `product_image0_name`, `product_image0_s_width`, `product_image0_s_height`, `product_image0_m_width`, `product_image0_m_height`, `product_image1_name`, `product_image1_s_width`, `product_image1_s_height`, `product_image1_m_width`, `product_image1_m_height`, `product_image2_name`, `product_image2_s_width`, `product_image2_s_height`, `product_image2_m_width`, `product_image2_m_height`, `product_image3_name`, `product_image3_s_width`, `product_image3_s_height`, `product_image3_m_width`, `product_image3_m_height`, `product_image4_name`, `product_image4_s_width`, `product_image4_s_height`, `product_image4_m_width`, `product_image4_m_height`, `product_image5_name`, `product_image5_s_width`, `product_image5_s_height`, `product_image5_m_width`, `product_image5_m_height`, `product_image6_name`, `product_image6_s_width`, `product_image6_s_height`, `product_image6_m_width`, `product_image6_m_height`, `product_image7_name`, `product_image7_s_width`, `product_image7_s_height`, `product_image7_m_width`, `product_image7_m_height`, `product_image8_name`, `product_image8_s_width`, `product_image8_s_height`, `product_image8_m_width`, `product_image8_m_height`, `product_description`) VALUES ( '', '$cat_id', '$product_name', '".$product_name."', '".$product_image_name[0]."', '".$Image[0]['small']['width']."', '".$Image[0]['small']['height']."', '".$Image[0]['medium']['width']."', '".$Image[0]['medium']['height']."', '".$product_image_name[1]."', '".$Image[1]['small']['width']."', '".$Image[1]['small']['height']."', '".$Image[1]['medium']['width']."', '".$Image[1]['medium']['height']."', '".$product_image_name[2]."', '".$Image[2]['small']['width']."', '".$Image[2]['small']['height']."', '".$Image[2]['medium']['width']."', '".$Image[2]['medium']['height']."', '".$product_image_name[3]."', '".$Image[3]['small']['width']."', '".$Image[3]['small']['height']."', '".$Image[3]['medium']['width']."', '".$Image[3]['medium']['height']."', '".$product_image_name[4]."', '".$Image[4]['small']['width']."', '".$Image[4]['small']['height']."', '".$Image[4]['medium']['width']."', '".$Image[4]['medium']['height']."', '".$product_image_name[5]."', '".$Image[5]['small']['width']."', '".$Image[5]['small']['height']."', '".$Image[5]['medium']['width']."', '".$Image[5]['medium']['height']."', '".$product_image_name[6]."', '".$Image[6]['small']['width']."', '".$Image[6]['small']['height']."', '".$Image[6]['medium']['width']."', '".$Image[6]['medium']['height']."', '".$product_image_name[7]."', '".$Image[7]['small']['width']."', '".$Image[7]['small']['height']."', '".$Image[7]['medium']['width']."', '".$Image[7]['medium']['height']."', '".$product_image_name[8]."', '".$Image[8]['small']['width']."', '".$Image[8]['small']['height']."', '".$Image[8]['medium']['width']."', '".$Image[8]['medium']['height']."', '$product_description')"; q($Query); echo $Query; echo '<p>Product Added.</p>'; } else{ echo '<p>Please ensure that you have filled in all fields correctly, and you have tried to upload a JPEG image.</p>'; } } ?> <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post" enctype="multipart/form-data"> <input type="hidden" name="action" value="add_product" /> <p>Category: <select name="cat_id"> <?php $Query = "SELECT * FROM `product_cats` ORDER BY `cat_name` ASC"; $Rows = q($Query); if($Rows == 0){ echo '<option disabled="disabled" value="stop">No Categories Found</option>'; } else{ $Result = q($Query); for($i=0;$i<$Rows;$i++){ echo '<option value="'.$Db->Result($Result, $i, 'cat_id').'">'.$Db->Result($Result, $i, 'cat_name').'</option>'; } } ?> </select> </p> <p>Product Name: <input type="text" name="product_name" /></p> <p>Product Image (main) (Jpeg Only): <input type="file" name="product_image0" /></p> <p>Closeup Image 1 (Jpeg Only): <input type="file" name="product_image1" /></p> <p>Closeup Image 2 (Jpeg Only): <input type="file" name="product_image2" /></p> <p>Closeup Image 3 (Jpeg Only): <input type="file" name="product_image3" /></p> <p>Closeup Image 4 (Jpeg Only): <input type="file" name="product_image4" /></p> <p>Closeup Image 5 (Jpeg Only): <input type="file" name="product_image5" /></p> <p>Closeup Image 6 (Jpeg Only): <input type="file" name="product_image6" /></p> <p>Closeup Image 7 (Jpeg Only): <input type="file" name="product_image7" /></p> <p>Closeup Image 8 (Jpeg Only): <input type="file" name="product_image8" /></p> <p>Product Description:</p> <p><textarea name="product_description" style="width:500px;height:250px;font-family:Arial, Helvetica, sans-serif;"></textarea></p> <p><input type="submit" value="Add Product" /></p> </form>
  9. can you echo $_GET['passkey'] & mysql_real_escape_string($_GET['passkey'])
  10. in your post review script have it update the database credit+1
  11. I'd go super simple, build a bullitin board / forum, not difficult work out your pages and then what data you collect and there you go, look into post , session and cookie variables
  12. My Best advice, buy a book and caffine tablets
  13. I'd suggest starting at looking into how arrays work not difficult once you get the basics. http://www.howtoforge.com/php_arraysgood site for details
  14. Also im using MyISAM as the table engine are you using Inno and I set product_id to primary key?
  15. Sorry I should know that, but it works absoloutly perfectly for me, anouther stupid question you are using mysql(dont think phpmyadmin do anything else) ? which version are you using. alos heres my code to test your query. <? $dbserver = "127.0.0.1"; $dbusername = "********"; $dbpassword = "*****"; $dbname ="******************"; $link=mysql_connect ($dbserver,$dbusername,$dbpassword) or die ('DB ERROR -> ' . mysql_error()); mysql_select_db ($dbname); function q($query,$assoc=1) { $r = @mysql_query($query); if( mysql_errno() ) { $error = 'MYSQL ERROR #'.mysql_errno().' : <small>' . mysql_error(). '</small><br><VAR>$query</VAR>'; echo($error); return FALSE; } if( strtolower(substr($query,0,6)) != 'select' ) return array(mysql_affected_rows(),mysql_insert_id()); $count = @mysql_num_rows($r); if( !$count ) return 0; if( $count == 1 ) { if( $assoc ) $f = mysql_fetch_assoc($r); else $f = mysql_fetch_row($r); mysql_free_result($r); if( count($f) == 1 ) { list($key) = array_keys($f); return $f[$key]; } else { $all = array(); $all[] = $f; return $all; } } else { $all = array(); for( $i = 0; $i < $count; $i++ ) { if( $assoc ) $f = mysql_fetch_assoc($r); else $f = mysql_fetch_row($r); $all[] = $f; } mysql_free_result($r); return $all; } } for($i=0;$i<=8;$i++){$Image[$i]['small']['width']=1;$Image[$i]['small']['height']=1;$Image[$i]['medium']['width']=1;$Image[$i]['medium']['height']=1;$product_image_name[$i]="bob".$i;$product_name=$i."bobbys";$product_description="frogs";$cat_id=12;} $Query = "INSERT INTO `products_products`( `cat_id`, `product_name`, `product_slug`, `product_image0_name`, `product_image0_s_width`, `product_image0_s_height`, `product_image0_m_width`, `product_image0_m_height`, `product_image1_name`, `product_image1_s_width`, `product_image1_s_height`, `product_image1_m_width`, `product_image1_m_height`, `product_image2_name`, `product_image2_s_width`, `product_image2_s_height`, `product_image2_m_width`, `product_image2_m_height`, `product_image3_name`, `product_image3_s_width`, `product_image3_s_height`, `product_image3_m_width`, `product_image3_m_height`, `product_image4_name`, `product_image4_s_width`, `product_image4_s_height`, `product_image4_m_width`, `product_image4_m_height`, `product_image5_name`, `product_image5_s_width`, `product_image5_s_height`, `product_image5_m_width`, `product_image5_m_height`, `product_image6_name`, `product_image6_s_width`, `product_image6_s_height`, `product_image6_m_width`, `product_image6_m_height`, `product_image7_name`, `product_image7_s_width`, `product_image7_s_height`, `product_image7_m_width`, `product_image7_m_height`, `product_image8_name`, `product_image8_s_width`, `product_image8_s_height`, `product_image8_m_width`, `product_image8_m_height`, `product_description`) VALUES ( '$cat_id', '$product_name', '".$product_name."', '".$product_image_name[0]."', '".$Image[0]['small']['width']."', '".$Image[0]['small']['height']."', '".$Image[0]['medium']['width']."', '".$Image[0]['medium']['height']."', '".$product_image_name[1]."', '".$Image[1]['small']['width']."', '".$Image[1]['small']['height']."', '".$Image[1]['medium']['width']."', '".$Image[1]['medium']['height']."', '".$product_image_name[2]."', '".$Image[2]['small']['width']."', '".$Image[2]['small']['height']."', '".$Image[2]['medium']['width']."', '".$Image[2]['medium']['height']."', '".$product_image_name[3]."', '".$Image[3]['small']['width']."', '".$Image[3]['small']['height']."', '".$Image[3]['medium']['width']."', '".$Image[3]['medium']['height']."', '".$product_image_name[4]."', '".$Image[4]['small']['width']."', '".$Image[4]['small']['height']."', '".$Image[4]['medium']['width']."', '".$Image[4]['medium']['height']."', '".$product_image_name[5]."', '".$Image[5]['small']['width']."', '".$Image[5]['small']['height']."', '".$Image[5]['medium']['width']."', '".$Image[5]['medium']['height']."', '".$product_image_name[6]."', '".$Image[6]['small']['width']."', '".$Image[6]['small']['height']."', '".$Image[6]['medium']['width']."', '".$Image[6]['medium']['height']."', '".$product_image_name[7]."', '".$Image[7]['small']['width']."', '".$Image[7]['small']['height']."', '".$Image[7]['medium']['width']."', '".$Image[7]['medium']['height']."', '".$product_image_name[8]."', '".$Image[8]['small']['width']."', '".$Image[8]['small']['height']."', '".$Image[8]['medium']['width']."', '".$Image[8]['medium']['height']."', '$product_description')"; if(q($Query)){echo "QUERY EXECUTED CORRECTLY";}else{echo "QUERY ERROR";} ?>
  16. your query is missing the auto increment field, i put that in and it worked 4 me. $Query = "INSERT INTO `product_products`( `product_id` `cat_id`, `product_name`, `product_slug`, `product_image0_name`, `product_image0_s_width`, `product_image0_s_height`, `product_image0_m_width`, `product_image0_m_height`, `product_image1_name`, `product_image1_s_width`, `product_image1_s_height`, `product_image1_m_width`, `product_image1_m_height`, `product_image2_name`, `product_image2_s_width`, `product_image2_s_height`, `product_image2_m_width`, `product_image2_m_height`, `product_image3_name`, `product_image3_s_width`, `product_image3_s_height`, `product_image3_m_width`, `product_image3_m_height`, `product_image4_name`, `product_image4_s_width`, `product_image4_s_height`, `product_image4_m_width`, `product_image4_m_height`, `product_image5_name`, `product_image5_s_width`, `product_image5_s_height`, `product_image5_m_width`, `product_image5_m_height`, `product_image6_name`, `product_image6_s_width`, `product_image6_s_height`, `product_image6_m_width`, `product_image6_m_height`, `product_image7_name`, `product_image7_s_width`, `product_image7_s_height`, `product_image7_m_width`, `product_image7_m_height`, `product_image8_name`, `product_image8_s_width`, `product_image8_s_height`, `product_image8_m_width`, `product_image8_m_height`, `product_description`) VALUES ( '', '$cat_id', '$product_name', '".Word2Slug($product_name)."', '".$product_image_name[0]."', '".$Image[0]['small']['width']."', '".$Image[0]['small']['height']."', '".$Image[0]['medium']['width']."', '".$Image[0]['medium']['height']."', '".$product_image_name[1]."', '".$Image[1]['small']['width']."', '".$Image[1]['small']['height']."', '".$Image[1]['medium']['width']."', '".$Image[1]['medium']['height']."', '".$product_image_name[2]."', '".$Image[2]['small']['width']."', '".$Image[2]['small']['height']."', '".$Image[2]['medium']['width']."', '".$Image[2]['medium']['height']."', '".$product_image_name[3]."', '".$Image[3]['small']['width']."', '".$Image[3]['small']['height']."', '".$Image[3]['medium']['width']."', '".$Image[3]['medium']['height']."', '".$product_image_name[4]."', '".$Image[4]['small']['width']."', '".$Image[4]['small']['height']."', '".$Image[4]['medium']['width']."', '".$Image[4]['medium']['height']."', '".$product_image_name[5]."', '".$Image[5]['small']['width']."', '".$Image[5]['small']['height']."', '".$Image[5]['medium']['width']."', '".$Image[5]['medium']['height']."', '".$product_image_name[6]."', '".$Image[6]['small']['width']."', '".$Image[6]['small']['height']."', '".$Image[6]['medium']['width']."', '".$Image[6]['medium']['height']."', '".$product_image_name[7]."', '".$Image[7]['small']['width']."', '".$Image[7]['small']['height']."', '".$Image[7]['medium']['width']."', '".$Image[7]['medium']['height']."', '".$product_image_name[8]."', '".$Image[8]['small']['width']."', '".$Image[8]['small']['height']."', '".$Image[8]['medium']['width']."', '".$Image[8]['medium']['height']."', '$product_description')";
  17. sorry, revised for($i=0;$i<=strlen($string);$i++) { if(preg_match("/^([a-z0-9\,])/i",substr($string,$i,1))){$new_string .= substr($string,$i,1);} } echo $new_string; ?>
  18. off the top of my head for($i=0;$i<=strlen($string);$i++) { if(preg_match("/^([a-z0-9])/i",substr($string,$i,1)){$new_string .= substring($string,$i,1);} } i have no doubt theres a better way of doing it but i just woke up
  19. presuming u only have 1 server if($_SERVER[REMOTE_ADDR] != $_SERVER[sERVER_ADDR]) die();
  20. sorry, i dont understand that one, can u explain what it is your trying to do.
  21. for laughs try the insert statement without the field list ie "insert into `products_products` VALUES(...........), let me know if it passes ok
  22. if you change filesize($link) to 1024 does it work you could try function getSizeFile($url) { if (substr($url,0,4)=='http') { $x = array_change_key_case(get_headers($url, 1),CASE_LOWER); if ( strcasecmp($x[0], 'HTTP/1.1 200 OK') != 0 ) { $x = $x['content-length'][1]; } else { $x = $x['content-length']; } } else { $x = @filesize($url); } return $x; } <- taken from php.net
  23. could you post the structure of products_products ?
  24. phparray??? what a bizare and strange reply...you do know that he only posted a snippet of code??
×
×
  • 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.