
phpsycho
Members-
Posts
164 -
Joined
-
Last visited
Never
Everything posted by phpsycho
-
I think I finally got Cassandra and Thrift installed correctly. I tried the example php script that requires Thrift. I get errors saying it failed to require different files. [sat Aug 27 23:37:08 2011] [error] [client 24.63.100.20] PHP Warning: include_once(/usr/share/php5/Thrift/protocol/TProtocol.php): failed to open stream: Permission denied in /usr/share/php5/Thrift/Thrift.php on line 786 [sat Aug 27 23:37:08 2011] [error] [client 24.63.100.20] PHP Warning: include_once(): Failed opening '/usr/share/php5/Thrift/protocol/TProtocol.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/php5/Thrift/Thrift.php on line 786 [sat Aug 27 23:37:08 2011] [error] [client 24.63.100.20] PHP Warning: include_once(/usr/share/php5/Thrift/transport/TTransport.php): failed to open stream: Permission denied in /usr/share/php5/Thrift/Thrift.php on line 787 [sat Aug 27 23:37:08 2011] [error] [client 24.63.100.20] PHP Warning: include_once(): Failed opening '/usr/share/php5/Thrift/transport/TTransport.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/php5/Thrift/Thrift.php on line 787 [sat Aug 27 23:37:08 2011] [error] [client 24.63.100.20] PHP Warning: require_once(/usr/share/php5/Thrift/transport/TSocket.php): failed to open stream: Permission denied in /var/www/cass.php on line 5 [sat Aug 27 23:37:08 2011] [error] [client 24.63.100.20] PHP Fatal error: require_once(): Failed opening required '/usr/share/php5/Thrift/transport/TSocket.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/cass.php on line 5 sooo by the looks of it I have to set perms to 777 on those files? is that okay to do? I never change perms on files unless its in /var/www I learned changing system file perms can really mess things up. What do you guys think? safe to set to 777?
-
Replacing contents in <div> with fadeIn/fadeOut effect
phpsycho replied to xmsc's topic in Javascript Help
yup and in your css make sure all of those are hidden and only show links to fade them in and out. -
Replacing contents in <div> with fadeIn/fadeOut effect
phpsycho replied to xmsc's topic in Javascript Help
use Jquery, much better. fadeIn("slow"); fadeOut("slow"); $('#id').click(function() { //do stuff like fadeout all others but the clicked on div }); -
I tried installing Cassandra on my Ubuntu server a few weeks ago and any tutorial I find doesn't work. Most all tutorials were made a year or more ago. I read the instructions that came with Cassandra and follow the steps but still won't work. I got Cassandra on my server now, but I can't run it without Thrift. I installed Thrift, but when I try to start Cassandra the loading process stops at loading Thrift. Any ideas to get Cassandra installed and running correctly on Ubuntu Natty? Thanks
-
I tested your code and it looks fine to me. what do you mean by "$echo is executed before the button press."? and varchar(255) should work... could I see your table structure? oh also, you need to clean your vars before inserting to db. mysql_real_escape_string()
-
thats because when you refresh you re-execute the post if(mysql_num_rows(mysql_query("SELECT * FROM `table` WHERE `name`='$clean_var_name'")) > 0){ echo "This record already exists"; }else{ //insert into db }
-
you are most likely using int. Use varchar(255) UTF-8 if(isset($_POST['btnsave'])){ //insert into db }else{ //display form }
-
You want to just display the posted content? like name? just echo it out before you exit. echo $name;
-
well what exactly isn't working? any errors? or is it just blank screen?
-
so then all you need is if(isset($_POST['btnsave']))
-
if(isset($_POST['btnsave']) && $_POST['btnsave'] =="Save")
-
no matter how you send a email to any big email providers it will not work if you have a dynamic ip.
-
You have to have a static IP in order to send mail to providers like hotmail yahoo etc If its not static then yahoo or whoever will think its spam and block it from coming through. Although.. it does go through sometimes, usually takes about 4-5 hours though and it ends up in the spam folder. Having the same problem.. and I can't get a static IP. My fix was to host it somewhere else using vps.
-
Okay its not the converting of the data thats the problem.. It works.. but in order for it to work I have to echo the html from the website after echoing the title, desc, and keywords. If I don't do that then it won't display the converted title, desc, keys correctly. Any clue why thats happening? EDIT: uhh okay, it works when it wants to and if it wants to then the html needs to be echoed for it to work. lol wtf
-
I'm scraping a bunch of sites, but this one in particular is http://010701070107.blog5.fc2.com/ I am scraping it for title,desc, keywords. So I wanna pull the charset and convert it first then pull the important data from the converted charset curl response. and yes yours worked. now I'm just trying to integrate it into my script, but having a hard time doing so
-
sigh.. still having issues with this. $html = $response; $url = $info['url']; $erurl = $info['url']; $code = $info['http_code']; $domain = parseHOST($url); $url = str_ireplace("www.","",$url); $url = rtrim($url, "/"); if($html && $code >= 200 && $code < 300){ $charset = 'None'; $description=''; $keywords=''; preg_match("/<head.*>(.*)<\/head>/smUi",$html, $headers); if(preg_match("/<meta[^>]*http-equiv[^>]*charset=([^\"']*)>/Ui",$headers[1], $results)){ $expr = '%charset=([^"\']*)%'; $html = preg_replace( $results[1], 'UTF-8', $results[0]); $html = mb_convert_encoding($html,'UTF-8',$results[1]); } if(preg_match("/<head.*>(.*)<\/head>/smUi",$html, $headers)){ preg_match("/<head.*>(.*)<\/head>/smUi",$html, $headers); } Sorry I'm kinda new to the whole charset thing. its still coming out with ¥Ü¡¼¥«¥í¥¤¥É¤Î²Î»ìÃÖ¾
-
perfect, only problem now is.. what happens if theres a site without that meta tag but has japanese text or some other language? How could I fix it to read that text?
-
I believe \[0] would be the whole tag, not just the charset. I even did a small bit of code to test and it still don't work.. $url='http://010701070107.blog5.fc2.com/'; $userAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_NOBODY, true); $buffer = curl_exec($ch); $curl_info = curl_getinfo($ch); curl_close($ch); $header_size = $curl_info['header_size']; $header = substr($buffer, 0, $header_size); preg_match("~charset=([^\s]*)\s~is", $header, $header); $header = mb_convert_encoding("Japanese text", "UTF-8", $header[1]); echo $header; That just spits out this: ???若?????ゃ?????�臀??
-
Thats what this piece of code does... if(preg_match("/<meta[^>]*http-equiv[^>]*charset=(.*)(\"|')>/Ui",$headers[1], $results)){ $charset= $results[1]; } else { $charset='None'; } if($charset != 'None'){ $title = mb_convert_encoding($title, "UTF-8", $charset); }
-
Nope it still won't work
-
Its actually a scraper. so its scraping data from websites like their title, desc, keywords, etc. so I picked up a couple Japanese sites and they have that meta tag, just different charset. So this is my code that I have to convert the title of the site.. $charset = 'None'; $description=''; $keywords=''; preg_match("/<head.*>(.*)<\/head>/smUi",$html, $headers); if(count($headers) > 0) { if(preg_match("/<meta[^>]*http-equiv[^>]*charset=(.*)(\"|')>/Ui",$headers[1], $results)){ $charset= $results[1]; } else { $charset='None'; } } else { $ok=0; //echo 'No HEAD - Might be malformed or be a feed<br />'; } if($charset != 'None'){ $title = mb_convert_encoding($title, "UTF-8", $charset); } if($title == null){ $title = $url; } Shouldn't that fix the problem, using that mb_convert_encoding?
-
Yeah I the field in the mysql table set to utf-8 but it still doesn't display right.
-
I came across some Chinese or Japanese characters in my db. They didn't display correctly though.. what function do I need to use so the characters come out correctly? Not translating, just displaying their text correctly. Like in my db it has: ¥Ü¡¼¥«¥í¥¤¥É¤Î²Î»ìÃÖ¾ì but what the text actually looks like is this: ボーカロイドの歌詞置場
-
nah I am using include() with the location to the file not a url. include('/var/www/include.website.com/connection.php'); in the onlinefriends.php it includes session start and a mysql connection and just a simple if users session userid is not set then echo failure and exit; It should be set.. it shows that its set in other files. there is two files in the same directory that both show that the session userid is not set. all other files are fine.
-
I have it set up to share sessions with all of the subdomains I have. The structure of my site is.. mainwebsite.com => include.mainwebsite.com => js/bar.js => ajax/onlinefriends.php => mysqlconnect/session_start.php => output: user is offline. so every page I have pulls session_start from include.mainwebsite.com. the mainwebsite.com sees that there is an opened session, but when it comes to include.mainwebsite.com it just doesn't see any opened sessions when reading the onlinefriends.php I have in apache sites enabled the header option to allow the js to run across my domains. any idea why the other files can find the session but onlinefriends.php just keeps creating new blank sessions?