Jump to content

kiss-o-matic

Members
  • Posts

    51
  • Joined

  • Last visited

    Never

Everything posted by kiss-o-matic

  1. So, what's the standard here? I realize that my site right now is probably not optimal. I have a php file I include which connects to my database (and stores the database passwords). Back on an provider, they were attacked and Perl was stopped. So, when someone accessed the site, just displayed the code, in all it's glory. As nothing is perfect, I assume that can happen now. So, considering you need a password to actually get to the database, I'm interested in hearing of secure methods to store the DB password. I guess if you refuse connections from remote machines in MySQL that's a start. Renaming the phpmyadmin link would be next. Thoughts? Cheers
  2. Did you set the client character set in MySQL? Should look like this is your my.cnf [client] default-character-set=utf8
  3. Possibly. You might want to ask them. YOu should really try the demo code in the package install though. http://phpmailer.sourceforge.net/
  4. Are you on windows? Is your server? Try \r\n for linebreaks.
  5. In versions 4.1 (I think, definitely 4.2) and up you have to do the following. When you connect to your database, you have to tell it what charset you want. Otherwise, you will get garbage. $db = mysql_connect('localhost','user','pass' ) or die ( Could not connect: ' . mysql_error() ); mysql_select_db( 'dbname' ) or die; if ( !mysql_query("SET CHARACTER SET utf8", $db ) ) { echo "problem setting character<br>"; } if ( !mysql_query("SET NAMES 'utf8'", $db ) ) { echo "problem setting name<Br>"; } Noticy in effigy's post there's a client portion. You need to have this set (check you my.cnf) for it to work right, AFAIK, and the charset in the above queries need to match the client collation & charset. FYI, if you're going to deal w/ multibyte characers, leave it in Unicode. You will kill yourself messing w/ the others.
  6. What does your DB look like? Something like: User,City1,City2,City3,City4,City5 Or is city one column? If it's the former, you have to check each one. For the latter, a REGEXP. "SELECT * FROM states WHERE city REGEXP '.*Pasadena.*' ";
  7. I've decided to go w/ phpmailer(). I guess I'll mark this as solved.
  8. Do you have access to the system logs of your machine? tail /var/log/httpd (assuming you're running apache) and see what it says. I just had the issue where my smtp server uses a nonstandard port (standard is 25). Probably would've never caught it had I not see it complain in the log. The following fixed it. $mail->Host = "my.smtp.host:port"; Also, for testing you should use the very simple example code that comes w/ the package.
  9. Sorry, I hit post before I was done and went back. Edited now. EDIT: Worth noting: the exact code works fine on a dedicated server
  10. I'll make this quick. I have a godaddy virtual dedicated server. I was literally told they weren't allowed to help me trouble shoot this problem (although they gave me some hints) WTF? Anyway, I'm using the following PHP code snippte: if ( mail( $to, $subject, $body, $headers ) ) { $msg = 'Succesfully sent mail. Thank you.<br>'; return true; } else { $msg = 'Mail Delivery failed.<br>Please contact administration in the forum.'; return false; } I get no errors... but also no mail. The tech said (through another tech after 30 minutes) I need to "white list" an IP. I assume this is a sendmail setting. Next problem? There's no sendmail config file. :/ Anybody have any experience w/ this?
  11. Thanks, pocobueno1388. I stuck that in a header and got the love I needed.
  12. I'm moving my site from a shared server to a dedicated one. The preinstalled PHP5 seems to not print out any syntax errors. Instead, only a blank page. Every time I've installed, the default is to dump errors on the screen. Can someone tell me where this setting is? Cheers
  13. def is a member function of a class.  -> is what access that member function.  As ProjectFear said, this is what you find in OOP across the board.  Just think of it as "calling the def() function on the $param variable". 
  14. Sorry, that was a typo.  Assuming I defined the curl seesion properly [quote]$ch = curl_init()[/quote] I want to know how to access secure page (SSL) pages.  As it stands, it just times out with an error.
  15. Hate to ask such a general question, but can't figure out what I'm doing wrong. Here's the general gist of my attempt. [code] // login to Yahoo $url = "https://login.yahoo.com/config/login_verify2?.done=http://auctions.yahoo.com&.src=auc&.intl=us" $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1) curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2 ); curl_setopt($ch, CURLOPT_TIMEOUT, 5)'; curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt'); $data = curl_exec ($ch); print $data; [/code] It just times out, and tells me: Warning: curl_error(): 7 is not a valid cURL handle resource in Am I missing something? EDIT: Fixed typos in subject & body
  16. Thanks -- I just found file_get_contents('url') as well.  Any difference?
  17. Is this possible w/ PHP?  I essentially want to slurp up the contents of some other webpage via it's URL, then do something with it, and display it in a browser.  All searches for "get()" turn up references to the $_GET array. I have a Perl script to do this already, but my provider doesn't offer it w/ my current plan.  I don't want to update just yet.
  18. I've got a text box that I'm using to store addresses.  The problem is, if I input my address like this: "1234 Main St. New York, NY, 11111" Then it's stored in the database like this: "1234 Main St. New York, NY, 11111". I tried this: $addr = preg_replace("/\n/","<br>",$addr); but it does not work.  Thanks
  19. Can't figure this one out. [code] if ( preg_match("/(flag1.+)*(flag2.+)*/s", $definition, $matches ) ) {         echo "found " . sizeof($matches) . " matches<br>";         for ( $i = 1; $i <= sizeof($matches); $i++ ) {             echo "$i :" . $matches[$i] . "<br>";         } } else {     echo "no match<br>"; } [/code] $definition will most of the time look like this: [code] flag1 He runs She runs They run flag2 he cries she cries they cry [/code] Although sometimes it will have text only in the flag1 section, and sometimes only in the flag2 section. So naturally, I want to match zero or more occurences of both of them. I thought the above would work, but alas, it does not.. In fact, it's only reporting one match. O_O Seems if I use one *, I can half of it to work, but of course, I need all of it to.
  20. A code snippit would help. You also need to make sure that 1) Your web server (apahce?) supports the character set 2) Your browser is set to the right character set. How are you trying to display the file name? Just as a normal string?
  21. If the strings you are parsing are of different size, substr() is probably not a good choice. Regex is about the only way I can think of. I assume the roadblock you hit w/ your regex previously is b/c of newline characters? But you stripped those out, so that shouldn't be the problem.
  22. Hi. The version of phpmyadmin that my provider provides really sucks. I basically can't edit any text type fields that are over X amount of characters (a few sentences, basically). I'm trying to write my own interface, but have hit a stump. When I use 'DESCRIBE table' or 'SHOW COLUMNS FROM table' in a terminal, or in the phpmyadmin SQL window, it returns all rows for that table. However, w/ the code below, I only get the first row: $result = mysql_query("DESCRIBE mytable"); $table = @mysql_fetch_assoc( $result ); prit_r( $table ); The above returns this: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Array ( [Field] => id [Type] => int(11) [Null] => [Key] => PRI [Default] => [Extra] => auto_increment ) [/quote] which, as before, just the first row. Shouldn't this be a multi-dimensional array, and not an associative one? Guess I'm missing something. It is late, afterall.
  23. nevermind. I've discovered str_replace which works better.
×
×
  • 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.