php

Removing event attributes from tags

I need a clean and simple script that can find and remove all event attributes from all html tags in a string. The "on..." attributes that is - onclick, onkeyup etc. EDIT: Here's how they do it in Kohana: $string = preg_replace('#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#iu', '$1>', $string); EDIT: Here's how they do it in CodeIgnit...

nginx doesn't parse php request

env: ubuntu 9.10 / use gotdeb source / php version 5.3.1 / php5-fpm installed / php5-fpm is running , and listening 9000 port test by 2 commands below pgrep php5-fpm telnet localhost 9000 however if I visit from anthor computer in LAN ,using this address http://192.168.1.103/index.php the browser ask me to save this index.php , b...

Taking a "screenshot" of a java applet

No. Not pressing PRT Screen. But here is what I want. And I need to know if it can be done and by what means :D Okay so I have a java applet that runs and displays a walking man. I need it so when I access a script (in some web scripting language) it takes a "screenshot" of that applet and then saves it on the server. Is this possible? ...

generating random numbers from skewed normal distribution

when you use the random(min,max) function in most languages, what is the distribution like ? what if i want to produce a range of numbers for 20% of the time, and another range of numbers for 80% of the time, how can i generate series of random number that follows that ? ex) i should get random frequency but the frequency of "1" must ...

PHP "spinning" content via random find/replace

I'm using file_get_contents('mysourcefile.html') to load the contents of mysourcefile.html into mysql db. I have two things that I want to do to the contents of mysourcefile.html before I insert it into the db. First... I'd like to do a find/replace on specific string matches contained in mysourcefile. For example: the tags that a u...

Using checkboxes

Good evening. I am relatively new to programming and have spent untold hours trying to resolve by issue with checkboxes. What I am trying to figure out is how to code the following: I want the user of my form to be able to select anywhere from 1 - 4 events and be able to store in a mysql database what those selections are. For insta...

Determine the framework used from a website source dump

I don't know if this is the right place to ask a question like this, but it is programming related, so here goes. I was given a zip file containing the entire source data for a website, including the scripts used to create the database backing it. I know that the site was built using a PHP-based framework, but not which one. I was asked...

Python Libraries and drivers

I have no knowledge of Python. I started with .NET and than learned PHP. Someone later asked me to learn Ruby as well. I started learning it. Since last few months I am seeing many libraries and drivers written in Python. I want to know what are the advantages of Python over PHP/Ruby? What type of language it is and is there a need to le...

Echo styles into the mashup of a google map and wordpress custom fields

Using wordpress, I am pulling in a custom fields from specific posts to fill in the content for a google generated map. I am using this code var point = new GLatLng(48.5139,-123.150531); var marker = createMarker(point,"Lime Kiln State Park", '<?php $post_id = 182; $my_post = get_post($post_id); $title = $my_post->post_title; ...

Log out of BOTH Wordpress & Facebook

Hi All, So I've successfully integrated Facebook into my Wordpress site. I've also linked together the accounts. However, the way the site works is that you're either logged into the site via the Wordpress Account Facebook Account or Wordpress & Facebook I know how to log out of Facebook and I know how to log out of Wordpress, but ...

dynamic sub-domain creation with PHP in a linux based server

I want to create sub-domains using PHP on the fly. Suppose a user registers himself as a name "ABC". Then I want to create a sub-domain named 'ABC.mydomain.com' automatically by PHP. I'm using a linux based server. Would anyone point me to the right direction? ...

How to convert this string into an array

I have a string being returned from my database that I want to use as an array. It is already in an assoc array form. Here is a sample of what this looks like so far. How would I do this? 'test1' => 'value 1', 'test1' => 'value 1a, 'test2' => 'value 2' Ok, this is the database code: SELECT inventory.invId, GROUP_CONCAT(CONCAT( '...

How do I migrate my current site's users table ( mysql+md5 passwords ) to my new django postgres setup?

I currently have a news website setup in PHP/MYSQL that's a bit old and I'm in the process of migrating it to a new django site that uses Postgresql 8.4 and Psycopg2. Django's admin models contain a auth_user table and I suspect this is the table I will need to insert all my user rows into. Q#1: I should just rely on this already made ...

table with events unixtime to day statistics

I have an on-line dictionary. All inputs are saved in table "id-word-unixtime" Now I want to make statistics of how many words were searched in an day, and then make graph or table with that data. What is a best way to archive this? Should i make another table for dates or write php script? I just need basic direction. ...

How to correctly sort database results

I have been asked to post a new question about how to correctly sort my data. Here is what I am trying to do. I want to make a single trip to my database for all of the data that I will need for this page. Once I have the data returned from the database, I need to sort it out and use it. For brevity, I am only posting a single row of da...

Parse error in PHP login form

I'm trying to have a login form in php. But my current code doesnt work. Here is the form: <form name="form1" method="post" action="loginverify.php"> <td><font size="3">Username:</td> <td></td> <td><input type="text" name="uname" value="" maxlength="15"/><br/></td> <td><font size="3">Password:</td> <td></td> <td><input type="text" name...

How do I re-write this code without using PEAR::DB

Hi, I am trying to install the pligg twitter login module from: http://blog.eamonnfaherty.co.uk/2009/08/08/log-into-pligg-using-twitter-oauth/ I downloaded the zip from the above link and followed all the instructions. Then I realized one of the files are using PEAR, which is not provided by my hosting company. The entire code from con...

How to Get Started Implementing Dps Payment Express Payment Gateway in PHP?

Hello, I have a created a website in which I want to use the online payment procedure Dps Payment Express Payment gateway. However, I don't know how to go about using it. The website runs on PHP. Does anyone know of any tutorials or example code that shows how to use this system under PHP? ...

Reuse method within a class

I have a method that basically returns the results of a mysql query. public function getStuff() { $this->sort = "myColumn ASC"; $query = ... ORDER BY $this->sort; return $data; } I'd like to reuse that result, only with a different sort order, and it seems like I should be able to grab that data in another method, just by calling th...

cache headers for dynamic css (generated via PHP)

My CSS file is acutally a PHP file which is served with content-type text/css so that I can use PHP variables in that file. style.php looks like this: <?php header('Content-Type: text/css'); $bgColor = '#000'; ?> body { background:<?php print $bgColor; ?>; } It works as expected, but I am a bit worried if the browser caches the dynam...