php

Strange problem with session - PHP

I have strange problem, that don't work on server: session_start(); $quser = new Quser($_SESSION['$fb_user_id'], $pdo); but this, seems to be OK: session_start(); $x = $_SESSION['fb_user_id']; $quser = new Quser($x, $pdo); Of course, on localhost first option work fine. What is going on? Is there any restriction about that? ...

PHP to Excel, bold font

For transferring some data from to excel via php I am using this function for the creation of labels; function xls_label($row, $col, $value, $bold ) { echo pack("ssssss", 0x204, 8 + strlen($value), $row, $col, 0x0, strlen($value)); echo $value; } This adds a label in regular font. Now I was wondering what do I n...

Associative Array : PHP/C vs Flex/Flash

In PHP an Associative Array keeps its order. // this will keep its order in PHP a['kiwis'] a['bananas'] a['potatoes'] a['peaches'] However in Flex it doesn't with a perfectly valid explanation. I really can't remember how C treats this problem but I am more leaned to believe it works like php as the Array has it's space pre-reserved i...

file_get_contents not working for local files

I recently upgraded my XAMPP from PHP 5.2 to 5.3.1 I seem to be having a problem with file_get_contents(). I can use the function to get something like "http://www.google.com", but it times out when I use it on a domain I have setup locally e.g. "http://localhost/my_dir/my_css_file.css". I'm not really sure what the problem is. If it'...

Lost connection to MySQL server during query - PHP, MySQL

Hello, I have this php code, the files are hosted on another server and db else where $hostname_xxx = "xxxdb.db.234141.mysqldbhosted.com"; $database_xxx = "xx11xx"; $username_xxx = "xx11xx"; $password_xxx = "xx332211xx"; $shasown = mysql_pconnect($hostname_xxx, $username_xxx, $password_xxx) or trigger_error(mysql_error(),E_USER_ERROR);...

alternate method if allow_url_fopen if off in php.ini file.

My application was working fine but I don't know how suddenly allow_url_fopen set OFF in my php.ini , there is php.ini file in my ftp dir but when I execute phpinfo(); it gives all php.ini configuration information.I dont know how to set this ON.can anybody tell me the alternate way to my code- $image_name=$unq.'.'.$extension; $newname...

Can I check for HTTPS in Magento PHTML files?

I am installing Clicky code on a Magento website. I would like to use their HTTPS tracker only on HTTPS enabled pages of Magento. How can I do this? I tried <?php if($_SERVER['https'] == 'on') : ?> but that doesn't work. Any suggestions on identifying HTTPS pages will be of great help! Thanks. ...

can anyone suggest me some tiny lightbox or modal dialogue box or thickbox to open a html or php page??

I have to open a page in a lightbox or thicbox style with a overlay image . I found thickbox on net but that is too big arnf 55 kb. I need a simpler and tiny js thing to do this. Can anyone plz suggest some?? ...

php show data in textarea after link has been pressed

Hi, How can i display data in a textarea after a link has been pressed? This data is saved in a database. I'm trying to dynamically create a link for the field 'date'. If a user presses the link, the rest of the data for that date should be shown in a textarea. i'm looping through my data like this: foreach($data as $key) { echo ...

Fatal error: Class 'MySQLi' not found

Fatal error: Class 'MySQLi' not found in D:\Hosting\6448289\html\database.php on line 8 database.phph file - <?php $db_name = "szdb"; $db_server = "localhost"; $db_user = "root"; $db_pass = ""; $mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error()); ?> why I am getting this fetal error? ...

How to schedule in php

I have some files on my server, how to open them programatically once a day? Let them be http://site.com/scripts/video.php http://site.com/scripts/music.php Without my hands, just like sheduling (automatically). Even if I sleep and server is working, they should open on given time. And additionally, how to open them once a 10 secon...

Problem to using session in different subdomain

I need to use the same session in different subdomains. First I put php_value session.cookie_domain ".aaaa.com" on .htaccess file and upload it to root path. when I need to use sessions. I just call session_start(); Sometimes it works but sometimes it doesn't. I tested this and found that. If I go to login page the first time,...

convert fopen to curl?

Hi everyone I have recently changed servers, and one of my scripts is not functioning on the new server, as fopen is not enabled? Is it possible to change the following code to use the CURL function instead? Hope someone can help! <?php $postToFileName = 'http://www.somesite.com/postfile.aspx'; $postArr = array( 'NM' => $row['Lead_...

PHP handle errors

Using this code with simplehtmldom script (http://simplehtmldom.sourceforge.net/manual.htm): function file_get_html() { $dom = new simple_html_dom; $args = func_get_args(); $dom->load(call_user_func_array('file_get_contents', $args), true); return $dom; } $url = 'http://site.com/'; $html = file_get_html($url); How to ...

Given a day and month, return the most recent date of that day and month in the form day-month-year

Given a date like "4 May", how do I get the most recent 4th May in the format "4 May, 2010"? If the day/month combination has not yet occurred this year, it should show the date for last year (e.g. "31 December" should translate to "31 December, 2009"). ...

Does the order of class definition matter in PHP?

If I have several classes in different php files that I'm including into a single file, and some of these classes have dependencies on other classes, does the order in which they are included matter? Or, is simply including them (in any order) before they are used all that matters? ...

Preserve $_POST variables for multiple reloading of page............

I have some datas that are submitted with POST method on the same page. I have some actions and layout which follow up using these datas. Among those actions, I also have a quick action which sends the parameter in query string. When I click on this link, I can fetch the action that I am trying to do, but I loose all the variables from m...

WordPress - PHP Code Box

I am very new to WordPress, so I would appreciate some help. I am using WordPress as a CMS, and I am trying to make the thing work so that when I select a page to edit, there is a special box where I can input PHP code that will execute on my page. I have found the PHP exec plugin, which works perfectly, but I would like to keep the co...

PHPExcel how to get column index from cell

PHPExcel $cell->getColumn() returns 'A', 'B', 'C', ... which is the best way to get the integer (0, 1, 2, ...) from the cell. This function doesn't exist. $colIndex = $cell->getColumnIndex(); So what is the alternative withoput converting chr to ascii ? ...

Take in console input for PHPUnit

I want to be prompted for an input when I run a PHPUnit test case and then to use that input as part of the test. In other words, I want to use a dynamic input value for a field. How can I do this? ...