php

question about the mvc pattern

i dont quite understand this pattern. from what i have read, it looks like one model = one table (if you are using database to store data). so if i've got a table called tags, i should have a tags model. and with a threads table i create a threads model. then i got a tags controller and a threads controller right? so what if i've got...

set_time_limit() not working, timing out who knows why?

I have an upload form that uploads mp3s to my site. I have some intermittent issues with some users which I suspect to be slow upload connections... But anyway the first line of code is set_time_limit(0); which did fix it for SOME users that had connections that were taking a while to upload, but some are still getting timed out and I ha...

PHP Regular Expression - Repeating Match of a Group

I have a string that may look something like this: $r = 'Filed under: <a>Group1</a>, <a>Group2</a>'; Here is the regular expression I am using so far: preg_match_all("/Filed under: (?:<a.*?>([\w|\d|\s]+?)<\/a>)+?/", $r, $matches); I want the regular expression to inside the () to continue to make matches as designated with the +? a...

Can I do this with PHP?

<html> <head> <title>txt with js eff</title> </head> <body> <script type = "text/javascript"> function transfer(which) { document.getElementById("temp_name").value = which; } </script> <form action="" method="post" name="frm1"> <label> In put 1 </label><input type="text" name="username" id = "username"...

PHP prepared statement: Why is this throwing a fatal error?

Have no idea whats going wrong here. Keeps throwing... Fatal error: Call to a member function prepare() on a non-object ...every time it gets to the $select = $dbcon->prepare('SELECT * FROM tester1');part. Can somebody shed some light as to what I'm doing wrong? function selectall() //returns array $client[][]. first br...

PHP delete the contents of a directory

Hello, How do I do that? Is there any method provided by kohana 3? ...

Question about PHP classes

I am wondering what is the difference between $this->name and $this->$name? Also does $this have to be strictly named this or can it be anything? ...

zend framwork for web designing

how to apply java script with zend form.how to create zend form using zendframework including java script validation example: blur,focus,click events etc ...

joomla menu not visible

I am facing somewhat peculiar problem. i have two systems, both running xampp 1.7.1 . our site is based on joomla 1.5.10. One system is using fedora 12, the other one is using rhel 5. The problem is, in rhel system we can create delete and rename menu items. But this changes are not visible on the frontend. I mean, if you login as an adm...

a page shuold be open in right frame on clicking link of some page if left frame?

i am new user to php and i have a html page which is devided into two frmaes left frame and right frame and i am showing a tree list page in left frame and what i want to do is that when i click on a node of tree related link page should be open in right frame. how can i do this. plz help e out. ...

What is the best way to do server-side output caching in PHP?

I have a pretty complicated index.php now, and I would like to only run it once every hour. What is the best way to achieve this? Some ideas I've had Put it in APC with apc_store($page, 60*60*) - I feel this isn't what APC is for and will probably be doing something bad to the other parts of my site Save the output to a filesystem som...

Get referrer percentage

What will be the best way to go about getting the referrer details like say google 20%, msn 10%, internal 70%. Its for finding out how each article posted on the site was viewed or accessed or referred. Not in google analytics. But its for the bloggers to check after they have posted a technical article. The app is in php and also uses Z...

Whats a good way to show errors/messages to users in php?

I have been using my own method for years, but I figured maybe its not the best way to go about it. Essentially when I want to throw an error to a user, or display confirmation of a successful action, I do the following: if($something == "condition") { $_SESSION["message"] = "Your passwords didnt match! Make sure they are the same ...

Correct syntax for replacing multiple occurrences with PHP's preg_replace

I've gone over other questions from stack overflow with similar ideas but none seem to resemble closely enough what I'm trying to do. Seems simple, but I'm in a pickle. I'm trying to replace multiple occurrences of a line break (\n) with only one line break, so people won't be able to submit more than one line break at a time. Here's wh...

How to deliver music (progressive/download) over the web without exposing the URL of the mp3s (even in webkit browsers)

I want to be able to deliver music/mp3 using a flash player but I'd like to make it so that the mp3 files cannot be sniffed... i.e. you can't use safari, firebug..etc. to find out the mp3 location using the activity window. I don't have a streaming server. Any idea? If I go with a streaming server, any suggestions on how to go about it...

How to delete files from directory based on creation date in php?

I have a cache folder that stores html files. They are overwritten when needed, but a lot of the time, rarely used pages are cached in there also, that just end up using space (after 5 weeks, the drive was full with over 2.7 million cache files). Whats the best way to loop thru a directory that contains several hundreds of thousands o...

convert html pages to pdf

Im just imagining what the things I can do to make a pdf file out of my localhost files(.php). I tried using the online conversion tools but it didnt work because they're not on the web definitely. Can you recommend me of some ways on how I can achieve my goal of converting an html table into pdf and print it using the print function in ...

function keeps returning undefinded variable instead of array from php explode

the rgborhex function is returing an undefined variable: function rgborhex($unformatedColor){ if(strpos($unformatedColor, "-") == false) { //did not find a - in the color string; is not in rgb form; convert $rgbColor = hextorgb($unformatedColor); $rgbColor = explode("-", $rgbColor); return $rgbColor; } else { // found a - i...

connecting PHP webservices with Android

Hello, I am developing the android application. which is going to update the content from android to the web(php webservice). Can anyone give me the sample code for my reference. ...

Hide or encrypt urls of files?

Hello everyone and thank you for your time. I would just like to say that even though I'm no noobie at php, I don't know everything yet and I still lack some knowledge to be able to tackle some of these problems. My current dilemma is: I have a database with user-made songs that have all kinds of information including the location of ...