Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. Are you restarting your web server to get any changes made to the php.ini to take effect? Also, syntax errors in the php.ini file will cause any settings after the point where the syntax error is at to be ignored.
  2. You are not trying to start the session two times, you are sending output on line 1 of your file - output started at /home/udrugadj/public_html/admin/galerije-unos-slike.php:1 You either have some character(s) in your file before the <?php tag or your file is saved with the BOM characters - please read the following sticky topic (particularly the last reply in it) - http://www.phpfreaks.com/forums/index.php?topic=37442.0
  3. file_exists operates on a file system path. A leading slash on a file system path refers to the root of the current hard disk. The path/filename that you supply to file_exists needs to be either an absolute or relative file system path (these are not the same as absolute or relative URL's.) You can form an absolute file system path by using $_SERVER['DOCUMENT_ROOT'] to get the file system path to your document root folder, then append the correct path/filename to that value.
  4. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=350034.0
  5. Moving thread to the 3rd party script section... To get (any) help here, on a general purpose php help forum, you will need to at least give us the name of the variable(s) you are trying to get help with and a link to the Author's site where someone could download the script.
  6. The following would indirectly or directly give the Progress Date ($datetime1 object), Closed Date ($datetime2 object), and Time elapsed (nifty code at the end) - <?php $string =" Status Changed to In Progress\. -- Tuesday 15th September 2009 04:12:40 PM by Operator--//-- Status Changed to Closed\. -- Friday 18th September 2009 10:39:22 AM by Admin--//-- "; list($progress,$closed) = explode('--//--',$string); list(,$progress) = explode('\. -- ',$progress); list(,$closed) = explode('\. -- ',$closed); list(,$day,$month,$year,$time,$ampm,,) = explode(' ',$progress); $datetime1 = new DateTime("$day $month $year $time $ampm"); list(,$day,$month,$year,$time,$ampm,,) = explode(' ',$closed); $datetime2 = new DateTime("$day $month $year $time $ampm"); $interval = $datetime1->diff($datetime2); $array = array("y"=>"Year","m"=>"Month","d"=>"Day","h"=>"Hour","i"=>"Minute","s"=>"Second"); foreach($array as $key=>$unit){ if($interval->$key > 0){ $plural = $interval->$key > 1 ? 's' : ''; echo "{$interval->$key} $unit$plural<br />"; } }
  7. Since you goauld values are strings, you must compare the $_POST value as a string - DELETE FROM `users` WHERE `goauld`= '{$_POST['gd']}'" You'll need to escape $_POST['gd'] at some point prior to putting it's value into the query to prevent sql injection and to prevent any goauld name that may contain special sql characters from breaking the query. Rather than typing the goauld name into an input field, why don't you make a select menu from the current goauld names in the database?
  8. What is your goauld column defined as and what are some of the values in it?
  9. To reference the value that the select/date_format produces, you would need to use an alias name for that term in the query or use a fetch_row/fetch_array function to access the correct value. Otherwise you would need to do something like - $row["DATE_FORMAT(eventdate, '%D %M %Y')"] to access the selected value.
  10. You can make a copy of the entire $_POST array using one statement - $_SESSION['post_data'] = $_POST; You would reference each value like - $_SESSION['post_data']['ORDER'] or you can simply copy the values from the session variable back to the $_POST array - $_POST = $_SESSION['post_data'];
  11. You must test if the $_FILES array is empty or not (exceeding the post_max_size setting will cause the $_FILES array to be empty.) See this link - http://us3.php.net/manual/en/ini.core.php#ini.post-max-size Then you must test if the upload was successful or not before you can access any of the uploaded file information. See this link - http://us3.php.net/manual/en/features.file-upload.errors.php
  12. You remember the last value and detect when it changes. See the logic in this post - http://www.phpfreaks.com/forums/index.php?topic=349740.msg1650897#msg1650897 See the places in that code where it has - (optionally) do what is needed to close out the previous/last section
  13. Your form fields will be available as - $_POST['field_name'] variables. They will NOT be directly available as regular php variables - $field_name unless you have an assignment statement in your program - $field_name = $_POST['field_name'];
  14. When php5.4 is released, this sort of register_globals time wasting nonsense will be finally gone.
  15. Then any $_COOKIE['id_mem'], $_GET['id_mem'], $_POST['id_mem'], or $id_mem variable will overwrite your $_SESSION['id_mem'], which is why register_globals were turned off by default almost 10 years ago (they allow hackers to set your session variables and program variables to anything they want.) A) Turn register_globals off ASAP. B) If you happen to be on a server configuration where you cannot do that, shame on your web host and you must make sure that you don't use cookie, get, post, or program variables with the same index name/name as your session variables.
  16. What does a phpinfo statement show for the register_globals setting? Do you have any code at all (logout) that clears $_SESSION['id_mem']? Where is that code at relative to what you have posted?
  17. \n characters don't actually mean anything in displayed content (they only format the 'view source' of your page in the browser.) Use nl2br when you output content on the page to add HTML <br> tags to each \n character.
  18. In order to make your code general purpose (so that all you need to do is setup data that defines what should be produced before executing your code), you would use an array that contains the field names that you want to output for each column. You would then iterate over this array of field names and access the corresponding $row[$field] value - <?php $fields = array('whatever','somethingelse','nextfield'); foreach($fields as $field){ //do something with the value in $row[$field] echo $row[$field]; } This method can also be expanded so that the array holds both the field name and the corresponding column heading (Jan, Feb, Mar, ...) and you can dynamically produce the column heading by iterating over the same $fields array. To reuse the same code for a different quarter range of months of your choice, just setup the $fields array with the correct field names and column headings.
  19. You can always alias a column in your query to give it a meaningful name - SELECT field5 as whatever, field6 as somethingelse, ... Then reference those aliases in your php code - $row['whatever'] $row['somethingelse']
  20. About the only thing I can tell is - $new_heading = $row['some_column_name_here...']; // get the column in the data that represents the heading in the sample code is your 'Field5'.
  21. Your goal will be to get all the data you are interested in, using one query, in the order that you want that data, then simply output the information the way you want it when you iterate over the data using a while(){} loop. For your one-time heading information and the 71059B,71060B,... sub-headings, you would simply detect the first pass through the loop (to output the one-time heading) and detect every time the sub-heading changes to (optionally) close out the previous section and start a new section. Based on what I can tell from your queries, you don't even need to do a UNION/JOIN, but your use of non-descriptive column names/variables leaves a lot to be desired in the clarity of what you are trying to do (makes it hard for us to directly help you with the one query that could do this.) Edit: Here is some sample code - <?php $query = "your query statement here..."; $result = mysql_query($query); $last_heading = null; // remember the last heading (initialize to null) while($row = mysql_fetch_assoc($result)){ $new_heading = $row['some_column_name_here...']; // get the column in the data that represents the heading if($last_heading != $new_heading){ // heading changed or is the first one if($last_heading != null){ // not the first section, close out the previous section here... echo "(optionally) do what is needed to close out the previous section"; } else { // is the first section, output the one-time heading here... echo "do what is needed to output the one-time heading"; } $last_heading = $new_heading; // remember the new heading // start a new section, output the heading here... echo "do what is needed to start a new section"; } // output each piece of data under a heading here... echo "handle each row of data under any heading"; } if($last_heading != null){ // there was at least one section, close out the last section here... echo "(optionally) do what is needed to close out the last section"; }
  22. You are likely getting a header error on specific page(s) that is preventing the session_start() from working. Do you have php's error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that all the errors that php detects will be reported and displayed? Stop and start your web server to get any changes made to the php.ini to take effect. Also check using a phpinfo() statement that the two settings have actually changed in case the php.ini that you are changing is not the one that php is using.
  23. Your setcookie() statement is clearing the 4th parameter, the path the cookie matches. That is/should be causing two different session id cookies to exist, one with a '/' path setting and one with a '' path setting. As you navigate around your site, that is likely causing the symptom. Why do you even have that setcookie() statement? I recommend removing it. You should also delete any existing session id cookies/completely close your browser after you make any changes to that code so that it will start with a fresh session id cookie that has the correct parameters set in it.
  24. Is your problem actually for subdomains (part of the thread's title) or domains? The solution for subdomains is different from that of different domains. In your previous thread, someone mentioned (in great detail) that the session id WILL NOT BE propagated between different domains by the browser using a session id cookie or by php's transparent sid management on the end of the URL and that you would need to propagate the session id on the end of the URL across different domains yourself. Did you do this when you navigated between your different domains?
  25. Both fields are DESC and apparently from a database (you are using mysql_fetch_array and getting both the numerical and associative keys.) Why not just do this in the query - ORDER BY add_date DESC, add_time DESC
×
×
  • 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.