-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
As to simple math and word problem captcha's. It is very easy to write a script that parses and solves math problems and simple copy/paste type of word problems. You can however make these type of captcha's more secure by dynamically outputting the question as an image, since that would require a hacker to both do accurate OCR on the image to find out the question, then solve the question. It is a lot harder to do OCR to accurately read several words, than it is to do OCR to accurately find a small number of letters/numbers that are typically used in a captcha.
-
If the form and the form processing code is correctly testing if the current visitor is logged in and is preventing access by non-logged in visitors, then generic spammers who are not members/not logged in would not be able to submit comments to your form processing code because you form processing code would ignore form submissions by non-logged in guests. What is your code that is detecting logged in members and is protecting your member only pages?
-
Admin Login Issue - Need Help Please
PFMaBiSmAd replied to maorigurlnz's topic in Third Party Scripts
The only way a general php programming help forum could help with what the code is doing, would be if you posted the code in the file that is generating the "Incorrect username or password" error message so that someone could see the logic that is being used in order to pin down the possible reasons. This is actually a php programming issue with a 3rd party script, so moving to the correct forum section... -
You cannot guarantee that the highest id will be the id that any invocation of a script just inserted because concurrent visitors can each cause their own id to be inserted. You will end up cross-linking information using the wrong id. How are you 'executing' these separate scripts that need to use the correct id and why don't you have all the related processing on one page?
-
Writing a program to create _____________ (insert name of what you want to do) is not a matter of knowing or having someone tell you how to create a program to do something. It is a matter of learning the programming language you are trying to use, then define what you want to do, then break that task down into the steps need to accomplish the stated goal, then finally write and test the code for each of those steps.
-
The only built-in method of getting both the local and master settings would be - phpinfo(INFO_CONFIGURATION); You would then need to capture and parse the resulting output to find the setting you are interested in. Edit: Or it looks like you can use ini_get_all
-
Something like this (I guessed at your paths, so they would need to be adjusted to match your actual configuration) - <?php include($_SERVER['DOCUMENT_ROOT'] . '/storescripts/connect_to_mysql.php'); // database connection $image_path = "/storescripts/gallery/"; // domain relative path (the leading slash) to where the image galleries are at $title_content = "Gallery"; // default page title (if not replaced by an actual gallery name in the following code) $num_col = 4; // number of columns for the image gallery // Produce a navigation menu (of some kind) - get and display a list of galleries $query = "SELECT gallery_name FROM images GROUP BY gallery_name"; if(!$result = mysql_query($query)){ // query failed due to an error. Handle that error here... trigger_error("Query failed: $query, Error: " . mysql_error()); } else { $menu_content = ''; if(!mysql_num_rows($result)){ // no rows found $menu_content .= "There are no galleries"; } else { // at least one row found $menu_content .= "Select a gallery -<br />"; $menu_content .= "<ol>\n"; while($row=mysql_fetch_assoc($result)){ $menu_content .= "<li><a href='?gallery_name={$row['gallery_name']}'>{$row['gallery_name']}</a></li>\n"; } $menu_content .= "</ol>\n"; } } // Produce the requested gallery $gallery_name = isset($_GET['gallery_name']) ? $_GET['gallery_name'] : ''; $gallery_content = ''; if(empty($gallery_name)){ $gallery_content .= "No gallery is selected"; } else { $query = sprintf("SELECT image_path FROM images WHERE gallery_name='%s'", mysql_real_escape_string($gallery_name)); if(!$result = mysql_query($query)){ // query failed due to an error. Handle that error here... trigger_error("Query failed: $query, Error: " . mysql_error()); } else { // query succeeded if(!mysql_num_rows($result)){ // no matching rows $gallery_content .= "No Images in the Gallery"; } else { // at lest one matching row $title_content = $gallery_name; // set gallery name as the page title $gallery_content .= "Welcome to $gallery_name<br />\n"; $gallery_content .= "<table>\n"; $image_path .= "$gallery_name/"; // produce the actual path - /domain relative path/gallery name/ $count = 0; while($row=mysql_fetch_assoc($result)){ if($count == 0){ // start a new row $gallery_content .= "<tr>"; } // output each td cell $gallery_content .= "<td><img src='$image_path{$row['image_path']}' alt=''></td>"; $count++; if($count == $num_col){ // end previous row $gallery_content .= "</tr>\n"; $count = 0; // reset count } } if($count !=0){ // complete any partial row while($count < $num_col){ $gallery_content .= "<td></td>"; $count++; } $gallery_content .= "</tr>\n"; } $gallery_content .= "</table>\n"; } } } ?> <!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title><?php echo $title_content; ?></title> <style type="text/css"> </style> </head> <body> <div> <?php echo isset($menu_content) ? $menu_content : ''; ?> </div> <div> <?php echo isset($gallery_content) ? $gallery_content : ''; ?> </div> </body> </html>
-
This query will get all the information using just one query - SELECT teamname, SUM(points) as total FROM test GROUP BY teamname You would reference the total (alias name for the SUM(points) value) as $row['total']
-
Auto Complete Ajax php strange bug :confused: :confused:
PFMaBiSmAd replied to dflow's topic in PHP Coding Help
You are already using ajax to request and display the information. What I suggested was how to implement the server side query so that you only retrieve the data you want in the most efficient manor. Untested (of course), but should work - <?php if(isset($_GET['part']) and $_GET['part'] != '') { mysql_connect('localhost', 'root', 'root') or die('Could not connect: ' . mysql_error()); mysql_select_db("international") or die('Unable to select mydbname: ' . mysql_error()); $results = array(); $part = mysql_real_escape_string($_GET['part']); $result = mysql_query("SELECT city_name FROM citylist WHERE city_name LIKE '$part%'"); while ($row = mysql_fetch_assoc($result)) { $results[]=$row['city_name']; } echo json_encode($results); } ?> -
You shouldn't be creating and writing .php pages to do this. What you should be doing is have 1 (one) gallery.php page that accepts the gallery name as a get parameter on the end of the url when it is requested. The code in gallery.php (or whatever name you choose to call it) would then query the database using the gallery name $_GET parameter it was passed and output the images that are associated with that gallery name. Edit: Programming languages have variables so that you can write a (one) program that operates on different data by simply setting up a variable that the code uses to determine what data it should operate on.
-
Are you sure your $_POST['sendMail'] variable is set to that your code is even calling the mail() function? At a minimum, you should have error checking logic in your code to test the value mail() returns and display a success or failure message so that you know the result of calling the mail function.
-
Has any code you have tried worked?
-
Auto Complete Ajax php strange bug :confused: :confused:
PFMaBiSmAd replied to dflow's topic in PHP Coding Help
You should not be retrieving all the rows from your database table and then loop through the data trying to match it. You should be doing this in your query using a WHERE clause with a LIKE comparison. -
field from database table row is empty but php doesnt recognise it
PFMaBiSmAd replied to JKG's topic in PHP Coding Help
As to the ord() function I suggested. You would need put an echo in front of that. -
field from database table row is empty but php doesnt recognise it
PFMaBiSmAd replied to JKG's topic in PHP Coding Help
Where is the data value in the table originally coming from? Given that the field is named - address_2, this is likely a second line of their address from a form field or from a csv data import. You are expecting it to be empty, but it clearly is not. You need to filter/trim it before it gets inserted and/or you need to find what is causing it to be non-empty but not an actual usable value to be displayed in the first place. -
field from database table row is empty but php doesnt recognise it
PFMaBiSmAd replied to JKG's topic in PHP Coding Help
It's a string consisting of 1 (one) white-space character. It's either a space, a tab, or it could even be a new-line. What does the following show - ord($displayUser['address_2']); -
field from database table row is empty but php doesnt recognise it
PFMaBiSmAd replied to JKG's topic in PHP Coding Help
How do you know the field from the table row is empty? What does the following show - var_dump($displayUser['address_2']); -
LoadModule php5_module "c:\php\php5apache2_2.dll"
PFMaBiSmAd replied to cooler's topic in Apache HTTP Server
The .msi php installer is supposed to completely integrate php with the web server. You should not need to do anything after running the .msi installer. -
Strange/Inconsistent "Header Already Sent" message
PFMaBiSmAd replied to doubledee's topic in PHP Coding Help
Yes, that line is outside of php any tags and is sent as is to the browser. FYI - The php tokens generated (which must all be executed when your code runs) by putting a closing php tag, some in-line html (a new-line) and an opening php tag is - T_CLOSE_TAG T_INLINE_HTML T_OPEN_TAG -
I recommend that you re-read those three lines of your code a few more times. They are not doing what you think they are and they are also not what you previously used that worked. 1) You are executing a mysql_query() statement with an INSERT query, 2) You are selecting a database, 3) You are executing a second mysql_query() statement using a variable that is NOT an sql query statement, which produces the error you are getting. The query being given to the second msyql_query is EMPTY because the variable contains either a true or false value from the first mysql_query() statement.
-
This is your code - <input type='text' name='i_Pad_Well_Names_1' size='24' value=<?php echo $i_Pad_Well_Names_1 ?>> This is your code as valid HTML - <input type='text' name='i_Pad_Well_Names_1' size='24' value='<?php echo $i_Pad_Well_Names_1 ?>'> I also recommend that you use htmlentities, with the second parameter set to ENT_QUOTES, on any data values you echo on a page so that any html special characters in the data (<, >, ', ", &) don't also break the HTML on your page.
-
The "Query is empty" error is coming from the OTHER mysql_query() statement in your code. Why do you have a second mysql_query() statement that is trying to use $insertSQL as a sql query statement ($insertSQL is not a sql query statement.)
-
Connecting to two Mysql databases (one remote)
PFMaBiSmAd replied to xwishmasterx's topic in MySQL Help
There's at least two different things wrong with the code, that someone already posted - -
I think that's because he removed the other 39 fields when he posted the code.