php

How can I unzip a .gz file with PHP?

I'm using CodeIgniter and I can't figure out how to unzip files! ...

custom Php Function Needed which takes the date in the Format of MMDDYYYY as a variable and it should return YYYYMMDD

custom Php Function Needed which takes the date in the Format of MMDDYYYY as a variable and it should return YYYYMMDD ...

Is using obscure names for login fields pointless

My php user authentication script is based on code from someone who, at the time, was a much better coder than me. As such I trusted that the parts I didn't quite see the point of were better left alone unless I had a good reason to change them. I've since improved and have my own ideas of what should be done. One of the things in this ...

Sorting xml with simpleXML/xpath?

Hey, I have some xml, say: <Background> <Uses>14</Uses> </Background> <Background> <Uses>19</Uses> </Background> <Background> <Uses>3</Uses> </Background> How can I sort the xml from lowest Uses to highest? Maybe an xpath expression? Also, how could I just retrieve the bottom 2 Backgrounds, or the ones most recently added? Than...

PHP Connect to Remote Registry

I have some code that can read a key from the local registry. $shell = new COM('WScript.Shell'); $data=$shell->regRead('HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\Symantec Endpoint Protection\SMC\ProductVersion'); How can I open another computer's registry with this assuming that I have full access to that computer? ...

forum category problem

Hello all, i have a forum and in that forum people can create a thread in a category they chose, but i wanna check if the category exists but i dont know how to, because know if i type another category number in the URL i still see the page. here is my code $kategoriID = $_GET['kategoriID']; if(!isset($overskrift) || !isset($ind...

Is there an equivalent of <<<EOD in Ruby/Rails?

In PHP, the following would allow me to create a string without having to escape quotes.. $string = <<<EOD ',. whatever <"",' EOD; echo $string; Is there anything similar to it in Ruby/Rails? ...

How do I check for the first saturday of the month in PHP?

I need to make a simple if statement for a daily cron job to check if today is the first saturday of the month. How would I modify the following code to do that instead of just running on the 1st of every month? if (date("j") == 1) { // run cron here } ...

PHP - string to money conversion

Hi, I'm trying to convert a string into money format using this function, and trying to create something like this : 350000000 to 350.000.000,00 All my attempts failed so far, being this the last one : setlocale(LC_MONETARY, 'pt_PT.UTF-8@euro'); echo money_format('%.2n', $preco); Any help would be appreciated. Cheers! ...

Debugging PHP with Netbeans 6.9

I am using PHP 5.3 on Ubuntu 10.0.4. I recently upgraded from PHP 5.2 + Netbeans 6.8, where debugging worked fine. Currently, when I am debugging, only SOME variables are available - in some statements (for e.g), where a non-null value is being assigned to a LHS variable, the variable does not appear in the variables window - even thoug...

Using PHP script to assist .htaccess mod_rewrite

I'm planning to use large amounts of URL rewrites on my website, but I can't get familiar with Apache's mod_rewrite because it's difficult and poorly documented. I heard there's some option that allows invoking various scripts for the rewriting purpose. Can you help me with it? ...

Sequentially Load DIV using Jquery

Is it possible to load a series of DIVS using Jquery using a preloader. For instance, I have a page with 4 divs nested within 1 main div. I'd like to load content1, then content2, and so on. Plus, only 1 div will load at a time in the sequence. Is this possible with jquery, or anything else? ...

how can i know remote device is cisco switch or router with php?

Hi everyone, I dont know if this topic can be written in this forum but if i am wrong warn me.Let's go my question... How can i know remote device is cisco or other companies' switch or router device by using php(sockets) by using send SNMP or connecting witth telnet?I dont want php codes but i want to know if this type of operation can ...

How do I set up pagination for an image gallery with image thumbnails?

Hi guys, I have two tables here: Gallery ID | Name | Description Image ID | Title | Caption | GalleryID I got the code all set to make a simple image gallery by listing all the thumbnails or paging through the thumbnails. However what I need to do is accomplish something like the gallery here only without the javascript and ajax: ht...

Need help with: Couldn't call Doctrine_Core::set()... symfony 1.4 fixture

I keep getting: Couldn't call Doctrine_Core::set(), second argument should be an instance of Doctrine_Collection when setting one-to-many references. This happens when I include data for 'asset' in the 'Upload' table in my fixture. See part of the schema.yml below: detect_relations: true options: collate: utf8_general_ci char...

mcrypt blowfish php slightly different results when compared to java and .net

Here is some example code with altered key values and payload: $key = '/4rTInjwg/H/nA=='; $key = base64_decode($key); $data = 'val=100|val=200|val=300|val=400|val=500|val=600|val=700|val=800|val=900|'; $data.= 'val2=100|val2=200|val2=300|val2=400|val2=500|val2=600|val2=700|val2=800|val2=900|'; $data.= 'val3=100|val3=200|val3=300|val3=4...

2 SQL Queries from same table

I am looking to grab the first row (ordered by date descending) from a table, and then grab the rest of the rows (ordered by last_name ascending). I'm assuming I need to use a UNION statement for this, but I'm having trouble getting it to work. Thanks in advance ...

What would be the best way to store site preferences?

I'm currently working on a massive revamp of my CMS, and was wondering, what would be the best way to store site preferences... Currently my pereference setup is within database, full of structure fields (each representing it's own preference), but only id 1 is used. And... I somehow don't like this solution. Now I'm thinking of setting...

Warning: date() expects parameter 2 to be long, string given in

Hello i got this error its the $birthDay = date("d", $alder); $birthYear = date("Y", $alder); i dont know what it is here is my code //Dag $maxDays = 31; $birthDay = date("d", $alder); echo '<select name="day">'; echo '<option value="">Dag</option>'; for($i=1; $i<=...

How to add a little to URL instead of copying and pasting it all?

Ok, so I have let's say this page http://mypage.com/index.php?id=something. I want to have in this page the link which would go to the http://mypage.com/index.php?id=something&amp;sub=1. And to do that I have to add a href to my index.php file like this echo '<a href="index.php?id=something&sub=1">go here</a>';. Is it possible to do thi...