php

OpenLDAP and user role based accedss controll (RBAC)

Hello, my company uses an openldap server which stores corporate user information ((username,passwd and some other information like email are stored in ldap).. Till now they only use it for authentication but now we'd like to use for authentication also, this means that we'll create roles (as ldap attributes in a new schema) and assign...

clear html webpage?

i am currently developing a crawler that crawls all links on the web and displays them in the web browser (and saving it of course). but after some hours there will be a huge list displayed on the web browser and i want to only display lets say 1000 links at the same time. then i clear the html and display another 1000 links. this is al...

Right align text in an image with imagettftext(), PHP

I am setting up dynamic forum signature images for my users and I want to be able to put their username on the image. I am able to do this just fine, but since usernames are different lengths and I want to right align the username, how can I go about doing this when I have to set x & y coordinates. $im = imagecreatefromjpeg("/path/to/b...

Joining two tables (through a link), one which may yield multiple rows, together into one result.

Lets say I've got a table listing car brands or models: Cars: Id | Brand ----------- 1 | BMW 2 | Audi 3 | Volvo And I've also got another table which links features. Link: Id | carid | featureid ----------------------- 1 | 1 | 1 2 | 1 | 2 3 | 2 | 2 4 | 3 | 1 5 | 3 | 2 6 | 3 | 3 And I've got the tab...

rename files with the same name

Hi. I use the following function to rename thumbnails. For example, if I upload a file called "image.png" to an upload folder, and this folder already has a file named "image.png" in it, the new file automatically gets renamed to "image-copy-1.png". If there also is a file called "image-copy-1.png" it gets renamed to "image-copy-2.png" a...

What is the best to format messages for queueing?

I've been reading up on message queueing lately, and I'd like to implement a simple, extendable, system for my app. While there's a lot of good information on the subject of setting up a MQ system out there, I can't find a lot about the actual implementation. I'm looking for patterns and best practices on how to properly format messages...

how to use a pear package!?

I want to use HTTP_DOWNLOAD to manage my downloads ,, I have never used PEAR before !! HTTP_DOWNLOAD depends on many other packages , I downloaded them and the ones they , in turn , depend on and this is the structure I made : Download.PHP <---HTTP_DOWNLOAD MAIN FILE Header.php <--- HTTP_HEADER MAIN FILE PEAR.php PEAR5.php ...

Returning records from 3 tables via a Join Table with Propel in Symfony

I have 3 database tables: article article_has_tag (2 FK's to the other tables) tag I currently show a list of articles with the article's tags shown underneath but the number of queries grows as the list gets longer. I want to loop over all the articles and get the tag objects from each one in turn. Can it be done in 1 propel query...

PHP: creating a smooth edged circle, image or font?

I'm making a PHP image script that will create circles at a given radius. I used: <?php imagefilledellipse ( $image, $cx, $cy, $w, $h, $color ); ?> but hate the rough edges it produces. So I was thinking of making or using a circle font that I will output using: <?php imagettftext ( $image, $size, $angle, $x, $y, $color, 'fontfile...

Regular Expression Help - Brackets within brackets

Hello I'm trying to develop a function that can sort through a string that looks like this: Donny went to the {park|store|{beach with friends|beach alone}} so he could get a breath of fresh air. What I intend to do is search the text recursively for {} patterns where there is no { or } inside the {}, so only the innermost sandwiche...

php json jquery and select box

I have this php code $jsonArray = array(); $sql = "SELECT ID,CLIENT FROM PLD_SERVERS"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { $jsonArray[] = array('id'=>$row['ID'],'client'=>$row['CLIENT']); } echo json_encode($jsonArray); And this js function autosearchLoadServers() { $.post("php/autosearch-lo...

Why is this HTTP request continually looping?

I'm probably overlooking something really obvious here. Comments are in to help explain any library specific code. public function areCookiesEnabled() { $random = 'cx67ds'; // set cookie cookie::set('test_cookie', $random); // try and get cookie, if not set to false $testCookie = cookie::get('...

Is is possible to run Coldfusion & PHP on the same server and website ?

I would like to be able to port some new site pages over to PHP using the same db as in the coldfusion site. Is it possible to have PHP run pages in say other directory and go back and forth ? Many thanks for your reply. Terry ...

How can I pull a Google Doc spreadsheet into a PHP array?

Is it possible for me to access a Google Docs spreadsheet (possibly as a CSV file?) and build that into a PHP array? ...

Can't set cookies in PHP?

For some reason This php script won't echo anything: <?php setcookie("pop",'hi',time()+604800); echo $HTTP_COOKIE_VARS['pop']; ?> ...

PHP While() Stop Looping

Hi, i have a php loop which displays only one record even if there is hundreds. here is the code: <?php $result1 = mysql_query("SELECT * FROM posts") or die(mysql_error()); $numexem = mysql_num_rows($result1); $s="0"; while($s<$numexem){ $postid=mysql_result($result1,$s,"id"); echo "Post id:".$postid; $result2 = mysql_query("SELE...

Whats wrong with my cookies?

For some reason This php script won't echo my cookie variable: <?php require 'connection.php'; require 'variables.php'; $name = $_POST['name']; $pass = $_POST['pass']; if(($name == $admin_name) && ($pass == $admin_pass)){ setcookie($forum_url."name",$name,time()+604800); setcookie($forum_url."pass",...

help with regex pattern

i have multiple strings containing a link like: <A HREF="http://www.testings2"&gt;testings2&lt;/A&gt; <A HREF="http://www.blabla"&gt;blabla&lt;/A&gt; <A HREF="http://www.gowick"&gt;gowick&lt;/A&gt; i want to use a regex pattern that gets the uri within the href. i could do like: /".*?"/ but then the "" will come along. is ther...

PHP GD Reflection with original picture on top

Hi, I have stumbled upon a nice PHP library that uses GD to generate a reflection of a picture. I tried to modify the way so it also display the original image above its reflection to not have to align them in HTML. The script can be found there : http://reflection.corephp.co.uk/v3.php Any idea if this can be done easily ? With my tes...

How to make strtotime parse dates in Australian (i.e. UK) format: dd/mm/yyyy?

I can't beleive I've never come across this one before. Basically, I'm parsing the text in human-created text documents and one of the fields I need to parse is a date and time. Because I'm in Australia, dates are formatted like dd/mm/yyyy but strtotime only wants to parse it as a US formatted date. Also, exploding by / isn't going to w...