php

Ideal way to change all img links to point to cookieless domain in PHP

I have a PHP site using MVC, which builds HTML dynamically for most requests. I'm updating my site to host images/static content on a cookieless domain. Currently the images/css are written out as links to relative URLs. The best I can think of for now is to change all html that writes out <img> tags and css links to use a PHP function ...

Having a script provide a boolean 'answer' to jQuery's .load() method

A quick question of perhaps a more speculative nature. I've been getting heavy into jquery lately to handle all the ajax in my web apps. Right now I'm building a bidding system in PHP that makes heavy use of mod_rewrite. I'm using jQuery with a confirm dialog to send an Ajax request that will spend some of the user's predeposited cred...

Javascript and php values toggel

I have index.php page and I have this there $pv->showHidden = isset($_POST['showHidden']) ? intval($_POST['showHidden']) : 0; $pv->sendHidden = isset($_POST['showHidden']) ? 0 : 1; and then I have this <input type="image" id="btnShowHidden" src="images/hide.gif" onclick="showHiddenRecords(<?php print $pv->sendHidden; ?>);" /> I...

customizing menu layout in joomla

Hey everyone. I would like to create a joomla menu but have it display in three columns, like so: +----------+----------+----------+ | item0 | item1 | item2 | | item3 | item4 | item5 | | ... | ... | ... | | | | | For the life of me I can't think of a way to do it. Granted, I...

Human-readable, current time sensitive date and time formatting in PHP

Hi, Is there a painless way to convert unix timestamps, MySQL timestamps, MySQL datetimes (or any other standard date and time format) into strings in the following form: Today, 6:00pm Tomorrow, 12:30pm Wednesday, 4:00pm Next friday, 11:00am I'm not sure what to call these - I guess conversational-style, current time sensitive date ...

Need help creating a mass email program

Hello everyone. New to the forum but love the comments. I'm tech savvy but not when it comes to programming, coding etc. So - I guess that makes me tech stupid for the moment. Basically - I want to create a mass email program that will allow us to send bulk emails to our customers who signed an email slip. Currently - we're at 100,000 ...

PHP: how to create an regexp to preg_match() for PT Mobile phones?

Hi all, i'm newer related to Regexp on PHP... I need to create an Regexp to filter Portuguese Mobile Phones, can anybody help me and explain how i do it? (To i understand it) Rules: The integer/string must have 9chars; The first char must be a '9'; The second one can be '1,2,3,6' (Chars are separeted by commas); The other chars must b...

How to make this trick with Jquery's each?

My php code: for($i = 1; $i < 22; $i++) { echo '<div id="number" style="display:none">'.$i.'</div>'; } My jquery code: $('#number').each(function() { $(this).slideDown("slow"); }) What's wrong here? I want to achieve effect when all numbers, each after another would appear. I mean, first of all slides down number 1, ...

Print_r to find allowable values for a method?

I stumbled across this page which talks about the very handy new reflection class that ships with PHP5 and returns all the methods and properties of a class: http://stackoverflow.com/questions/1290117/print-r-to-get-object-methods-in-php Following on from this, is there any way to determine the allowable values for the methods it retur...

Framework/Platform Selection?

So...I am creating software for a university. The purpose of the software doesn't matter. What I do need to know is, the best way to make it, and what technology to use. The software needs to be able to accept multiple data sources, from Excel to SQL. However, the students will be using it primarily, and they won't always be on the scho...

$_COOKIE[] will not accept string with periods?

<?php $Test = "dsdsdad.dsad"; if (isset($_COOKIE["$Test"])) { echo "I GOT A COOKIE WITH A PERIOD"; } else { setcookie("$Test", "yes", time()+60*60*24*3); } $Test = "dsdsdaddsad"; if (isset($_COOKIE["$Test"])) { echo "I GOT A COOKIE WITHOUT A PERIOD"; } else { setcookie("$Test", "yes", time()+60*60*24*...

Documenting php code - best way to document a group of includes or requires

Hi just as the title suggests i am looking for the best way to document groups of requires or includes in a php class file. Should each require be documented and are there any phpdoc tags that should be used specifically. ...

Is there a work around for number_format() in PHP5 returning NULL for empty strings?

We are currently migrating from PHP4 to PHP5 and have discovered an issue. In PHP4, when we used the number_format() function on an empty string the output would be 0. However, in PHP5, running the same empty string through the number_format() function results in output of NULL. This has a ripple effect on a lot of our code that is no...

How to recognize user language in PHP

Is there any way to parse the HTTP_USER_AGENT to get the current user language ? ...

codeigniter image reader

hello i am trying to use Codeigniter to build a simple user image gallery where a user can upload an image and then this will be auto displayed on another page. I have the image uploading done as explain on the user guide on Codeigniter and this works fine dumps the image in a folder in the root just placing the URL in one table area an...

After login, should all pages be https?

This will be a bit difficult to explain but I will try my best. There is a website that has the login form on every page with username/password fields. These pages are not using SSL. After the user fills in the username/password and submits the form, the form is sent to an authentication page which is https. I have a few questions about...

How can I get the current web directory from the URL?

If I have a URL that is http://www.example.com/sites/dir/index.html, I would want to extract the word "sites". I know I have to use regular expressions but for some reason my knowledge of them is not working on PHP. I am trying to use : $URL = $_SERVER["REQUEST_URI"]; preg_match("%^/(.*)/%", $URL, $matches); But I must be doing som...

Help with regular expression in PHP

I want to know if a string is in another string at least once. I want to check if Shadowbox.init then any (optionnal) combisaison of whitespace then ( is inside $myString at least once. Shadowbox.init must be found (case sensitive) It can be followed by any number of white spaces (spaces, tabs, newlines...) The whitespaces or init is ...

Overloading a Native PHP Function to Encypt Data for HIPAA Compliance

Background Information: I'm part of a team of developers that runs a web application that stores and retrieves HIPAA (medical) data. Recently, the HIPAA guidelines were updated to include a policy that requires that all identifying client information be encrypted when it is "at rest" (stored in the database and not being accessed). The...

Scrape images from html using PHP?

Hi, I'm very new to PHP. The first little project I've assigned to myself was to create a barebones mobile version of my wordpress site. My plan of attack was to use the website's RSS feed to attain the Title, Description and the Images and then I would be free to format them however I wished. So far I've had no trouble extracting the...