Jump to content

adrianTNT

Members
  • Posts

    146
  • Joined

  • Last visited

Everything posted by adrianTNT

  1. Hello. I dont know how this works, I have many zip names with a timestamp in file name, like: animation_23432432.zip gallery_34232432432.zip What would be the code to return that number from such strings? something like $my_timestamp = "[anything]_%s.zip" ?!
  2. Hello. I have the actual real directory structure like this: my_files/101/ my_files/102/ and I want to rewrite to cleaner URL like this: /101/ /102/ if there is an actual file index.html in the real folder my_files/101/index.html then I want that one shown at URL /101/ else I want it do display my script (generate_index.php). I was trying something like: But I guess REQUEST_FILENAME and -F is wrong way to test if index.html exists. Which param and string I have to test?
  3. Grr... I just realised that I was confusing the mysql_free_result that I have at the end of my scripts with mysql_close. It is mysql_free_result that is not always reached because it exits before it. So this will not cause too many connections problem, it will just use more ... RAM ? Or what memory?
  4. pconnect is the default function for mysql in Dremaweaver so yes, that is what I use. Anyone has any answers ?!
  5. Ok. What if I run two queries one after another with the same name and I only clear results ONCE after this? Will it be the same as I clear result after each query? recordset1 = "some query"; recordset1 = "some other query"; free_result recordset1; will it be the same (in terms of memory usage) with this? recordset1 = "some query"; free_result recordset1 recordset1 = "some other query"; free_result recordset1;
  6. Hello. I have this situation in myny of my scripts: pconnect. if(something){ EXIT; } close_connection. Does that mean that connection would remain open?
  7. Hello. I am not using that generic name as variable, I just replaced site name with $site for this sample. I probably managed to fix the issue after all, because I dont remember it anymore, oops
  8. Maybe tge LA-U variable does this?
  9. Hello, is it possible to do a db query and have the result affect the .htaccess? I want to redirect a domain only if that domain is set in database to redirect. I never seen this in .htaccess file and I dont know if it is possible. Htaccess would contain something like: // get variable from this x php file .. // if (...) then redirect Anyone has a simple sample for this?! Thank you.
  10. Hello, I want to remove the "www" from address bar and this code works: RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] RewriteRule ^(.*)$ http://example.com/$1 [R=301,L] But... same .htaccess file will be used for multiple domains, how would the above code look if I want it work for any typed domain, not an exact given sample like above? Something like: RewriteCond %{HTTP_HOST} ^www\.($any_domain)\.com$ [NC] RewriteRule ^(.*)$ http://($any_domain).com/$1 [R=301,L] Thanks in advance.
  11. Yes, and that was the thing I was looking for. Will try. Thank you.
  12. Hello. If I want to add 20 to a "user_funds" field in the table, is there a way to just tell mysql to increase funds field by 20? instead of creating a recordset first and read the current funds? Thanks.
  13. Hello, I have this code: mysql_select_db($database_site, $site); $query_Recordset_queue_to_send = "SELECT * FROM subscriptions_queue ORDER BY subscriptions_queue_id ASC LIMIT 1"; $Recordset_queue_to_send = mysql_query($query_Recordset_queue_to_send, $site) or die(mysql_error()); $row_Recordset_queue_to_send = mysql_fetch_assoc($Recordset_queue_to_send); $totalRows_Recordset_queue_to_send = mysql_num_rows($Recordset_queue_to_send); The table is empty and I should see $totalRows_Recordset_queue_to_send = 0 but it always returns the same value of the "limit", returns 1 in the above sample. Anyone knows what I did wrong? Thank you.
  14. Pfew... I finally did it I needed to add another association after the reset: mysql_data_seek($Recordset_listing_comments,0); $row_Recordset_listing_comments = mysql_fetch_assoc($Recordset_listing_comments); Is this common usage? I entered that there because I saw $row_Recordset_listing_comments = mysql_fetch_assoc($Recordset_listing_comments); right after the query (meaning before first use), so I thought to add it before second use too. I dont know if I make sense but it works and thanks for your time
  15. OK but if it works when I first use the results, then shouldn't it work the same on second use? :-\
  16. @cooldude832: sry but I dont know what you meant @gevans: Yes, it works ok if I change only second loop/assoc: - do {//code} while mysql_fetch_assoc - reset to zero - while mysql_fetch_assoc {//code} So second is different than first one, otherwise it doesnt work. But it would be better to make both work with do{}while mysql_fetch_assoc as it is formated by default in Dreamweaver, otherwise when I work on this code again I might change it back by mistake. so does it work to somehow shift the values/data when I do that reset? So that I can use same do{}while... on second association too.
  17. Gevans, that seems to be what I need but I am confused about the zero. I don't know what number to enter there. If I use 0 then at second association it prints one blank comment before my valid ones. If I enter 1 then it shows correct number of comments but first is still blank. I hope I make sense. maybe you can tell me more about the zero, do I need to calculate it's value somehow or zero simply resets the association? I use in this order: - mysql_fetch_assoc - mysql_data_seek($Recordset_listing_comments,0); - mysql_fetch_assoc Thank you.
  18. Hello, this is probably easy but I dont know how to properly do it, I am not very familiar with mysql yet... I have a query that looks like this: <?php $query_Recordset_listing_comments = sprintf("SELECT * FROM comments WHERE comment_listing_id = %s ORDER BY comment_id DESC", GetSQLValueString($listing_id, "int")); $query_limit_Recordset_listing_comments = sprintf("%s LIMIT %d, %d", $query_Recordset_listing_comments, $startRow_Recordset_listing_comments, $maxRows_Recordset_listing_comments); $Recordset_listing_comments = mysql_query($query_limit_Recordset_listing_comments, $mmfiles) or die(mysql_error()); $row_Recordset_listing_comments = mysql_fetch_assoc($Recordset_listing_comments); ?> And I use it's values like this: <?php do { echo $row_Recordset_listing_comments['comment_text']; } while ($row_Recordset_listing_comments = mysql_fetch_assoc($Recordset_listing_comments)); ;?> I wanted to use this do .. mysql_fetch_assoc in a second location in my page but second time it doesn't return results anymore. Can I only do mysql_fetch_assoc once ? Thanks.
  19. I looked with notepad and first characters appear to be pczip something (the library that creates the zip) but I dont see any errors. I attached that zip if you want to look but I think there is nothing helpfull. This happens in InternetExplorer only, if I chose directly "open" at download prompt. If I chose "save" then after download completed I chose "open" it works fine. [attachment deleted by admin]
  20. I simplified it as much as I could removing db queries, this gives an error: if(isset($_REQUEST['file_to_get']) and $_REQUEST['file_to_get']!=''){ session_start(); header("Content-Type: application/zip"); header('Content-length:'.filesize('temp_zips/'.$_REQUEST['file_to_get'])); header("Content-Disposition: attachment; filename=".$_REQUEST['file_to_get']); readfile('temp_zips/'.$_REQUEST['file_to_get']); unlink('temp_zips/'.$_REQUEST['file_to_get']); exit; } ?> Just adding session_start() there shows me this error: Maybe I should add some encoding header information?
  21. That was my solution too, I thought there is another way around this. Otherwise, (as you said) I will have to separate session_start() from the file download. Any other ideas why that would happen ?!
  22. Hello. I have a code that should prompt for a zip file download. header("Content-Type: application/zip"); header('Content-length:'.filesize('zips/'.$_REQUEST['listing_id'].'.zip')); readfile('blabla.zip'); It works OK but the problem is that I have to add session_start() right before that code, to check some user properties. When I do this I get "corrupted zip file" error in browser. Is it wrong to add session_start() with zip header info? Maybe there is some known issue? Thank you.
  23. Try this code: <?php mail("$v","$subj","$emess","from: noreply@".str_replace('www.','',$_SERVER['HTTP_HOST']), "-fnoreply@".str_replace('www.','',$_SERVER['HTTP_HOST'])); ?> If your site is foo.com then it will appear from: [email protected] As I remember the -f specifies "return path" that is related to your issue. I hope this helps.
  24. Thanks. I didn't notice before now. All these posts are offtopic already, I hope nobody minds ....
  25. When you are done with the sound there is another cool thing to do, you don't want people to steal your work, so ... If someone right-clicks the site to steal images, show that system error with loud "DING !" and says "Protected content". I was mean, I know.
×
×
  • 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.