php

Need PHP script to decompress and loop through zipped file.

I am using a fairly straight-forward script to open and parse several xml files that are gzipped. I also need to do the same basic operation with a ZIP file. It seems like it should be simple, but I haven't been able to find what looked like equivalent code anywhere. Here is the simple version of what I am already doing: $import_file...

How to make an Adobe Air App connect to a webservice and update it content when connected

I'm building an air app (A screensaver). What I want to do is to let the app check a webservice (preferably PHP, java axis2 would also help) for images and text content etc. I may even do some DOM restructuring (using jQuery). Any suggestions and pointers would be welcome. Of Course code snippets would be appreciated :-) thanx Pk Anane ...

php automated sitemap for a free classified ads website

hi there i am looking for a good way to automaticly create/update sitemp for my website www.indexagahi.com its a free classified ads site , i want to rebuild or update sitemap.xml whenever an ads has been added . whats your idea ? is it possible . i appreciate any help. thanks a lot. ...

isset($var) vs. @$var

Is this an okay practice or an acceptable way to use PHP's error suppressing? if (isset($_REQUEST['id']) && $_REQUEST['id'] == 6) { echo 'hi'; } if (@$_REQUEST['id'] == 6) { echo 'hi'; } EDIT: I thought so too. The code (and idea) is from friend. Thanks for proving me right. :) ...

Append class="external" to external links.

What is the php code to append class="external" to links that are posted and are not the domain. For example my site is www.mysite.com and you post a link to www.mysite.com/news and a link to www.yoursite.com How do I set it so only non "mysite.com" links have the class specified? ...

Wordpress nav not visible in pages like articles, blog & search

My wordpress*(a custom template)* nav is all working on all of the pages but now I found out that the Main nav doesn't show on this pages All pages e.g. search.php, single.php, index.php, page.php all has <?php get_header(); ?> I really don't know whats wrong. Here is the code for my header.php <?php /** * @package WordPress *...

PHP text output in clauses

Hello. I am working on a PHP project. There, I often use following syntax to output text in a cluase: if($boolean){ ?> output text <? }else{ ?> alternative <? } On my computer, this works perfectly well. I use XAMPP foer Mac OS X. But when I send the files to my coworker, these outputs often do not work and the compiler complains ...

Drupal's not reading correct values from DB

Hey Everyone, Here is my current problem. I am working with the chat module and I'm building a module that notifies users via AJAX that they have been invited to a chat. The current table structure for the invites table looks like this: |-------------------------------------------------------------------------| | CCID | NID | INV...

[PHP] How to unset object's inherited properties ?

I have an Object ( [id] => 1 [parent_id] => 0 [result:Database:private] => [db:Database:private] => mysqli Object ( [affected_rows] => 0 ... ) ) Obviously, the Object has inherited the 'db' and 'result' properties of the parent Database c...

shell_exec() in PHP

<?php // Execute a shell script $dump = shell_exec('bigfile.sh'); // This script takes some 10s to complete execution print_r($dump); // Dump log to screen ?> When the script above is executed from the browser, it loads for 10s and the dumps the output of the script to the screen. This is, of course, normal. But if I want the dat...

PHP error problem.

I get the following error on line 8: Undefined index: privacy_policy which is $privacy_policy = mysqli_real_escape_string($mysqli, $_POST['privacy_policy']); I was wondering how can I fix this problem? Here is line 8. $privacy_policy = mysqli_real_escape_string($mysqli, $_POST['privacy_policy']); Here is the PHP. if (isset($_POST['s...

An achievement system like here on stackoverflow in php?

Conceptually speaking how would one go about writing an achievement system for a website using PHP and MySQL? Is the only real way of doing it is to constantly do MySQL queries to test for achievements and such? ...

How i can design a cache system using PDO and memcached?

Hi, I'm using PDO for connect to the database in a system where I want implement memcached. I don't know what keys use for caching the results because I can't get the string of the final query with PDO (because the prepared statements). Any good idea for resolve this? Thanks in advance. ...

memory leak in php script

Hi, I have a php script that runs a mysql query, then loops the result, and in that loop also runs several queries: $sqlstr = "SELECT * FROM user_pred WHERE uprType != 2 AND uprTurn=$turn ORDER BY uprUserTeamIdFK"; $utmres = mysql_query($sqlstr) or trigger_error($termerror = __FILE__." - ".__LINE__.": ".mysql_error()); whil...

[PHP] Condition for array with string as keys

My PL/SQL procedure returns a cursor. It always returns data. I fetch (oci_fetch_assoc) it and save it in an array. If results were found the keys of the array will be strings. If the cursor didn't find data, it will return value 0, thus the key of the array will be numeric. while($data = oci_fetch_assoc($cursor)){ if(!isset($data[...

Difficulties trying to build & run HipHop PHP Compiler on Ubuntu 9.10... any ideas?

It seems to not get past this step: [ 16%] Building CXX object src/CMakeFiles/hphp_runtime_static.dir/lib/system/gen/sys/dynamic_table_func.no.cpp.o UPDATE The above was just slow. I left my desk and came back after several hours, and the build had completed successfully. ...

PHP alternative to session_is_registered

Hi all, does anyone knows the alternative to the deprecated function session_is_registered in PHP5? here's my code: ob_start(); session_start(); if(!session_is_registered(myusername)) { header("location:main_login.php"); } ob_flush(); Thanks, Mauro ...

PHP: prevent invocation of method X from from context != Y

This is a tricky one. I am "emulating" ZF Bootstrapping (surface appearance). Don't ask me why, call it academic interest. So I have a Bootstrap Abstract with a method "run" that iterates over itself to locate any methods prefixed with "init". The application looks for a user defined class which extends this class, in which the user ...

PHP Global variable in class is reset

I have a web form that manipulates records in a MySQL database. I have a method for displaying an edit interface for both creating new records and editing them if ($_POST['new_page']) { print "<h2>Create new page</h2>\n"; $isNew=1; $this->EditForm(); } else if($_POST['edit']){ print "<h2>Edit page</h2...

Generate info_hash of torrent for xbtt

Hello, I am trying to create my own torrent tracker but dont know how to generate info_hash that is used xbtt to track torrents. Is this possible with php? I am using this function to bencode and decode http://paste.lisp.org/display/17178 Is this the correct hash? $nn = file_get_contents('my.torrent'); $file = bdecode($nn); $hash = ...