php

How to run a php script in the background in another php script (like an update button)

How would I go about running a php script when I pressed say an "update" button, in which then it would run say script x1.php (which has no echo's or or other output, successes or failed) then update the current page (I know the update part can be done with ajax, but im not sure how and how I would get the x1.php script to run in the bac...

Little help with this "date" function

I have this to select a date from a mysql db, and compare it to an array of month-names in swedish language. $monthnames = array("","Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"); $postdate = $monthnames[date("n", strtotime( $row['modify_date'] ))]; //Outputs something lik...

Why does PHP have a $ sign in front of variables?

In PHP and some other scripting languages have the $var syntax while Java and other languages we can do just var. Is there any theory behind it? Does it help them to parse. If not why would they choose to tack on an extra character in front? ...

My PHP newline beginner code isn't going to a new line. Little help?

Here's my code: <html> <Head> <?php $name = "Sergio"; ?> </Head> <body> <h1>It works!</h1> <?php echo "So someone tells me your name is " . $name . "."; echo "Welcome to the site, " . $name . "\n"; echo "THEN WHO WAS NEW LINE?"; ?> </body> </html> Ever...

Getting a response from the mailserver, if the email has been sent

We recently had the problem that important timed emails could not be sent by the mailserver but the Zend_Mail send() function didn't return false since the email was successfully delivered to the mailserver. In our situation the mail cue was jammed up due to some thousends of non sendable emails produced by a couple of cron jobs. How ...

reliable user browser detection with php

Trying to detect a user's browser with PHP only, is $_SERVER['HTTP_USER_AGENT'] a reliable way? Should I instead opt for the get_browser function? which one do you find brings more precise results? If this method is pragmatic, is it ill advised to use it for outputting pertinent CSS links, for example: if(stripos($_SERVER['HTTP_USER_AG...

PHP 5.3 and interface \ArrayAccess

I'm now working on a project and I have one class that implements the ArrayAccess interface. Howewer, I'm getting an error that says that my implementation: must be compatible with that of ArrayAccess::offsetSet(). My implementation looks like this: public function offsetSet($offset, $value) { if (!is_string($offset)) { throw n...

Fatal error in php (exceeded 60s of exec time)

Hey ppl.. i wrote a code to update the password encryption in my site.. the code is.. <?php $db= mysql_pconnect("localhost","root","root"); mysql_select_db("nitconnect"); $query="select password from register limit 1000"; $result=mysql_query($query); $c=0; while($ans=mysql_fetch_array($result)) { $newpass=sha1($ans[0].'Q*iV%qKz$&!C...

Email not sent or not working?

I need to ask a simple question to anyone. Any clue will be much appreaciated! Could you please tell me any reason why a php mail() may not be sent? I am pretty sure all details entered are correct from $to to $headers etc. Please, Francesco Code is: <?php if (array_key_exists('sendEmail', $_POST)) { $to = '[email protected],'.$_...

Email Div Content

I am trying to email the content of a Div. We have a booking system online and the user selects what options they want, then submit the form. It displays their information on the next page for them to print. I also want a copy of that emailed to them and us. I liked the look of Jonathon Sampson's email div using ajax script. But it does...

Is there any tool that will resolve and hardcode every included file of a PHP script?

Hi! I would need a tool, if it exists or if you can write in under 5 mins (don't want to waste anyone's time). The tool in question would resolve the includes, requires, include_once and require_once in a PHP script and actually harcode the contents of then, recursively. This would be needed to ship PHP scripts in one big file that ac...

What's the best way (to avoid modifying repeated code) to build multilingual web pages.

What's the best way (to avoid modifying repeated code) to building multilingual web pages? I know how to build a multilingual web page without having to modify CSS and Javascript files. But I can't think of a neat solution for HTML and Php files. Because if I have HTML or Php files for each language, I would have to modify each one if, f...

adsense iframes create new sessions on my server

Hi, I noticed that in my /tmp directory there are many session files. One visitor generates many (5-10-20) session files, but actually only uses one (it works fine). I figured that adsense iframes generate session files on the server that are not used. If I remove adsense I get normal one session per visitor. Any ideas how I can get ri...

How to add attributes to soapVars

Hi, I'd like to create soapVars with attributes like this: <tag attr="xxx">yyy</tag> Is this possible with the SoapVar constructor, but without using XSD_ANYXML and raw xml strings? Thanks! ...

Protected File Download Script. Almost there

I have a file that users will purchase via paypal, clickbank and paydotcom. I have to host the file's download page on my server. I've placed the file in a directory outside my public_html folder. The folder is on the same level as public_html and called "download" for example. The script below is supposed to do that, but I have two pr...

jQuery conflict

Hi, I have a wordpress plugin lightbox2 and a news scroller on my page. My head section looks like this <script type="text/javascript" src="wp-content/themes/soundsright/menu.js"></script> <script type='text/javascript' src='wp-includes/js/prototype.js?ver=1.6'></script> <script type='text/javascript' src='wp-includes/js/scriptaculous...

How to set PHP Date format

I need to create a date in this xsd format: "2001-10-26T21:32:52" but when I use the date function in php it replaces "T" with the Timezone (which it is supposed to do). This is the command I'm using: $time = date("y-m-dTH:i:s", time()); Which produces: '10-02-13EST10:21:03' How do I get it replace "EST" with just "T"? Thanks. ...

Dependency injection when you have no control over instantiation and usage

How is it done? I have a Model class that is the parent to many sub-classes, and that Model depends on a database connection and a caching mechanism. Now, this is where it starts getting troublesome: I have no control over how each object gets instantiated or used, but I have control over methods that get used by the sub-classes. Curr...

Can you suggest some good exercises/projects from Beginner to Intermediate I should tackle for a newbie PHP programmer?

Hi guys! As always you guys help me out tremendously. :) I've finished reading Tizag's PHP tutorial and I've even written a couple of sites that use what I've learned. It's just that I feel I won't truly learn PHP and be good at it until I do a real project. I have no idea what type of project to do with PHP (I'm new to webdev). Can ...

json_encode on class with magic properties

I am trying to json_encode an array of objects who all have magic properties using __get and __set. json_encode completely ignores these, resulting in an array of empty objects (all the normal properties are private or protected). So, imagine this class: class Foo { public function __get($sProperty) { if ($sProperty == ...