Log in

The PHP Community's Journal
20 most recent entries

Date:2012-03-26 13:16
Subject:$_SESSION Use

I have some php 4 code that is being tested on a php 5 site. The (fairly simplistic) login uses a $_SESSION variable to track a valid login, but under php 5 it seems to lose its values when moving to a different php page.

A quick scan of the documents didn't show anything obvious about version 4 vs version 5 differences. The code uses session_start(), then checks $_SESSION['loginstuff_notactualkey'] for the user name.

Is this a coding practice that should be changed with version 5?

5 comments | post a comment

Date:2011-09-26 13:54
Subject:Converting MS-Access Forms To PHP

I've got a Microsoft Access application that I'm going to have to convert to PHP and another database (PostGres or SQLite). The db portion I could do by hand if I needed to (the tables are not complicated). It's the forms that I'm worried about.

Does anyone have any experience with a tool for converting Access forms to PHP code? I found DB Convert, which looks promising, but I'd like to know about anyone's first-hand experiences.

5 comments | post a comment

Date:2011-05-23 21:22
Subject:Small problem with autoplay

I am using a video plugin for my site but one of the videos from veoh keeps going to autoplay, so I was wondering if I could get a small bit of help since this is old and the developer is no longer updating this plugin. I want to put a new piece of code to stop the autoplaying into the video embedder plugin.

My embedded video:

embed src="http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=v5.6.0.1123&permalinkId=v20995555PJT9Qaah&player=videodetailsembedded&videoAutoPlay=0&id=2895821" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="410" height="341" id="veohFlashPlayerEmbed" name="veohFlashPlayerEmbed">

The part I found for the plugin to work:

case 'veoh':
$content = wp_widget_video_buildEmbed('http://www.veoh.com/videodetails2.swf?player=videodetailsembedded&type=v&permalinkId='.$id.'&id=anonymous', $width, $height);

Thank you in Advance.

post a comment

Date:2011-02-10 17:32
Subject:Inkwell Creative Hiring Web Developer

Inkwell Creative, a growing Portland, Oregon company focusing on web design, graphic design, interactive media, video and branding, is looking to hire a web developer. We are seeking a hard working team player and someone who is forward thinking when it comes to technology. You must be able to work with us in a collaborative team setting, know many coding and web programming languages and have a strong portfolio.

5+ years of experience
Strong portfolio
Must be collaborative
Knowledge of many coding/web development languages
Knowledge of CSS and HTML 5, Content Management Systems, Flash, SEO programming, Integration into Databases
Knowledge of iPhone apps a plus

DOE. Benefits and paid-for parking. This is a salary position.

Email a cover letter, resume and link to your online portfolio to hr@inkwellgroup.com. Please include in your cover letter any outside hobbies, passions and interests. We kindly request no phone calls and no employment agencies.


Date:2011-01-02 09:11
Subject:Favorite web development editors
Mood: chipper


I am starting to dabble in web programming, again, after a long hiatus. I am a Debian/Linux guy, and am hoping some folks that do web development can recommend or share which web development editors and tools they have used, liked or disliked.

I tend to use vi/emacs for programming, but think to do web site development a 'dreamweaver' or other similar tool, that helps organize and edit pages and text files for PHP, HTML, CSS, and JS would probably be better than vi or emacs :)

Let me know, and thanka.

6 comments | post a comment

Date:2010-11-11 03:07
Subject:You can string functions together in PHP!
Mood: contemplative

Does anybody know when that happened?

I just stumbled across it out of sheer desperation when I was using DOMXPath to access the text value of several single nodes:

$title = $xpath->query ('title', $ent)->item (0)->textContent;

I'm absolutely certain that when I first started (4.0? 3.x?) this was illegal since you could not follow a function call with any operator on the return value. The parser simply did not allow it and so the above code could only be written:

$nodelist = $xpath->query ('title', $ent);
$node = $nodelist->item (0);
$title = $node->textContent;

