php

PHP Lexical and Syntax analyzer written in C/C++

I'm writing a PHP IDE in Qt4 for my Master's project. I am trying to duplicate a lot of the functionality of Eclipse or Visual Studio without all the bloat and the overhead. I'm trying to do some code completion but I need to do some syntax analyzing to have intelligent code completion. I've looked at the PHP source code and thought abou...

Php serialize

Im trying to save serialized arrays into my mysql database then retrive them and unserilize them but I cant work out how to unserialize them. here is what I have so far: $query = mysql_query("SELECT friends FROM users WHERE id='$myid'"); $friends = mysql_fetch_array($query); unserialize($friends); Stuck here ????? array_push($friend...

Number rows not column id

$query = mysql_query(" SELECT * FROM comments ORDER BY comments.comment_date ASC"); while ($row = mysql_fetch_assoc($query)) { ....... } How would I do to "number" the comments. like this site you know... 1. 2. 3. 4. 5. ... Thanks ...

unserialize problem

Hi, I have another problem with my scripy now I have made it more advance, first off the count function doesnt work properly and it gives this error. *Warning: array_push() [function.array-push]: First argument should be an array in C:\wamp\www\social\add.php on line 42* Here is my script: $query = mysql_query("SELECT friends FROM use...

Count array counts 1 too many

Does anyone know how to get arround the annoying problem that when counting how many values there is inside an array if the value is 0 it says 1 becuase it counts the name or something. So like this: 0 : 1 1 : 1 2 : 2 3 : 3 4 : 4 5 : 5 6 : 6 7 : 7 8 : 8 Thnaks, Stanni ...

In need to program an algorithem to be very fast, should I do it as php extension, or some otherway?

Most of my application is written in PHP ((Front and Back ends). There is a part that works too slowly and I will need to rewrite it, probably not in PHP. What will give me the following: 1. Most speed 2. Fastest development 3. Easily maintained. I have in my mind to rewrite this piece of code in CPP as a PHP extension, but may be I a...

PHP Input validation for a single input for a url.

I have this very simple script that allows the user to specify the url of any site. The the script replaces the url of the "data" attribute on an object tag to display the site of the users choice inside the object on the HTML page. How could I validate the input so the user can't load any page from my site inside the object because I h...

How do I get my PHP application to re-use the same window for playing music?

Below is the code for my player which will automatically generate a playlist.xml file according to the songs selected by the user. I kept this file as player.php in my root folder, and in the form I give: <form method="post" action="/player.php" target="_blank"> so this player is opening and playing songs according to what is selected...

php httprequest class and session

I am using the httprequest class in one of my applications to request a cross domain page. Basically I needed to inlcude two pages based on thge logged in state of the user, via cross domain ajax request. Due to security issues this is not allowed. So what I did was I created a proxy page which uses the httprequest class to request the ...

How does Magento code work?

Can someone show me how to accomplish the following in Magento: Display a hello world message using a controller/view/model approach, so if i went to http://mysite.com/myController It would show the string 'hello world'. Being able to show this string within the template of my website (e.g the header, footer, etc) will be a bonus. ...

How do I design sms service ?

I want to design a website that can send and receive sms. How should I approach the problem ? What are the resources available ? I know php,python what else do I need or are the better options available? How can experiment using my pc only?[somthing like localhost] What are some good hosting services for this? [edit this] [Add more que...

Is there a point where cost of refactoring outweighs the cost of re-writing?

We have some really shocking code touted as a next generation framework at my current place of employment. Thing is, there is only one person of this opinion and that is the guy who wrote most of it. The rest of the department are of the impression it is badly coded, a pita to debug and just a bit naff in general. The guy that wrote it...

Live username lookup with AJAX/Jquery

I want to have a javascript function such as this: function isUsernameAvailable(username) { //Code to do an AJAX request and return true/false if // the username given is available or not } How can this be accomplished using Jquery or Xajax? ...

c# equivalent to php associative array?

hi ive decided to learn c# recently. ive done some php before. i see c# has dictionaries. thats equivalent to an associative array in php right? as far as i can tell the dictionary doesnt maintain insertion order like php associative arrays right? is there some other equivalent i should use if insertion order is important? thanks ...

PHP Send email over SSH

Hello We have a website that emails the contents of a contact form to our client. We would like to change this to make it a bit more secure (sensitive data can be sent over the contact form), we have encrypted the page with an SSL certificate so the only weak link we have at the moment is the email. We already have an SSH connection se...

PHP wrapper for XML/SWF charts

Anyone know if there is a PHP wrapper for the latest version (5.X) of XML/SWF charts ...

Dividing with a remainder in php?

I have a part in my code where I need to divide and have a remainder instead of a decimal answer. How can I do this? thanks ...

Passing array to SOAP function in PHP

Greetings, I can't seem to find a way to create a function request with array as an argument. For example, how do I make this kind of request using PHP SoapClient: <GetResultList> <GetResultListRequest> <Filters> <Filter> <Name>string</Name> <Value>string</Value> </Filter> <Filter> <Name>...

How do i remove the top line in a CSV file (the coloumn headers)?

I have put together a script which will upload a CSV file and then extract the data into an already made table. I want to make it so the first line(the column headers) will not be inserted into the table, but the rest of the data will be. $fp = fopen($_SESSION['filename'],"r"); while (($data = fgetcsv($fp, 1000, ",")) !== FALSE) {...

PHP file upload

Hi, I am trying to upload files to my server using php to save them into a binary form into my mysql database but I cant get it to work, here is the script I’m using, I believe it has something to do with "$_FILES" because when I take this out "&& $_FILES['userfile']['size'] > 0" the script starts to run but then the variables underneat...