Jump to content

mac_gyver

Staff Alumni
  • Posts

    5,352
  • Joined

  • Days Won

    173

Everything posted by mac_gyver

  1. i can tell you why the two shopingfor get parameters get put into the url. whomever did write this code ASSUMEd (i.e. to make an ASS out of U and ME - i.e. him) that if here is a shopingfor in the url that it will always be &shopingfor. that's not always the case, because there won't be an &shopingfor when shopingfor is the first or only get parameter. except of course that the kid who did write this code formed some urls like - video_games?&shopingfor=US i'm going to guess whatever moz tool you used either correctly formed the urls (without the ?& business) or you fed the tool a correct url (without the ?& business), in which case the php code couldn't find the (in)correct part it was looking for and appended a second shopingfor get parameter. all of the get parameter handling in the php code is bogus (edit, if you pick a country flag, then do a search, you loose the country selection in the url as well, so the problem goes well beyond just the code you have posted.) the correct way would be to get the get parameters into an array, such as the $_GET array, set the specific one you want to the value you want, then use a php function like http_build_query() when forming the urls.
  2. it would help if you told us what exactly you did that resulted in that output, what moz tool and what url you fed it that led up to that list of links, i.e. provide some context and a starting place.
  3. given that you are using mysqli statements in your previous threads, i'm guessing the mysql_query() is failing because you should be using msyqli_query()
  4. yes there are programmers here who can help you with problems you encounter when you create your application. however, programming help means you are doing the programming, we only help when you have a problem or error that you cannot solve. we can only help you when you post specific questions or specific errors you get when you run your code. just asking if someone can help is not a specific programming question. lastly, we are not here to do your assignments for you. if you are completely lost about how to approach your assignment, you need to speak with your instructor, because they wouldn't have given this assignment without first having presented the groundwork needed to at least start on the assignment.
  5. producing an application, in any programming language, requires that you go through a learning curve to - 1) learn the programming language, 2) learn how to write program logic that does what you want (i.e. to take the inputs you have, perform the processing you want, and produce the intended output/result), and 3) learn about and use things like security, validation, error checking/reporting so that it is a complete, safe, and useful application. you are either going to need to take the time and effort to learn and gain experience so that you can do this yourself, find a solution that does this for you, or hire someone to do this for you.
  6. be advised that a LOT of the php code posted (and for sale) on the web is crap. just enough effort was put into it to get it to run and look pretty, but it often lacks security or any useful error checking/error reporting. so, you can end up with a script that allows hackers to take over your site (or in this case send their email through your server) or of spending as much time trying to get something to work that it would have taken you to write it yourself. edit: the script you linked to is the general idea, but without seeing the code for it, there's no telling how good or bad it is.
  7. you will need to narrow down the problem and post just the relevant code. when you do post just the relevant code you need help with, YOU will need to FULLY document what each variable means and what data is in it. the code you have is using non-descriptive variable names, like $js, $o_MSC, $ot_MS... for anyone here to be able to help you, you will need to provide a comment on each variable telling us what it means and provide a sample (var_dump()) of what the data in them is. you will also need to describe or post any error or incorrect output you are getting from that relevant code along with a sample of what the correct output should be.
  8. phpmailer is just an interface between php and your sending mail server. it does not process form data. to process form data you either need to - a) write some server-side code to take each input received from the form, validate it, and use it the way you want. b) find a general 'form processor' script that will let you define its inputs, data/validation types, and define an email template that uses the input values the way you want.
  9. your site isn't setting any session id cookie. it's likely that your session_start() statement isn't positioned in the code on your page before you output anything else to the browser. setting php's error_reporting to E_ALL and display_errors to ON or log_errors to ON would help you by displaying or logging all the php detected errors.
  10. the value being submitted likely contains a ' you may have seen this recommend before - you need to form the sql query statement in a php variable so that you can echo/var_dump/log it for debugging purpose so that you can see what it actually is. you will save a ton of time. also, please use the forum's bbcode tags (the edit form's <> button) around code when posting it in the forum.
  11. you are missing one single-quote in your sql syntax. did you even look at the code you typed, at the point where the error is being reported in the sql statement, to find the problem?
  12. here's a different approach to your coding. it is a 'data driven' design, where you don't repeat blocks of code that perform the same processing, just because a value or where a value comes from changes. you write one block of general processing code and let a data definition, in this case an array, control where the data comes from or what the code does for each possible case. <?php // get leave amounts for a particular person, by name $tool = mysql_query("SELECT * FROM leave_member WHERE firstname = '$firstname' AND lastname = '$lastname' "); $fest = mysql_fetch_array($tool); // map the leave $type to the database column name - these are the only inputs that are dynamic for the processing code $leave_map['Annual Leave'] = 'annual'; $leave_map['Sick Leave'] = 'sick'; $leave_map['Compassionate Leave'] = 'compassionate'; $leave_map['Study Leave'] = 'study'; $leave_map['Maternity Leave'] = 'maternity'; if(isset($leave_map[$type])){ $column = $leave_map[$type]; // column name $amount = (int)$fest[$column]; // get the amount if($amount == 0) { echo "Sorry, you don't have any $type days available."; } else if ($workingDays > $amount) { echo "Sorry, the number of days you are requesting - $workingDays, is more than the number of days you have left - $amount. "; } else { // you have enough of the requested type $query = "INSERT INTO leave_request ( id, firstname, lastname, department, type, days, startdate, enddate, details, status ) VALUES ( NULL, '$firstname', '$lastname', '$department', '$type','$workingDays', '$startDate', '$enddate','$details', '$status' )"; $sql = mysql_query($query) or die(mysql_error()); } } else { echo "The requested type - $type, is not valid"; } this method of coding also helps accomplish DRY (Don't Repeat Yourself), because it lets you eliminate duplicated code.
  13. the $event variable is apparently a null value. what debugging have you done to find out what is in $event? also, your table definition doesn't make sense. an auto-increment column is by design supposed to be for the database engine to assign values for, not for you to insert your own values. p.s. see my reply in your other thread concerning using the bindParam() statements in the wrong place in the code.
  14. you are using ->bindParam() incorrectly. the ->bindParam() statements should be before your loop. the only thing that should be inside your loop is the code that gets/produces and assigns the dynamic values to the variables that were bound to the place holders and the ->execute() method statement. if you are submitting a radio button selection for each name, you would need to loop over both the array of radio inputs and the array of name inputs, using the same array index, to get the corresponding sets of radio/name values.
  15. your database table design is not normalized. by having columns Picture01 ... Picture10, your code to store, update, delete, and retrieve information is more complicated, since it must find which columns are the ones in use, which is likely the reason you ended up with incorrect data stored in your table. you should have the information for the pictures stored in a separate table, related back to the parent table using the parent's id. this will allow you to store any number of pictures, update or delete any of them, and more importantly, select any number of them and simply loop over the selected rows to display them.
  16. yes - suhosin.get.max_value_length 512 http://www.suhosin.org/stories/configuration.html#suhosin-get-max-value-length
  17. there's documentation for all the php functions at php.net. you don't have to guess or assume how something works.
  18. if you look at the first error message and look at your code leading up to the imagejpeg() function, you will see that you are NOT supplying a file name - at this point, we cannot possibly help you because you not reading the error messages, nor are you even considering the information that someone took the time to give you in a reply.
  19. you are not supply the file name to the imagejpeg() function. you are only supplying the path. edit: your code is allowing jpg/jpeg and png files to be uploaded. the make_thumb() function would need to be able to work for both of those type of images. also, one type of upload error, exceeding the post_max_size setting, will cause both the $_POST and $_FILES arrays to be empty. you must test if the upload worked before you can access any of the $_POST and $_FILES data. another problem is you are defining the make_thumb() function inside of a loop. this will result in a fatal runtime error on the second pass through the loop. functions should be defined only once and never in side of loops. and even another problem with your code is you are overwriting the $target_path inside the loop, so on the second pass through the loop, your code will be attempting to move the uploaded file to a jumbled up filename.
  20. php variables are NOT replaced with their value inside of an over-all single-quoted string. you would either need to use initial and final double-quotes or use concatenation. p.s. i seriously doubt your form processing code is running, because your big long isset() statement is testing for at least one form field that doesn't exist. it was mentioned in a previous thread of your's that you only need to test for one of the known form fields to qualify running the form processing code.
  21. your hidden input fields are all missing the closing html > you should always validate your resulting html at validator.w3.org also, you have php echo statements outputting the html. you don't put php <?php ... ?> tags within a php echo statement because it is already php code.
  22. your use of a prepared query is incorrect. you do not put the value/variable directly into the sql statement, you put a place-holder into the sql statement where the value belongs and bind the value/variable to that place-holder. you are also not running the query that you are preparing. i recommend that you read the relevant sections of the php.net documentation as it shows working examples.
  23. i, in fact, don't get that error from your code, but then again, i typically remove leading and trailing white-space that you may have had in your file and that the forum software adds when it (mis)formats code in posts. you must be extremely careful about what comes before and after the starting and ending identifiers you use for the herdoc syntax.
  24. yes, you are not the first person to ever have errors in your php code. if you search the web for that very common error message, you will find what it means and what to do to to find what is causing it.
  25. $stmt->fetch() fetches a row of data from the result set and populates the variables that you used in the $stmt->bind_result($PersonID,$ImagePath,...) statement. the while(){} statement should be - while ($stmt->fetch()) { and you would not use $row[0], $row[1], ... you would use $PersonID,$ImagePath,...
×
×
  • 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.