Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


justsomeguy last won the day on October 21

justsomeguy had the most liked content!

Community Reputation

958 Excellent


About justsomeguy

  • Rank
    More Human Than Human
  • Birthday 06/03/1979

Contact Methods

  • Website URL
  • ICQ

Profile Information

  • Location

Previous Fields

  • Languages
    Focusing on PHP and JavaScript

Recent Profile Visitors

271,399 profile views
  1. Manipulating the $.ajax( ) data Parameter

    According to the documentation for the ajax method, beforeSend is called before the request is even sent. The 2 parameters that the function gets passed are the jQuery XHR object, and the settings object. So in your code, podType is set to the jQuery XHR object. The beforeSend function is really for modifying the request before it goes out (or canceling it), so I would think your code for changing the page should all go in the success function. Inside that success function podType will still have the value it had when you send the request, unless you change the value inside the function. You also need to quote all of those values in your case statements, otherwise you're trying to compare the value with different variables.
  2. im struggling bad here please help

    The reason why your code isn't working is because $con is not defined in those functions (and $pass and $conf_pass are not defined in newUser either). You can use global variables inside the function, but it's better to avoid globals and pass in any variables you want the functions to use. So you should pass $con to the functions. You should add this to the top of your code: ini_set('display_errors', 1); error_reporting(E_ALL); You should switch your database code to use prepared statements instead of trying to manually escape everything. Prepared statements offer better security. You can use prepared statements with mysqli, but it's better to use PDO. The PDO code is shorter and easier to understand, and PDO works with databases other than only MySQL. e.g.: $stmt = $pdo->prepare("SELECT * FROM users WHERE username = ?"); if ($stmt->execute(array($username))) { if ($row = $stmt->fetch()) { // it found a user } } http://php.net/manual/en/book.pdo.php For the code I posted above, I was saying that each function should only do one thing. Your newUser function should only validate and add the user if necessary, it should not also output anything or redirect. Your main code should do that based on what the function returned. If you want to return multiple values you can use an array like I did above to return a "success" value for whether the user was added, and a message to show them. So your main code would call that function and then decide what to do. Those header redirects wouldn't work though, because you sent output to the browser first. $result = newUser(...); if ($result['success']) { // maybe redirect to a thank-you page or something } else { // show the error in $result['message'] }
  3. im struggling bad here please help

    The forum completely wiped out my reply when I tried to edit my post, because the forum software is awesome. I'll try that again.
  4. im struggling bad here please help

    function newUser ($username, $password){ $return = ['success' => false, 'message' => '']; if (!isExist($username)) { if (passChk($pass, $conf_pass)){ // insert into the database here $return['message'] = 'Username Created successfully'; $return['success'] = true; } else { $return['message'] = "Password and confirmed password do not match"; } } else { $return['message'] = 'Username already exists'; } return $return; }
  5. how write a new function without recursion call

    In an easy way? No. You need nested loops, and the number of loops you write is going to set a maximum value for parts of what the function can do. Recursion is how you avoid that, you can use a much more elegant piece of code to do that kind of thing if you use recursion. The code you posted doesn't actually do anything though, it never returns a value other than an empty array when k is greater than 0. It might have gotten messed up because you didn't post it in a code box, maybe there's something left out, I'm not sure.
  6. how write a new function without recursion call

    With a long, messy series of nested loops which will end up resulting in the function only allowing a maximum size for the array or size. You should stop worrying and learn to love recursion.
  7. You might also want to look into that type attribute. Maybe values other than 0 give you other options also.
  8. There's no "or" character. That's not to say the particular program you're using doesn't define and use one (if so, it will be in the documentation), but there's not a specific "or" character. In programming languages you would use "|" to represent a bitwise OR operation (|| for boolean OR), but, again, the program you're using would have to look for and support that. I'm not familiar with that program, so I don't know how it works.
  9. The program you're using might support some kind of syntax for specifying multiple values to search for in the attribute, but you would have to check its documentation to see what it expects. The second one you pasted is not valid XML, commas don't go inside an element attribute list. An attribute's value is a single string, but maybe the program you're using looks for that string in particular formats and can split it up or otherwise use it in different ways.
  10. HTML 5.

    Yeah this whole topic is just bizarre. This is a forum for helping people learn how to program, this is not the correct venue to push your chosen morality or pass personal judgment on other people. If you'd like further help through this forum Rewillis, please leave religion and morality out of it and stick to programming. If you find yourself unable to separate those then it's probably best to look for help elsewhere. I'm going to close this topic, if you'd like to start over you're welcome to do that.
  11. Help needed Compiled source unreadable?

    You don't have to encode it, that looks like a failed Microsoft attempt to hide Javascript. I would be surprised if anything other than IE or Edge knows what to do with that, so it's better to leave it out. Javascript code isn't exactly a trade secret. Although it might be the case that the script tags tell the browser that it is encoded. This is the correct script tag to use: <script type="text/javascript" src="file.js"></script>
  12. How to build multimedia website with html

    If you have a question about how to use shadows in CSS, it would save you a lot of time to go to Google and search for that instead of asking and waiting for a response.
  13. Apache Control panel not coming up via http://localhost approach

    You shouldn't have to move or change anything, I'm sure that the Apache config files define a virtual directory (possibly /xampp) which points to a different location not inside htdocs. If you're not looking for a default dashboard, what exactly are you looking for?
  14. Help needed Compiled source unreadable?

    The opening comment refers to jscript.encode. You can download a decoder here. It looks like this site may also offer decoding. If you search for jscript.encode you'll find other information.
  15. Help me with Using JQuery AJAX code

    Note that the referer header is optional and not considered reliable. There are tools you can use to send your own requests to any server, when you do you'll see that you can write whatever you want in the referer. That header is also sometimes removed by various internet security software, and in some cases the browser will not send it at all to avoid information leakage (e.g., when going from HTTPS to HTTP). I was also checking for a referer header in our application on one file, but enough people reported that they were not able to access that and we replaced it with checking the session. A user can create their own referer header (or any other header, for that matter), but they cannot create their own session.