php

PHP: Is there a way to download files in case curl extension is not available?

Hello All, Is there a way to download files in case curl extension is not available or has been disabled? ...

Properly navigating relative local paths in PHP

I'm having trouble specifically with the getimagesize function. I'm making the function call from /item/ajax/image.php relative to the domain's HTTP root. I'm trying to get the dimensions of an image stored at /portfolio/15/image.jpg. From what I understand, the function takes a filename as an argument, so I tried the following: getimag...

Open page with Form pre-filled

I have an entry Form. When the page is loaded, it must check: if ($_SESSION[WorkMode] == 'UPDATE') Then fill the Form with values from the database, else open a blank Form. If I fetch the results in a different PHP file and call this .php file on load, how to fill the Form. ...

Adding different data to different jquery tabs

i have 2 functions 1- addMessage(): save data into database and is called only on click . 2-updateMessage():get data with ajax from database, called when document is ready ,called every 3 seconds for new data, and called on success of addMessage(). function updateMessage() { $.ajax({ url:"db.php", type:"post", dataTyp...

.mov file to .flv file conversion issue for ffmpeg using PHP

Hi all, Is there any possible way to convert .mov file to .flv file conversion issue for ffmpeg using PHP. If yes, kindly let me know how to do? Thanks in advance, Fero ...

Character Encoding Problem

I know this sounds really silly but what character encoding should I use for something that looks like this in UTF-8 â��â�¥ �¼���½�±�¼� The website is in English. This is something user generated content which is stored in the database that is utf_general_ci and displayed on the screen . I just want to display it ...

Difference between Class and Structure in PHP and Java

What is real difference between Class and Structure when you are dealing with Object Oriented Programming. This question is asked many times during my interviews for SE. Some people says that there is only one difference: Structure members are public by default and Class members are private by default. Some says there are many differen...

Crontab doesn't run Wget with a url with parameters

Hi, I'm using Aptana Cloud without root access. WORKS: * * * * * /usr/sfw/bin/wget -qO- 'http://myproject.aptanacloud.com/myproject/myphp.php' | /bin/mail [email protected] DOESN'T WORK!: * * * * * /usr/sfw/bin/wget -qO- 'http://myproject.aptanacloud.com/myproject/myphp.php?param1=blog%2frss2.xml' | /bin/mail [email protected] I...

Decoding http response with certificate

Hi all, I'm new to php and I need to authenticate to a SSO server. The SSO server is a .Net one, using a SSL certificate. When I go back from the SSO server, the response is encoded. I have the key of the certificate of course, but how could I decrypt the response ? This is very vague for me, don't hesitate to detail your answer :) M...

Performance increase using Smarty + Caching?

Hey, I am going to start using codeigniter, but since it only offers to cache everything or nothing (which would not work, because I have logins, and other areas which cannot be cached) I was wondering whether it is a good idea to use Smarty. The only concern I have in this question is speed. (No yes/no smarty general question.) My Qu...

Crypto requirements and language/framework selection.

I want to build a web-based information management application for a client. The application will be used to store passwords and critical documents online. I want to know: (1) Which language/framework to go with: PHP or Ruby on Rails (RoR) or any other? (2) What type of hosting for good-security, Linux or Windows? Any other thing to b...

addslashes() for preg_replace() and co.?

How can I escape incoming data so I can use it as a pattern in preg_replace() and consorts? For example, I need to match against this string: /vorschau/ Obviously, I need to escape the "v" or I will get an error. I can't find anything in the documentation. Is there some sort of addslashes() for this, or a workaround within the expres...

How to include session log file

[php] $filename = "./logs/".$_SESSION['uniqueID'].".php" ; // output 4b1e7b3489549.php $data = "bla..bla..\n"; $data = stripcslashes($data); /* Writing file configurations */ $buat = fopen($filename, "w+"); fwrite($buat, "$data"); fclose($buat); ?> [/php] Now whe i call the output file from $filename (record.php) f...

Updating sql database problem php

Hey, I am trying to make a password retrieval system on my site, and I am having problems updating the password reset field in my database. I have tried everything, but nothing seems to work. This is my code so far: $passwordreset = md5(mt_rand()) . md5(mt_rand()) . md5(mt_rand()); $con = mysql_connect("localhost","XXX","XXX"); if...

Get first element of array

Hi ! I have an array: array( 4 => 'apple', 7 => 'orange', 13 => 'plum' ) I would like to get first element of this array. Expected result: string apple One requirement: it cannot be done with passing by reference, so array_shift is not good solution. Any ideas ? ...

PHP nested conditional operator bug?

return true ? 'a' : false ? 'b' : 'c'; This should return 'a', but it doesn't. It returns 'b' instead. Is there a bug in PHP's order of handling the different parts of the conditional operators? I got the idea from ht...

This loop won't echo my string

I have an infinite loop that I want to sleep for a second but the browser just hangs and nothing echos. Can someone tell me why? while(1) { sleep(1); echo 'test'.'<br>'; } ...

Auto delete all files after x-time

Hi, all, i comeback again with hug questions... maybe someone here can help me... how to auto delete all files under a sub directory after x-time (let say after 24 hours) but that i want without using cronjob command from server or pl just using php code or just visit the page without clicking something and the command auto run, where i...

How to call classes from a variable variable?

I'm not quite sure how to correctly put this question. I want to dynamically call functions that are contained in classes (I think this means they are called 'methods'). Here is an example of my code which I hope helps explain what I am trying to achieve. In this instance $result returns all the different modules that are loaded. This ...

Witnessing for the first time

Hello All, I am currently working on a website. For debugging reasons, i chose the view source option of firefox v3.6b4. Then i clicked on javascript link eg something like this from within the source page: <script type="text/javascript" src="./dealer/dialog/jquery-1.3.2.min.js"></script> Guess what, it showed me below message: <HTM...