Jump to content

jcbones

Staff Alumni
  • Posts

    2,653
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by jcbones

  1. Yeah, you can't scrape Google pages. You have to use an interface that they provide. The good thing is, that they provide an API for that. Custom Search API.
  2. Maybe you need to check the database to make sure your spelling is correct, or that the table exists.
  3. file_get_contents() can open addresses only if the fopen wrappers are enabled in the ini. So check that. Also you would have to pass the protocol to the function, otherwise it will think you are looking for a file. Which is most likely to be your problem. So it should be http://www.google.com
  4. $ <- you missed it.
  5. I will give you a starting point. <?php if($_SERVER['REQUEST_METHOD'] == 'POST') { echo $_POST['band']; } else { echo 'Form not sent!'; }
  6. You have a lot of variables that need to be set in order to pull your data. $cmaterial is only 1 of 8 needed to properly form the query string. You can do 1 of 2 things. 1. Set all the variables in a session. If POST is set, load the POST data to variables, if not load the SESSION data to the variables. 2. You can set all 8 variables in the URI, if POST is set, load POST into the variables, if not load the GET data into variables. 1. means you have no limit to the string lengths. 2. means users can bookmark search results.
  7. You must login.
  8. http://php.net/manual/en/function.hash-pbkdf2.php
  9. Are all the select boxes the same? Except the name of course.
  10. An address to localhost, will always point to the machine that calls it, as it is "local". If you are going to use any file that has credentials in it, then you must secure the folder that holds it. Either storing it above public access, and/or DENY ALL access to it via .htaccess. Other than that, I do not know of any security concerns with the paypal classes, or API, IPN, etc. Not saying there aren't any, but I am not aware of them.
  11. You may need to post the entire method, there may be some more de-bugging that could happen at other points to give the problem.
  12. Probably should be BETWEEN ... AND.
  13. You need to set the date format in jQuery's datepicker.
  14. Assuming you don't use <IE10. <style type="text/css"> .selector { -moz-column-count: 2; -moz-column-gap: 10px; -webkit-column-count: 2; -webkit-column-gap: 10px; } </style>
  15. return exits the script or function. You shouldn't ever need a return inside of a script, but should use it in a function.
  16. Yes you can. There are a lot of functions for this, and a lot of different directions you could go. The best place to start would be a tutorial, the available functions are Here!
  17. We don't like the word immediately around here, whether it is spelled correctly or not. However, I am in a peachy mood today, and am willing to look at your code, but I hesitate to download arbitrary data from the internets without knowing the contents. If you would be so kind as to post the relevant code here, inside of [ code ] ... [ /code ] blocks, then I would be more than happy to look at it for you. Thanks!
  18. I would like to offer some suggestions. 1. Never delete data, unless you are in maintenance mode. 2. If you decide to let a web (or admin) user delete data, do your deletions BEFORE pulling the data, or else you may end up displaying something that has been deleted. Now as to your wants. In order to get the second script to call the first, just enter the valid URL path to the first script, in the second scripts form action attribute: <form id="form2" name="form2" method="post" action="valid/path/to/second/script.php">
  19. Just run it on a token system. If they don't have the correct token, they get logged out, or never logged in. This would be set inside the session, and not the database. A simple md5 of the browser (HTTP_USER_AGENT) should suffice for what you are looking to do. Tokens can be set in a cookie, or in the URI.
  20. Always trim data before database insertion. This will eliminate the problem you just had.
  21. Its always been there, but since it is a notice, most production servers hide the error. empty will also work.
  22. Sort of this idea: <?php session_start(); // ******** EDIT CONNECTION INFORMATION BELOW ************ $hostname = "localhost"; $database = "login"; $username = "root"; $password = ""; // *********** END EDIT CONNECTION INFORMATION ************ $db = new mysqli($hostname,$username,$password,$database); if($_SERVER['REQUEST_METHOD'] == 'POST') { $sql = $db->prepare("UPDATE `users` SET `forename` = ?,`surname` = ?,`email` = ? WHERE `users`.`userid` = ? LIMIT 1"); $forename = $_POST['forename']; $surname = $_POST['surname']; $email = $_POST['email']; $id = $_POST['id']; $sql->bind_param('sssi',$forename,$surname,$email,$id); if(!$sql->execute()) { trigger_error('UPDATE STATEMENT ERROR: ' . $sql->error,E_USER_WARNING); } } if (isset($_SESSION["username"])) { $user_query = $db->prepare('SELECT userid, forename, surname, email FROM users WHERE username = ? LIMIT 1'); $username = $_SESSION['username']; $user_query->bind_param('s',$username); $user_query->bind_result($userid,$forename,$surname,$email); if(!$user_query->execute()) { trigger_error('SELECT STATEMENT ERROR: ' . $sql->error,E_USER_WARNING); } $user_query->fetch(); } else { die("You must be logged in <a href='index.php'>Back</a>"); } <html> <?php include "overallheader.php" ?> <div id ='container'> <div id ='content'> <div id='navBar'> <?php include "navbar.php"?> </div> <div id='userinfo'> </div> <div id ="eventform"> <form name='myForm' action ='edit.php' onsubmit='return validateForm()' method='POST'> <input type='hidden' name='id' value='<?php echo $userid; ?>' /> <table> <tr><td ><input type='text' name='forename' value='<?php echo "$forename"; ?>' /> </td> </tr> <tr><td ><input type='text' name='surname' value='<?php echo "$surname"; ?>' /> </td> </tr> <tr><td ><input type='text' name='email' value='<?php echo "$email"; ?>' /> </td> </tr> <td> <INPUT TYPE="submit" VALUE="Edit"></td> </table> </form> </div> </div> </div> </html>
  23. Looking at your column names, you need to normalize your database. Otherwise, you could run into collisions with that set up. As it sits now, you will have to update a users address on each course they are taking. This leads to the conclusion of bad database design. You need to make some relational tables.
  24. Anything that writes to the screen is output. You can have NO output before a session_start() call, or a header() call.
×
×
  • 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.