jcbones
Staff Alumni-
Posts
2,653 -
Joined
-
Last visited
-
Days Won
8
Everything posted by jcbones
-
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.
-
Maybe you need to check the database to make sure your spelling is correct, or that the table exists.
-
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
-
$ <- you missed it.
-
I will give you a starting point. <?php if($_SERVER['REQUEST_METHOD'] == 'POST') { echo $_POST['band']; } else { echo 'Form not sent!'; }
-
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.
-
You must login.
-
Are all the select boxes the same? Except the name of course.
-
how to integrate paypal using paypal class file
jcbones replied to rashgang's topic in PHP Coding Help
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. -
Domain Transfer Causing File Upload Problem
jcbones replied to Mindsparks's topic in PHP Coding Help
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. -
Probably should be BETWEEN ... AND.
-
You need to set the date format in jQuery's datepicker.
-
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>
-
return exits the script or function. You shouldn't ever need a return inside of a script, but should use it in a function.
-
Superimposing values from mysql table onto images
jcbones replied to davidcriniti's topic in PHP Coding Help
Nevermind, answered. -
Superimposing values from mysql table onto images
jcbones replied to davidcriniti's topic in PHP Coding Help
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! -
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!
-
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">
-
A twister - Unable to prevent a second login by the same member.
jcbones replied to ajoo's topic in PHP Coding Help
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. -
Function no longer working / wont check if email already exists
jcbones replied to justin7410's topic in PHP Coding Help
Always trim data before database insertion. This will eliminate the problem you just had. -
Its always been there, but since it is a notice, most production servers hide the error. empty will also work.
-
$_Session or continue passing variables with GET or POST?
jcbones replied to ellchr3's topic in PHP Coding Help
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> -
How to do Multiple Condition in SQL query using PHP and Ajax
jcbones replied to vishalonne's topic in PHP Coding Help
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. -
Anything that writes to the screen is output. You can have NO output before a session_start() call, or a header() call.