Of course, they didn't have objects then but the same was true of arrays:
$myFunction ()[0] was illegal, now it's not.

3 comments | post a comment

Date:2010-10-18 10:53
Subject:Differences between the web and cli?

I have a script that's working 100% fine when viewed as served by Apache. When I run it from the command line (i.e. php index.php) I get a DB connection error. Everything is the same, but when run from the command line it doesn't work. Any ideas on differences between the two methods of running the script?

5 comments | post a comment

Date:2010-07-03 18:37

Does anyone know why using "require_once" in php breaks setcookie, when taking having the identical code in a script doesn't?

The error I get is "Warning: Cannot modify header information - headers already sent by (output started at /home/content/z/y/a/zyada/html/SpreadingRoots/open_srdb.php:14) in /home/content/z/y/a/zyada/html/SpreadingRoots/sr_login.php on line 29

Warning: Cannot modify header information - headers already sent by (output started at /home/content/z/y/a/zyada/html/SpreadingRoots/open_srdb.php:14) in /home/content/z/y/a/zyada/html/SpreadingRoots/sr_login.php on line 37"

Read more...Collapse )

3 comments | post a comment

Date:2010-06-24 19:26

Anyone had any experience with OC portal?

post a comment

Date:2010-06-05 21:27
Subject:Calendar script

I'm looking for a calendar class or script that will drop into an existing application, where I can tell it where to find events, and it will populate these events on the given day in a month view.

Every php calendar I've looked at so far has it's own date tables.. I'm really only needing the "shell" of the calendar.

Is there something like this available, or should I start writing my own?

5 comments | post a comment

Date:2010-06-02 12:58
Subject:Parsing stray greater/less than symbols in HTML

$str = "

This is a test. This test is > that test, but is less than < the other test. The previous test may be

[Error: Irreparable invalid markup ('<the [...] test,>') in entry. Owner must fix manually. Raw contents below.]

<pre>$str = "<p>This is a test. This test is > that test, but is less than < the other test. The previous test may be <the second test, but is likely> than the third test. The fourth test may be < the first, but > than the last. This is the end of the test string.</p>";</pre>

Need to identify and convert the legit, non HTML greater/less than signs to ASCII.. I'm running out of ideas, especially with the substrings:

<pre>The previous test may be < the second test, but is likely > than the third test.</pre> and <pre>The fourth test may be < the first, but > than the last.</pre>

Anyone have a suggestion or hint on how to accomplish this?

2 comments | post a comment

Date:2010-04-16 18:36
Subject:ASCII Convert issue

I have a person's name with a non-standard ascii character in it (š) and am having trouble converting to back to ascii to retrieve their record.

The url string contains: mašalaitis
But PHP reads it as: mašalaitis

So, my SQL is basically not finding what is stored in the database (former) with what the querystring contains (latter). I'm trying to use ORD() based on the specific value that š outputs (154) and add � to the beginning, and ; after.

But, this is what it shows when I loop through the whole name:

109 = m
97 = a
197 = �
161 = �
97 = a
108 = l
97 = a
105 = i
116 = t
105 = i
115 = s

Any help is greatly appreciated.

10 comments | post a comment

Date:2010-04-14 15:42
Subject:Startup is looking for developers (Moscow, Russia)

Hi there!
Hope developers from Russia are reading this community, cause we're looking for great professionals in Moscow. Even got special prizes for them. We're the team of Russian startup tournament called Harvest@GreenfieldProject. It'll be held on 17th-18th of April in Moscow. So if you're from Russia, pls read the text below and join our event!

Разработчики – самые дефицитные специалисты в стартапах. Поэтому на новом Harvest (РИФ+КИБ edition) мы создали вам особые условия.

Harvest (РИФ+КИБ edition) – стартап-турнир, на котором за 2 дня можно успеть то, что не получалось доделать месяцами. Победившая команда получит полностью оплаченную поездку на учёбу в летней бизнес-школе Ignite в Кембридже (Англия).

