php

Beginners php developer does using LiveDocx white Zend Framework is cpu resource eater ?

Hello all im beginner in the php world i need to build option in web application that can convert well defined structures into rtf/pdf from txt/html i found using this site search about LiveDocx php component that is dependent on Zend Framework now im not familiar white the php engine ( the parser ) so im asking you experts is it good...

Check if Youtube and Vimeo-clips are valid

Hi, I have been trying for quiet a while to check if submitted links are valid film-clips from youtube.com or vimeo.com but I did't success. Any ideas how to check url's like: http://www.youtube.com/watch?v=jc0rnCBCX2c&feature=fvhl (valid) http://www.youtube.com/watch?v=jc0FFCBCX2c&feature=fvhl (not valid) http://www.youtube.c...

Standard OOP Techniques for listing style PHP projects

I'm building a freelancing site (think scriptlance) which has listings of projects both on the home page and the listings page. I thought it would be a good chance to implement OOP techniques. I was thinking I would create a project class which among other things would have a function to echo the relevant contents for the home and list...

Have CodeIgniter Ignore a Directory

Hello all! I just started to play around with the new editor CKEditor, and i’m liking it alot. The one issue i’m trying to solve is configure the editor for file uploads. Like with FCKeditor the uploader and file browser are included in the plugin. When I try to launch the browser or uploader, CI tells me the file is not there. What...

PHP ereg_replace questions

A couple of PHP ereg_replace questions. I have an array of names: $ssKeywords = array("Str", "Int", "String", "As", "Integer", "Variant"); However when I use this ereg_replace: foreach($arKeyword as $aWord) { $sCode = ereg_replace($aWord, "<span class='ssKeyword'>".$aWord."</span>", $sCode); } It will only find the "str" or "int"...

Dynamically serve up Google Analytics code with PHP

In trying to improve our Google Analytics data for our website, I created a piece of PHP code that would determine the server that the website is being served from, and only serve up the GA code when being run from our Production server. The code is below, and works as it should: <?php switch( $_SERVER['HTTP_HOST'] ){ case 'website....

Why would file uploads stop on busy LAMP server?

We have a lamp server that is fairly busy, the CPU usage hovers around 90% at peak times. We are having an intermittent problem where file uploads from web forms fail. It only seems to happen with larger files (over a mb) and it seems to affect some users more than others. We've gone through and checked the obvious stuff like PHP ini ...

PHP json_decode notation issue

I am having an issue dealing with the notation used in a JSON file I am trying parse. Some of the nodes have . (periods) in the names which escapes object-notation ($json = $article->rssFeed.url;) How would I go about selecting the nodes. Do I need to str_replace the .(periods), or is there some other notation I can use? Here is a sni...

jQuery Ajax submission problems

Hi, there is a strong possibility that I'm just being stupid here as this is my first attempt at using jQuery's ajax functionality so please bear with me. $(document).ready(function(){ $("input.update").click(function(){ var str = $(this).parent().serialize(); $(this).parent().parent().block({ message: "<span class=\"loading\"...

replacing all image src tags in HTML text

Hi! I'm trying to make a simple php script to find all src attributes from all images in a html text and then replace all found srcs with some text after making some conditional changes. Something like this: @preg_match_all('/<img\s src="([a-zA-Z0-9\.;:\/\?&=_|\r|\n]{1,})"/isxmU', $body, $images); now i've all srcs into the $images ...

Click counter php mysql?

Hey, I have been looking for a simple way to track clicks on a link and store how many times the link has been clicked in a mysql database. Anyone have a solid approach on how to do this? Thanks. ...

Why is IE7 rejecting session cookies from a page in a frame?

I am building a website that is loaded into a frameset by other sites (where the domain names are different for the parent site). This works fine in all browsers (including IE6), except for IE7. It is not registering the session at all and simply does not work. Site is implemented using LAMP, MySQL 5, and PHP 5 - yeah, probably not re...

setting the selected option of a select tag with jquery

If my jquery function is as below: $('#shifts').change (function () { $.get('ajax/time_menus.php', { shift: $('#shifts').val() }, function(data) { $("#test").html( data ); }); And returns a array with two time values contained in an array of six values: [hours][minutes][ampm][hours][minutes][...

Build Table with CheckBox with PHP Templating engine

I am interested to build a table with checkbox as shown below, using PHP and Smarty ( or any other templating engine): As one can see some parts of the columns are queried from the database, and the first column is a checkbox. I am pretty sure that this is a common web layout, so I am looking for an open source implementation ( lest I...

Dynamically creating a page in C# asp.net (php example included)

I'm working from some sample code, provided in PHP - we are using c#, so i'm having to convert it. Basically, it requires that i submit a bunch of data to an API, which returns an xml document as a response. I then need to redirect to a page, that has the following HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <...

How to retrieve all links from HTML document using DOMXPath

Hello I have this code <?PHP $content = '<html> <head> <title></title> </head> <body> <ul> <li style="border:0px" class="list" id="list1111"> <a href="http://www.example.com/" style="font-size:10px" class="mylinks"> <img src="logo.gif" width="235" height="...

Printing results immediately (php)

I have a php script that connects 10 different servers to get data. I want it to print the results of the 1st connection before the second one begins. ...

Secure login with proper authentication in PHP

How do I write/put together a secure login in PHP? The website developer guide said I shouldn't roll my own, so referring to samples available via Google is useless. How do you pros do it? Lets say you're building a world-class app in rails, would the same libraries / techniques be usable here? Thanks ...

Handle error when getimagesize can't find file

Hi, when I'm trying to getimagesize($img) and the image dos't exist I get an error. I don't wont to first check if the file exist, just handle the error. I'm not sure how try-catch works, but I wont to do like: try: getimagesize($img) $works = true catch: $works = flase ...

How would I scan a directory to make links to pdfs using php?

I'm really new to php but what I want to do is make a dynamic table of contents for some of my companies job offerings. so if i put all the pdfs of the job descriptions in a folder called ../jobops with the php file located in root directory what would i need to do. ...