php

javascript wont parse php html tags

php sends html strings to html via ajax wrapped in <p class="select"></p> tags, css reads class perfectly. javascript/jquery does not. javascript/jquery wont even parse <p onclick="function()"></p>. What am i doing wrong? heres my php (sends data via ajax fine) echo "<p class='select' onclick='populate();' >{$row['song_name']} </p>"; ...

preg_replace easy for a pro

i want to find first select ... from and replace that only, following code replace all select..from in sql query, i just need for first select..from preg_replace('#select(.*?)from#is', "select count($expr) as counted from", $sql); ...

How to generate a unique id for different visitors with PHP?

The value will be used as: from INTEGER UNSIGNED NOT NULL which defines different visitors that haven't login. How to properly generate that number with PHP? EDIT: If using database as follows: create table user_visits( id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, primary key(id) ); How to insert a new record into it? ...

Effective compression in AS3 to be transefered to PHP

Hi all! I need to send some pretty long strings from a flash application to a PHP page, and of course I want to compress it to reduce the traffic load to/from the server. How can I compress the string in an effective way and easily decompress it in PHP? As it looks now, we're leaning towards standard zip file transfer, but the function...

What is required for a career in web development?

I've been learning PHP for a few years now, and have come to a point where I can code just about anything using it. Next year I'll be out of high school and into University, but there's a problem: most (not all) of the courses are only offered in ASP.NET. So my question is: should I be enhancing my skills in C# alongside my PHP skills s...

How to cut image into a web page

I'd like to show a part of an image on my web page. Suppose the original format is 1024x768 the image shown has to be 100x768. It's not a re-size but simple a cut starting from 0,0 pixel. Any suggestions? ...

What should be stored in a cookie for a login system?

What is the best thing to store in a cookie to keep a persistent logged-in state? I have seen many websites (and beginner tutorials!) that simply store something like validUser=1 in a cookie. Clearly I could spoof that and the website would think I was a valid user. If the username is stored in the cookie I could masquerade as any user...

PHP Array & for each

Hi, I'm using a multi dimensional array in php, I would like to know how to get the "field name" of the value I'm returning in my foreach loop. $_SESSION['filter']['dateCreation'] = 'ASC'; $_SESSION['filter']['client'] = 'test'; print_r($_SESSION['filter']); foreach ($_SESSION['filter'] as $filter) { // how do I echo the name of t...

Working with Sessions - PHP

When working with Sessions, do you need to declare session_start() or ob_start() ? What are the advantages of doing so or not doing so? Thank you! ...

Newsletter management system in php

Do you know a good and free newsletter system written in php that allows users import/export from database or text files, store multiple fields for every user (like name, surname...) and create users groups? I've tried Listmessenger, but it's not completly free, and CcMail but it's not very good for me... ...

Is there a way to find out if a server supports mod_rewrite & .htcaccess

Is there a way to find out if a server supports mod_rewrite & .htcaccess ...

Magento & vertnav extension

Hi all, I'm working on a magento project (v1.3.2.3) and i've installed the vertnav extension. Contents vertnav.xml: <?xml version="1.0"?> <layout version="0.1.0"> <default> <reference name="left"> <block type="vertnav/navigation" name="catalog.vertnav" template="vertnav/left.phtml" before="-" /> </refer...

SQL Server Stored Procedure Call in PHP - Can't get xml data it returns back into php

Trying to call an SQL SERVER stored procedure from php. Think I've got it working but I can't get the data it returns back into php. I'm copying my php code and also the sample SQL SERVER code below. Believe my problem is how do get the data back from reportData? mssql_execute() just returns boolean true. Looks to me like the procedure...

PHP - SOAP - lastResponse - Display Fields & Values?

Hi guys, I've got a SOAP fault response that i'm trying to output into a sort of 'print_r' nice format so I can include the fault in an email to our IT staff when SOAP request fails. Can anyone tell me the best way to simply format an XML SOAP faultstring in the format, variableName: variableValue? Cheers ...

htaccess regular expression - dont follow pattern

Hey, I have a problem with the regular expression at the bottom. I'm trying to pass all patterns except index.php, robots.txt and any css and js file through the index file, however I have one specific path where I need to process js and css files through php. Normally my url structure is like this: example.com/class/function lets say...

Caching of current user specific pages

We are using Smarty Templates on our LAMP site but my question would also apply to a site running Memcached (which we are planning to also bring online). Many of the pages of our user generated site have different views depending on who is looking at them. For instance, a list of comments where your own comments are highlighted. There...

Porting regex from PHP to JavaScript

Hello, I have the following regex in PHP: /(?<=\')[^\'\s][^\']*+(?=\')|(?<=")[^"\s][^"]*+(?=")|[^\'",\s]+/ and I would like to port it to javascript like: var regex = new RegExp('/(?<=\')[^\'\s][^\']*+(?=\')|(?<=")[^"\s][^"]*+(?=")|[^\'",\s]+/'); var match = regex.exec("hello,my,name,is,'mr jim'") for( var z in match) alert(match[...

PHP Comment format: auto generated or User created?

I've always seen these header comments in php, and often wondered if some software was used to set them up? I seem to recall JavaDoc or something? But I'm not sure if this is auto generated? Or is this just some type of documentation standard? The example below is from CodeIgniter: /** * CodeIgniter * * An open source application...

Google adsense track clicks method?

Hey, I am wondering what method Google uses to track clicks for there Adsense ads? do they send you to another page when you click on an ad that will track a click and then send you to the destination or do they do it another way? Thanks for any help. ...

How do you replicate an array whilst keeping the same keys?

Ok. I've written a simple(ish) function to take an argument and return the same argument with the danger html characters replaced with their character entities. The function can take as an argument either a string, an array or a 2D array - 3d arrays or more are not supported. The function is as follows: public function html_safe($inp...