17-18 апреля пройдёт отборочный турнир для стартапов любой степени готовности: от задумки, презентуемой впервые, до развитого проекта, которому не хватает рук. Как советует Ричард Брэнсон «К черту все! Берись и делай!»
Read more...Collapse )
Подробная информация и регистрация участников на сайте стартап-турнира: http://harvest.greenfield-project.ru/
Цена участия для разработчика составит всего 600 р. Снизить её еще на 20% можно, оплатив через интернет.

Тем, кто зарегистрировался, достаточно приехать 17 апреля с ноутбуком, знаниями и опытом в МФПА на “Семёновской” (100 м. от метро). Остальное – интернет, питание, аудитории и интересных экспертов – обеспечит команда организаторов.

post a comment

Date:2010-03-29 11:44
Subject:poplating a dropdown list

I am creating a database that records people's work activities and want to use drop down menus to clean up the values they enter. They get paid based on their activities and roles, so I don't want a lot of user error.
Right now, I'm using the same table for people to add or edit their entries, and people could say if a conference they went to was, for example, university, national or international in scope.
The code right now is:
<input ... >" size="60" />
How do I add a drop down menu to this that still calls the existing value (if one exists) but allows them to add or edit other selections?

1 comment | post a comment

Date:2010-03-22 15:54
Subject:Detect change in Radial Buttons

I have a project where people can select from a variety of items.
When they’ve made a selection, I reduce the number of items available in a separate table that keeps count.

Now I want to make it so that the user can edit his/her decision later.  That requires me to be able to (re)add items to the count that are no longer wanted/needed, and reduce the number of the new item taken.

I’ve been using radial buttons in a form, because it only allows one item (of several) from each group of items.

It’s easy for me to repopulate the form, and then update the user info…
….but I can’t wrap my head around how to detect a change from one item to the next so I can update my count.

???  Thanks for any insight you can provide.

2 comments | post a comment

Date:2010-02-14 21:51


Is it possible to rank array_count_value() in order of... count?


$array = array(1,1,2,2,2,3);

It would output, in this order: 2, 1, 3 because 2 has the highest frequency.

Thanks in advance!


3 comments | post a comment

Date:2010-02-14 02:34
Subject:My variables are getting mixed up --RESOLVED (I'm an idiot)

If I run the the code below, I get an unexpected result.
Read more...Collapse )

3 comments | post a comment

Date:2010-01-22 18:34
Subject:Open PDF in browser, not "Save As"

My users want an option to open stored PDFs in the browser window instead of being prompted to download the file.

Current code:

			header('Content-Description: File Transfer');
			header('Content-Type: application/octet-stream');
			header('Content-Disposition: attachment; filename='.basename($file));
			header('Content-Transfer-Encoding: binary');
			header('Expires: 0');
			header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
			header('Pragma: public');
			header('Content-Length: ' . filesize($file));

How would I write the headers to allow files to open in the browser window?

8 comments | post a comment

Date:2010-01-14 10:45
Subject:Build Array from Checkboxes in Form

I’m helping with a web form that has a lot of selectable options.
(There must be 70 different items that can be selected by the user, in any number of combinations.)

These are represented as check boxes in the form.

I’m wondering if there is a way to create an array of all the selected items without having to check each one individually, and adding it manually.

I suppose I could make a function to do all the hard work…but I’d still have to call that function for each and every checkbox item.  Seems inefficient.

Any ideas?

3 comments | post a comment

Date:2010-01-04 15:29
Subject:Question about file uploads

Wow, I'm posting a lot lately!

So I'm working on a script that will upload files to a server. Is there a way to specify what user the script uploads as, or am I just stuck with uploading as the "nothing" user?

I know I can chown it after the fact, but that just doesn't seem to work well.

Also, if I use chmod() on a directory, will the permission change also apply to all files within the directory?


1 comment | post a comment

my journal