Jump to content

s0c0

Members
  • Posts

    422
  • Joined

  • Last visited

    Never

Everything posted by s0c0

  1. So I gather that someone clicks on a link, technically remains within the same page (we will call this page index.php), but a new page is included? That is strange and horrible for SEO. Are you sure that you don't need to use absolute paths in the file_exists function? What happens when you run this? Is it even making it into the IF block that contains the include function? What steps have you taken to troubleshoot this... ps. please format code pretty <? if (isset($_GET['page'])) { $page = $_GET['page']; } else { $page = "home"; } if(file_exists("$page.php")) { include("$page.php"); } else { echo "Sorry but the page you requested doesn't appear to exist."; } ?>
  2. You're host may not allow destroying sessions, I've never heard of a host doing this, but then again I've always been more of a root type of guy. Have you tried manually resetting the $_SESSION values on log out. Like... $_SESSION['username'] = ''; unset($_SESSION['username']); Perhaps if you post the code that builds the session and the code that handles authentication the folks on here can better assist you :-\
  3. Wow, thanks for all the responses. Unfortunately there looks to be no consensus. I would love to learn something lower level such as C, but I would like to go with something a bit more practical for a web developer first. I think for now I will go with Perl, followed by Python or Ruby.
  4. The question mark one is pretty good. How long did it take you to learn how to do that? Graphics is definitely a weak point for me. Maybe you could point me to some resources.
  5. What assholes. I hope you learned to get a little bit upfront next time or a contract at least. I've required enough up front so I don't get burned or a contract every since I did some I/T consulting on the side a few years ago. Luckily my lesson only cost me a few hundred. Has anyone suggested namepros.com or how about craigslist. Good luck buddy.
  6. There are still a few things I'd like to learn in PHP, but I think I have a strong grasp of the language (been programming in PHP for a year). The other thing I want to learn is building SOAP applications on both ends and I've ordered some books on the matter. I also want to solidify my MySQL knowledge and have ordered a book on Intermediate to Advanced MySQL stuff and one dedicated to stored procedures. The only other language I know is javascript, mainly Ajax implementations. I still have a ways to go with that, but I am pleased with what I've learned of Ajax in 6 months. I'm a beginner-to-intermediate user in Linux, but I am by no means married to a platform. What I am wondering is what would be the next best language to learn. I am a web developer and like web development and I have virtually no experience with any other languages. Any ideas? I'd like to find one that will give me the best return on my investment (salary/career-wise and making me a better programmer).
  7. Well there will be bugs, bugs even after being beta tested. If you don't get it beta tested just hope that you found all the nasty an demoralizing ones.
  8. first verify you get anything in the $_POST by doing a print_r($_POST). It looks like your form name for the start is startLength whereas you are attempting to extract data from $_Post[startLength]. See the difference, one is capitalized, this will cause a problem. Basically if the data is in both $_POST elements for the start and end you should just need to those two $_POST elements together, number format them, and display to the screen.
  9. i updated the original post, second solution is the one i would implement.
  10. s0c0

    iphone?

    Using javascript you can in fact dynamically set what css file to use.
  11. The simplest solution in PHP? Add a checkbox to your form. If the checkbox is checked it means you want to update the image, if not then you don't want to update the image. So when you sql update code receives the POST data if the checkbox value equals 1 or whatever you will embed a variable in the update syntax for your image inside the sql query, otherwise that variable equals nothing or ''. Make sense? There are better solutions to this, but if you are satisfied with this then congrats. EDIT The better solution is to check whether or not the $_FILES array contains anything. If it does not then don't update the image else update it. You would use the same variable type thing I noted above in your sql statement: if($_FILES['image6']['name']!='') { $imgUpdate = 'SET image = '.$whateverBlah; } else { $imgUpdate = ''; } $sql = "UPDATE someTable SET name='whatever your code is'".$imgUpdate." WHERE id=$id";
  12. I am using the Services_JSON class since we are running PHP 4.3. I have successfully converted simple arrays from javascript to json to php and then back again in fiddling around with this, but now I am actually trying to do something useful. In javascript I have built an array of objects like so: productsArr[prodCount] = new product_Constructor(id,product,price,fluxCost,discountable,qty,taxable,1); the "prodCount" variable is simply an auto-incrementing integer used for unique array indexes and the "product_Constructor" is just the constructor for my product object, the object is stored in and referenced by the array index. Don't concern yourself with where I get the variables I pass into the constructor as this works fine. Using an Ajax HTTP POST I pass this array over server side, the array ends up looking like this: [null,{"id":"4534","name":"MaMa Lotion Trial Pack","price":"8.95","fluxCost":"3.3","discountable":"0","qty":"1","taxable":"0","inCart":1},{"id":"290","name":"SkinCareRx Kit for Men","price":"65.00","fluxCost":"32.5","discountable":"0","qty":"1","taxable":"0","inCart":1}] When it hits the php side I use the following code: $productsArr = $this->json->decode(stripcslashes($productsJSON); // build array from json text foreach($productsArr as $prod) { echo $this->json->decode($prod); } But I get nothing. If I echo out the json text my PHP function receives it mirrors what was sent. If I do a print_r on the array it shows empty elements. Not even the json text is present in anywhere in the array. Why is this? Now before you question me, an array of objects was not my first choice. My initial choice was a multidimensional array to be converted into json text and then passed into PHP. I had problems converting a multidimensional array into json text with the latest version the json.js file though. Any help is appreciated.
  13. From what I'm reading I now have to construct my arrays in an extremely retarded manner looking like this: var a = ["chris"]; In order to stringify them. If someone could show me the syntax for a 2 dimensional array I would be very happy.
  14. I have a 2 dimensional javascript array, that I want to pass over to a PHP function via Ajax. When I use the json2.js file located here http://json.org/js.html for implementing json in javascript I don't get a jsonized array at all. Here is my code: var prodArr = JSON.stringify(productsArr); I think it is expecting that I am sending it an object. Prior to this I had been using the json.js file instead of json2.js and it worked fine using the toJsonString method. Not sure why they took this out of the new json, but I had to start using it since the original json conflicted with the mootools framework. Did I mention I really hate javascript sometimes and I am tired of typing json. Any help on this?
  15. Tricky. You need a way to determine when the last image has finished loading. For hiding the images loading simply set them inside a div block with display:none <div id="imgDiv" style="width:auto; height:auto; display:none; z-index:50;"> </div> <div id="loading" style="width:auto; height:auto; z-index:100;"> <img src="loading.gif"> </div> You must position the loading div on top of the imgDiv. When the images are finished loading the following javascript must execute: document.getElementById("imgDiv").style.display = 'block'; document.getElementById("loading").style.display = 'none'; but instead of block you may want to use inline. It is up to you to find out how to determine when the images have stopped loading. I presume javascript has a built in function for determining when the page has completed loading. Just google that.
  16. I have a 2 dimensional javascript array, that I want to pass over to a PHP function via Ajax. When I use the json2.js file located here http://json.org/js.html for implementing json in javascript I don't get a jsonized array at all. Here is my code: var prodArr = JSON.stringify(productsArr); I think it is expecting that I am sending it an object. Prior to this I had been using the json.js file instead of json2.js and it worked fine using the toJsonString method. Not sure why they took this out of the new json, but I had to start using it since the original json conflicted with the mootools framework. Did I mention I really hate javascript sometimes and I am tired of typing json. Any help on this?
  17. If its possible I bet you can find out on php.net or phpclasses.org
  18. it looks like you got the idea from some other site...
  19. Your question could have many answers, I would be more specific. If you are looking for the key with the highest value in an array use the max() function.
  20. Well you really need to get a book and just learn. You will have the basics of Ajax down in 2 months along with some nifty DOM tricks, less than that if you are smarter than me Basically your onsubmit in your example calls validateAddToCart(1); function. That 1 as the parameter in the function call you need that, its not the best way to do this, but it prevents you from needing a second function for your call back. I'm still learning so thats how I do it for now, someone here will criticize me for it I am sure. Anyways: <script type="text/javascript"> /** * setXMLHttpRequestObject - set the xml http request object */ function setXMLHttpRequestObject() { XMLHttpRequestObject = false; if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest(); } else if (window.ActiveXObject) { XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP"); } } /** * httpPost - execute an HTTP POST */ function httpPost(url, params, stateChangeFunc) { if(XMLHttpRequestObject) { XMLHttpRequestObject.open("POST", url, true); XMLHttpRequestObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); XMLHttpRequestObject.setRequestHeader("Content-length", params.length); XMLHttpRequestObject.setRequestHeader("Connection", "close"); XMLHttpRequestObject.send(params); XMLHttpRequestObject.onreadystatechange = stateChangeFunc; } } /** * validateAddToCart - update shopping cart */ function addToCart(val) { if(val==undefined) { if(XMLHttpRequestObject.readyState==4 && XMLHttpRequestObject.status==200) // handle http return { try { // put in your user notification here. You can figure that out yourself, use DOM or a dumb alert if lazy } catch(err) { alert('an error occured'); } } } else // make http request { var params = 'func=validateAddToCart' httpPost('YOUR_PHP_PAGE_HERE.php', params, validateAddToCart); } } </script> Now at the top of your PHP page have this: /* POST: determine which function the HTTP POST request wants */ if($_POST[func]) { switch($_POST[func]) { case 'validateAddToCart': PUT YOUR PHP CODE HERE OR YOUR PHP FUNCTION CALL break; } return; } If you can't figure that out then you need to get a book. You need to get a book anyways.
  21. Yes your best bet is to script this, your script you will need to have two database connections using one for the select and the other for the insert. Your other option is to move the actual table file. This is only advisable (and really not advisable) if you don't mind losing whatever unique information is in the table your are overwriting. It will require a database restart. If I were you I would go with the script much as ainoy31 suggested.
  22. No stick with that line of thought. Where in the example I gave for the $dataArr array, just make it multi-dimensional. That way you can foreach through that array and display multiple pieces of data for that day. For instance: foreach($dataArr[cellArr[$i]] as $data) { echo $data.'<br/>'; } Something like that, do you follow? Multidimensional array is essentially an array of arrays, but you do not want to have to manage multiple separate arrays.
  23. I wouldn't be the right person to ask if it is better or worse, but its obviously easier and there aren't really any downsides. The portion after the -resize argument is where you are telling the command to save the file. In the example I gave, I am just over writing the existing file.
  24. hmmm.... The rest of what I said is valid?
×
×
  • 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.