Jump to content

dptr1988

Members
  • Posts

    372
  • Joined

  • Last visited

    Never

Everything posted by dptr1988

  1. Rohan Shenoy: 'link_field6' appears to be a SQL field name, rather then a PHP variable
  2. I'm not sure if this is the problem but it looks like your values are reversed in the 'LIKE' part Try this: <?php $sql = "SELECT link_title FROM film_links WHERE link_field6 LIKE '%{$attori}%' "; ?>
  3. If I were you, I would try to do as much as possible with the SQL queries. If you have to use PHP to do SQL work, then you can run item speed and memory issues when you work with large databases.
  4. Does anyone know of an program that will allow me to search for terms within a specific part of PHP source code? Like in comments, strings, variable names, etc? I am needing to rebrand an program, but since the old name is everywhere (500+ files), I am just wanting to search for the old name in strings and outside of the <?php and ?> tags. Is this someting that I could do with grep/regular expressions? Or is it too hard to make a regular expression that can handle PHP code?
  5. If you are using HTML, you don't need to worry about newlines or wordwrap. The web browser will decide where to put the new lines when it displays the text.
  6. pcntl_fork will fork the running PHP script. I think that he is wanting to run a seperate program.
  7. Well, I don't understand what your problem is. Do you know how to use $_POST to get the data from the HTML forms when they are submitted? Try adding var_dump($_POST); to your page that recieves the form data and you can see what data you have to work with. Here is the basic way to do it: <?php if (isset($_POST['name_of_submit_button'])) { // Clean up var1 $var1 = trim($_POST['var1']); // Now $var1 can be used in your code. } ?>
  8. array_splice() will allow you to insert/delete data from an array. http://us3.php.net/array_splice For this example you would probably want to use something like array_splice($input_array, 1, 0, $new_data_to_insert);
  9. I don't know if that's possible to do in one SQL query. The results of an SQL statement is a one dimensional array. Somebody else may have a better solution for you, but here is how I have done it: <?php echo'<ul>'; $result = mysql_query("SELECT cluster, cluster_id FROM TABLE"); while ($row = mysql_fetch_array($result)) { $result2 = mysql_query("SELECT subcluster FROM TABLE WHERE parent_cluster_id = {$row['cluster_id']}"); if (mysql_num_rows($result) > 0) { echo '<ul>'; while($row2 = mysql_fetch_array($result2) { echo '<li><a href="index.php?sort='.$row2["subcluster"].'">- '.$row2["subcluster"].'</a></li>'; } echo '</ul>'; } else { echo '<li><a href="index.php?sort='.$row["cluster"].'">'.$row["cluster"].'</a></li>'; } } echo '</ul>'; ?> The problem with this is that you only can go to the first subcluster. If one subcluster can be the parent to another, this wouldn't work. I think that SQL does not allow you to select data from infinitely nested rows in one query and also the fact that mysql_query() returns an 1 dimensional array also limits you. This example is just what I've used to get around this problem. I hope that someone else can point out a more elegant solution.
  10. If your server is running linux ( it better be!! ) you can add this char '&' at the end of your command line and it will run the task in the background. Also, remember to redirect all outputs to a log file or /dev/null or else the PHP script will have to wait for the programs output.
  11. What I've seen done with most large programs is to use defines for the languages but rather then having one large file per langage, break it up into multiple files based on which page you will be working with. That way you only need to include the defines for your page.
  12. No, once someone downloads your flash game, they can do just about anything they want with it, unless you can find some type of protection/encryption scheme to discourage people from tampering with the HTTP requests. But then they still could run a network traffic analyzer like ettercap that would allow them to do anything they wanted.
  13. I was only reccomending this for PHP code blocks ( which are already detected becuase of the special syntax highlighting they get ). That would limit it to PHP code only. Would it really be that bad if somebody had a function name in there comments or strings and it got detected and linked? If it is, then it would not be very hard to detect comments and strings and skip them. That is very easy to do.
  14. phpinfo(): You are correct! My mistake. I really don't think that you can control where a form submission comes from. Why do you want to control where the form submission comes from? What is the problem that you are trying to solve by controlling where the form submission comes from? Is there another way that you could solve this problem? samlingsu: All form names/values can be spoofed
  15. Yes, register globals one big mistakes that PHP has made.
  16. Could you show us the the updated code ( that includes the bugfix we mentioned ), the error message from the updated code, and highlight or point out which line that error messages is refering to.
  17. That makes some sense. That is what I didn't understand. I guess I'll try some more at CSS. Thank you.
  18. Yeah, they probably will say that. But it really wouldn't be that hard. Sombody might even be able to do it with on line of code using regular expressions. Also the current SMF code already detects and specially processes PHP code so there would be no problem with that either. This would be complety automated, so nobody would have to bother typing ( or clicking for those that havn't learned how to use the keyboard yet. ) the [man] tag.
  19. if you add var_dump($_POST); near the begining of your file, it will print out the contents of the $_POST array, which contains the data that was submitted from the form. It will help you debug this script.
  20. Yes, you can submit any type of data to a website. The HTML form does not restrict the data or form fields that can be submitted, the PHP script does. In fact, I have a firefox addon that allows me to totally disregard the HTML forms and submit any data under any field name that I want. That is why it is SO important to always check your form data in the PHP script. You can't rely on the HTML form definition, the browser or Javascript to do that for you.
  21. try var_dump($_POST) to see the contents of your $_POST vars. Also check the names on your HTML forms. Why do you have this code: <?php $firstname = $_REQUEST['firstname']; $lastname = $_REQUEST['lastname']; $email = $_REQUEST['email']; $comments = $_REQUEST['text']; ?> and the go on to access those variables by the $_POST array?
  22. Well I don't see any references to 'evREAD' either. Is 'evREAD' defined anywhere in your database?
  23. It would sure save a lot of typing if the forum could automatically recognize PHP function names in PHP code blocks replace them with links to http://php.net/function_name It wouldn't be that hard to detect PHP functions names 'get_defined_functions()'. http://us2.php.net/manual/en/function.get-defined-functions.php This feature would allow the people unfamiliar with PHP and the PHP manual to learn more about each function just by clicking on it.
  24. I don't know how to do this in MySQL but here is how you could do it in PHP <?php $name = 'Jane Doe'; if (strlen($name) > 7) { $name = substr($name, 0, 7) . '...'; } ?> http://us3.php.net/substr http://us3.php.net/manual/en/function.strlen.php
  25. You need to echo your query and look at that. If you don't know how to do that, show us the code that makes the query string.
×
×
  • 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.