-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
You should not think of the required/included code as a separate script that is being 'called'. Think of it as source code (function definitions, class definitions, configuration information) that the main program needs to use to accomplish some goal. When the require/include statement in the parent script is executed, the required/included code is executed in the scope of the parent script. The required/included code might be stored in a separate file and in a different folder, but when it is executed, it is the same as if you had copy/pasted the source code from the required/included file into the parent script at the point where the require/include statement is at.
-
Unfortunately, a lot of the php tutorials posted all over the Internet are out of date, insecure, and non-functional. If you do a 'view source' of the blank checklogin.php page, you will probably see the raw php code. The code you found has many problems, the first being that it is using lazy-way short open tags <? which in the case of the checklogin.php code results in a blank page displaying in the browser because the <? tag is not supported on your server. Change all the <? tags to full opening php tags <?php
-
Assuming you want one row in your table for each filename, I would use array_chunk to break the list of files down into reasonable size chunks of around 500 files each. Then I would loop over those chunks and implode each group into a multi-insert query. $chunks = array_chunk($images, 500); // break into reasonable size pieces foreach($chunks as $chunk){ $imp = implode("'),('",$chunk); // implode the data to make a mulit-insert query $query = "INSERT INTO your_table (file_name) VALUES ('$imp')"; //echo $query . '<br />'; mysql_query($query) or die(mysql_error()); }
-
This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=333266.0
-
Either your query failed due to an error or it matched zero rows. You need to have error checking and error reporting logic on every query to test if the query worked of failed and then you need to test if any row(s) were returned by a successful query, all before you attempt to access the data from a query. Since you are not doing either of those tests, it is not directly possible to tell you why there are no rows. Also, mysql_result() is the only mysql_ data fetch statement that produces an error simply because there were zero rows in a result set.
-
^^^ That's what they made mysql_num_rows for.
-
Somewhere else in your code (could be in your consultar_bd() function), you have a mysql_fetch_assoc($res); or other mysql_fetch_xxxxx() statement or you are overwriting the $res variable. Without seeing the requested code, it's not possible to do more than guess what your code is doing wrong.
-
If you post all the relevant code, starting with the mysql_query() statement, through to the } on the end of your while(){} loop, someone can probably help with what your code is doing.
-
I cannot help but to wonder if this data is coming from a database query and you shouldn't actually be putting the condition(s) into a WHERE clause so that you only retrieve the row(s) you need instead of trying to scan through the results of a query using some slow parsed, tokenized, interpreted php code? What overall goal are you trying to achieve and what does the data look like and what are you trying to match?
-
If you had error_reporting set to E_ALL, you would find that $_POST['title'] does not exist. Looking at where that field is produced, you are missing an equal sign in the name='title' attribute.
-
<?php $search = "proposition|seven|nation|liberty|continent"; // use "red|apple" to match multiple keywords $string = "Four score and seven years ago our fathers brought forth on this continent a new nation, conceived in liberty, and dedicated to the proposition that all men are created equal."; $string = preg_replace("/($search)/i",'<a href="http://\1.com">\1</a>',$string); echo $string; ?>
-
Are you trying to do this on a shared hosting, live web server?
-
If you use preg_replace, you can do a case-insensitive search and you can get the code to form the links for you - <?php $search = "apple"; // use the | to separate multiple keywords - "red|apple" $string = "big red apple"; $string = preg_replace("/($search)/i",'<a href="http://\1.com">\1</a>',$string); echo $string; ?>
-
Are you sure you are looking in the correct table? Again, computers only do exactly what their code tells them to do. If you echoed the $query string and the value shown for $new_pass is what gets updated in the user_security table, either that's not the actual code or the values you are looking at are not actually the same between what was echoed and what is in the table or you are not looking in the correct table.
-
There's no way the posted update query is putting the $new_pass value into the table. Either that's not your actual code that is being executed on your server or you have some other code on the page that is doing set password='$new_pass' Are you sure you saved the code you posted to the server?
-
http://dev.mysql.com/doc/refman/5.1/en/example-maximum-column-group-row.html
-
Its likely that you are either not executing the query in your code or the query produces an error and doesn't run. What is your whole code. Also, you should NOT use the mysql password() function to do this - And, if you are doing this for all the rows in your table, you don't need any php code to retrieve and loop through all the usernames. You can use ONE single UPDATE query to update all the rows at once. An update query without a WHERE clause will operate on all the rows in your table at once.
-
The %3C is a urlencoded value. If you use urldecode on the parts of the URL, %3C will be converted back to a <
-
Have you echoed $_SERVER['PHP_SELF'] and $_SERVER['QUERY_STRING'] so that you would see what you are actually receiving?
-
From the rules #15 -
-
Because you are using DISTINCT, you cannot guarantee any relation between any particular piece of data. The only way what you are currently attempting to do would maintain any relationship would be if all the grouped data was the same length so that as you were looping through one string of values you could get the corresponding value from the same position in the other groups. However, you are doing this the hardest way possible (you would need to add the country column to the GROUP BY term to get data per country.) You should simply query for the rows you want, in the order that you want them (no GROUP BY and GROUP_CONCAT involved) and then output the information the way you want in your php code.
-
The code probably is redirecting to question2.php but the code on question2.php is probably redirecting to quesiton3.php due to an error in your logic or your browser is requesting question1.php twice and is using the content of the session variable + 1 to redirect to quesiton3.php What is the whole code on the quesiton1.php and question2.php pages? ^^^ I showed how you would use a GET parameter on the end of the URL for one page to provide a value to the code on that page that would be used to determine what action that page takes. You would typically use a database to hold the content for dynamically produces php pages and just query for the correct content to be displayed.
-
Also, you do realize that php code in a .php file would only expose your credentials if you echoed the values or php was somehow disabled/broken but the web server was still working? Browse to your auth_config.php file and see what you get as output?
-
To prevent all http/https requests, put the following into a .htaccess file in the folder - deny from all