Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. Seems pretty cool. A tiny bit slow, but thats because you are using AJAX requests I would assume. Quite nice and simplistic for a small chat room. May have some problems scaling though. THe color scheme is also a little meh but I'm assuming its just a mockup to make sure the functionality is correct
  2. Well like I said, I have no idea how your script, or your objects work at all. I have never used or seen the specific library you are using, so I apologize that I can't offer you a code solution, but I simply don't know what to tell you without more information. On other forums, the other posters may have more experience with your library. Why don't you try posting this question on a forum that seems to get better answers? That seems to be the logical solution, because no one else seems to be able to help, and I'm the only one who's even trying to give it a shot. Perhaps one of the more experienced members will know or have seen this library, and offer a superior solution if they run across this thread, but for right now I simply need more information. Perhaps you could post some code examples you have seen, and try to explain them. As for isset() (link is to manual entry). The quote you posted. Is it from this thread: http://bytes.com/topic/php/answers/12750-php-saying-i-have-undefined-variable what he is referring to in the quote is taking a specific action when your variable is undefined, but he never describes the specific action. For your specific problem, you seem to understand that isset() could be used to get around the problem you have, but what you are not considering is the actual action that needs to take place. I will give you an example of common use of isset(). Say I have a web page with a form on it, called sampleForm.html. This page submits to a php script that processes the post data, and outputs some information". It is called samplePHP.php. SampleForm.html could look something like <!DOCTYPE html .... <html> <body> <form name="form1" action="sname=amplePHP.php" method="post"> <input name="textbox1" type="text"> <input name="textbox2" type="text"> <input type="submit" name="submit1"> </form> </body> </html> Now, the actual processing that we do normally is unimportant, so in the example, I will do something simple and stupid. However, we must discuss the actual usage of isset(). In this example, I will use it to make sure that someone has actual submitted the form before we do processing. Otherwise, someone could simply navigate to the page itself, and break the script. This is very useful for much more complex scripts, like user logins, or e-commerce. sampePHP.php <?php if (isset($_POST['submit1'])){//here we check that the submit button is set. If it is set, then we know that the user submitted the form //here we do processing. I will show a few more examples of isset. if (!isset($_POST['textbox1'])){ //this means they didnt enter the first text box. Say something echo "you didnt enter the anything in the first textbox<br />"; } else if (!isset($_POST['textbox2'])){ //they didnt enter the second textbox echo "you didnt enter anything in the second textbox<br />"; } else { //they entered both, so say a message echo "You entered something in both! Good job!<br />"; } } else { //here we handle what happens when the submit button is set. //this means they navigated to the page, or got to it through some other means //here we simply say a message echo "You didnt submit the form!"; } /*********************** NOTE: Without isset(), out samplePHP page could look something like echo "You entered something. Cool. You entered " . $_POST['textbox1'] . " and " . $_POST['textbox2']; ***********************/ Now, for your example, we need to consider what you are going to do if that variable is not set. Consider the following //we can check if $folders is defined if (isset($folders)){ //however, all this tells us is that it is defined. modNivoSliderHelper::render($params, $folders, $images); } else { //this is where the problem lies. what do we do when $folders is not defined //maybe we should set it to a default value. //but what will that default value be? $folders = ????; modNivoSliderHelper::render($params, $folders, $images); //or maybe we should call a different function? // but what function? mysteryObject::mysteryStaticFunction($mysteryArguments); //or maybe we should do nothing at all? } The problem I am having helping you is that I don't know what you have to do when $folders is undefined. As I have said numerous times, I have no idea on what this code is supposed to accomplish. You haven't told us what your script actually even does, besides generate that notice. Does the function render an image? Does your library work? Is this script included in a page with a bunch of other function calls, and includes? Is this part of large library that is loaded automatically when you use the library in your other pages? This is why I have been asking for more information. The answer could be one of many many different solutions, and I just don't know enough to give you a definite answer. For this I apologize, but as I said, I have no experience with the library you are using, so I simply don't know anything about it. Another thing to consider. From that thread you keep quoting, you forget to mention the following: Like this person says, you do not have an error, but a notice. Your script will still run even though PHP is telling you something. Usually, with notices, this simply means something is coded in a non-optimal way. There are no syntax errors that are causing an end to execution, but you have coded in such a way that something unexpected may happen. Like in your example, you are sending an undefined variable to that function. Or in my example, where if we didn't use isset(), the script would give you an unexpected and useless message: "You entered something! Cool! You entered and ". The rammifications of doing this are unknown to me, so this could be something that breaks the script, or be something that doesn't really matter, as that static method you are using is written in such a way to handle null or undefined arguments. I am unsure of this because you haven't actually told me what is happening with your script. However, if your script still works even though you are sending an undefined variable, you could always just suppress the notice since it doesn't really break the script. You can do this by prepending that line with the error control operator (@) like so @modNivoSliderHelper::render($params, $folders, $images); However, you should note that using this suppression operator is a band-aid solution, and doesn't really fix the core problem. The best way would be to use isset() in such a way that it gracefully handles what happens when the variables are undefined, whether it be providing some default values, or calling a different function. Hope this helps
  3. Well we would probably be able to help you better if you posted some code on what you are working on. You mentioned cURL. Do you have a script that tries using it? Have you read the entry in the manual? We understand that you are having problems with a 403 error while trying to spider some sites, but we won't really be able to help you without seeing what you are working with, and what you know. Of course someone may come along and just hand you a working script, but its a lot better for you to work through a script you create. You learn a lot more in the process. And remember, the posters here are volunteers, with their own projects, and life.
  4. We need a little more information in order to help you. Its difficult for us to just look through your code trying to find a problem. You need to describe what is happening what happens when you run that script, what you expect to happen, and the difference between the two. A little advice. for the best results while debugging, make sure you have error reporting on. This can be achieved by adding the following to the top of your php pages ini_set('display_errors',1); error_reporting(E_ALL);
  5. I'm not sure you fully understand what isset() does. All it does is return true or false if the variable has been set/not been set. If the variable hasn't been set (and in your case it obviously hasn't), using isset won't magically make it set some how.
  6. yeah apparently not. Try without the empty, doing what you did in the original post. That's strange. Sorry, as I said, i'm unfamiliar with wordpress so I didn't know it would act that way with the empty function
  7. Sorry, that link was messed up. try this here Look at the examples they give on that page. It shows how to sort by multiple columns
  8. You need to define at least $folder, as that is what is giving you an error. Not sure about the rest, as, again, I have no clue how your script works, so I don't really know where the variables are supposed to be coming from. I'm not sure exactly what you mean by using isset to define them not statically. That doesn't really make any sense. Would you mind explaining? Also, the code you posted doesn't really make any sense at all. What are you trying to accomplish there. And again, use code/php tags when posting code
  9. ok well the $folders variable isn't defined. I don't know anything about your script so I can't really tell you more than that
  10. use the order by clause. I don't know what column you want to sort by descending but that page should give you enough information to get started
  11. did you try the second snippet I posted, without using the empty() function
  12. yes,.. fixing your code rather than ignoring the errors they create is usually the best option. but yeah the error means.. well.. you never defined the $folders variable. We would need to see the code before it to really help, but try defining $folders. Also, use code or php tags when posting code please.
  13. What I would do is add an onclick event to each of the 4 images. They can then call a function, passing in a different variable each. Then based on this variable, use a switch statement to decide what to change the other image to. For example, your 4 images would be something like <img src="img1.jpg" onClick="changeImg('img1')"/> <img src="img2.jpg" onClick="changeImg('img2')"/> ... ... your changeImg function could look like function changImg(which){ switch(which){ case "img1": //code to change it to whatever image 1 changes it into break; case "img2": //code to change it to whatever image 2 changes it into break; ... ... } }//end function Hope that helps
  14. Ok. well that function, based on the parameters you are passing, should return a single string containing some key value. The key parameter you passed doesn't have any quotes around it. Perhaps it should be get_post_meta($post->ID, 'appid', true) This is assuming you aren't using a global constant named appid to store the value you wanted to pass into that function. However, theoretically, assuming you dont have a global constant named appid, it should still work (although it would throw a warning if you have error reporting turned on). if that doesn't work, you could try simply comparing the return value to an empty string, like you did in the original post, IE if (get_post_meta($post->ID, 'appid', true) != ""){ ... Hope this helps
  15. you can use the strpos() function. For example $checker = $_SERVER['HTTP_REFERER']; $str = "siteone.com"; if (strpos($checker, $str) !== false){ header("Location: http://www.sitetwo.com"); }
  16. I see. The script must have failed before it got to that syntax error. If you echo out get_post_meta what does it echo? I was under the impression that it returned a string that you wanted to verify, but that doesn't seem to be the case. Sorry, but i'm not very familiar with wordpress, so I'm not really sure what a custom field is. Is there any way you could give more details about this function?
  17. I believe he is referring to the directory above the main directory (IE the directory that your public_html or www folder is in.)
  18. Well checking MIME types and file extensions isn't a mutually exclusive process. You could easily check both.
  19. Not really. Since you used a Hash there is no way to take the hashed string and return it to its original string, so unless you know all the passwords to all the accounts, and can go through each 1 by 1, comparing the hashed password to the hash you have in the table, I don't really see a way of rectifying the situation, short of clearing the database and starting over. Is your website in production? Or are you just testing it? If its in production, and the usernames and passwords are from actual users, I guess you learned the lesson to always fully test your features before you unveil them to the public
  20. Oh, well you are missing a closing parenthesis on this line if (!empty(get_post_meta($post->ID, appid, true)) it should be if (!empty(get_post_meta($post->ID, appid, true))) my apologies, my above code snippet was incorrect
  21. You may want to use a more graceful technique for stopping your script rather than exiting mid execution. Also, MIME types are browser dependent I believe, meaning that not all browsers send the same MIME type for the same file type (although this may have changed with new versions of browsers. Its been a while since i've made an upload script). Also MIME types can be spoofed. You may want to also check the extension as well as the MIME type
  22. what line is this error occuring on? What does the function get_post_meta() return?
  23. Well the first thing you need to do is check to see if all passwords are indeed salted before you add them into your database. I would check your registration script to find this out. If they are (and I suspect they are not, or at least they use a different salt) than your login script with the salt should work, theoretically.
  24. Oh I see. well if I am interpreting you correctly, you want to echo the get_post_meta($post->ID, appid, true) string if the get_post_meta($post->ID, appid, true) string has a value (IE is not empty), otherwise you want to echo the stripslashes(get_option('woo_fb_id')) string (assuming that the get_option('woo_fb_id') string is not an empty string). Is this interpretation correct? if so you could do something like if (!empty(get_post_meta($post->ID, appid, true)){ echo get_post_meta($post->ID, appid, true); } else if (!empty(get_option('woo_fb_id')) { echo stripslashes(get_option('woo_fb_id')); } Hope that helps
  25. Well if you've tried both absolute and relative URL's without success, I can't be of much help. Perhaps you should try opening a ticket with your hosting provider
×
×
  • 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.