php

Correct usage of socket_select().

What is the correct way to use socket_select within PHP to send and receive data? I have a connection to the server that allows for both TCP & UDP packet connections, I am utilizing both. Within these connections I'm both sending and receiving packets on the same port, but the TCP packet will be sent on one port (29999) and UDP will be ...

send mail by using php5

hi friends, i wish to send form data throw mailto() in php, but i got an warning msg that "Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\ please sugest me that what i have to do for send data to a mail id...

Changing file extention using .htaccess

Iam working on Ubuntu.(Linux) I want to display all .php pages to .html in the browser, using .htaccess. Where all php files are in the folder 'test' e.g one.php should be one.html like and all other files too ...

(.*) instead of (.*?)

Suppose we have this html content, and we are willing to get Content1, Content2,.. with regular expression. <li>Content1</li> <li>Content2</li> <li>Content3</li> <li>Content4</li> If I use the line below preg_match_all('/<li>(.*)<\/li>/', $text, $result); i will get an array with a single row containing: Content1</li> <li>Content2...

password/login system in php

For a login system in php would this be a suitable outline of how it would work: users types in username and password, clicks login button. Checks if user exists in database, if it does, then retrieve the salt for that user hash the password and salt (would this be done on the client or server side? I think client side would be better...

PHP thread pool?

I have scheduled a CRON job to run every 4 hours which needs to gather user accounts information. Now I want to speed things up and to split the work between several processes and to use one process to update the MySQL DB with the retrieved data from other processes. In JAVA I know that there is a thread pool which I can dedicate some t...

Auto Submitting a form (cURL)

Im writing a form to post data off to paypal, and this works fine, i create the form with hidden fields and then have a submit button that submits everything to paypal. However, when the user clicks that button, there is more that i want to do, for example change their cart status in the database. So, i want to be able to execute some c...

how escape quotes when inserting into database in PHP

Hi all, I'm quite new to PHP so sorry if sounds such an easy problem... :) I'm having an error message when inserting content which contains quotes into my db. here's what I tried trying to escape the quotes but didn't work: $con = mysql_connect("localhost","xxxx","xxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); ...

Href link with php value

hi i am having a link like below <a href="#" onclick="window.open('http://www.twitter.com/home?status=Reading+Facebook share, Yahoo Buzz and Tweet this buttons for Blogger blogs+http://www.didiknow.com');"&gt;Tweet this</a> i want to insert a php variable value inside for the status thing like <a href="#" onclick=...

Smarty multiple random numbers list

Hey Stackoverflow-Folks, is there any smart way to post random numbers (e.g. 1-4) in a list by using the smarty tpl-engine? standart list sorted 1-5: <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> </ul> Here's my solution (PHP): <ul> {foreach from=randomNumbers} <li>{smarty.randomNumbers}</li> {/foreach} </ul>...

Can a trigger for a table can be applied for tracking in same table?

Can a trigger for a table can be applied for tracking in same table? That is IF I have table Say "employee" Now can i create a triggers such that it tracks the change in the same "employee" table trigger such as create trigger "<triggers_name>" before insert on employee For each row Begin insert into employee field = timestamp; end ...

PHP: Problem cURLing a Rails page

Why am I having problem curling on this page: https://traderydex.com/login/index.rails Here's my code: <?php $url = 'https://traderydex.com/login/index.rails'; $data = array('UserId' => 'username', 'Password' => 'p@$$wod'); $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "...

Passing GET variables from Flash to PHP with Chinese characters

Hi Everyone, I'm calling a php file from Flash and adding variables afterwards like so: http://www.randomwebsite.com/something.php?title=爸爸 It works fine if I copy and paste this directly into the web browser, however if I call it through flash, the address bar would end up like this: something.php?title=?? Is there anything I can do ...

php preg_replace returning null

Hi, I'm pretty sure this is some stupid mistake from me but i haven't been able to debug where the error in this lies. I'm trying to change image paths in html file with this regexp. It should work, but preg_replace is just returning null time after time. preg_replace("(src=){1}([\"']){1}(.*)([\/]+)(.*[\"']{1})", '/my/path'.$5 , $sour...

How to properly preload images, js and css files?

Hi, I'm creating a website from scratch and I was really into this in the late 90's but the web has changed alot since then! And I'm more of a designer so when I started putting this site together, I basically did a system of php includes to make the site more "dynamic" When you first visit the site, you'll be presented to a logon scree...

I have string with "\u00a0" and I need to replace it with "" str_replace fails

I need to clean a string that comes (copy/pasted) from various office suite (excel, access, word) each with his own set of encoding. I'm using json_encode for debugging purposes in order to being able to see every single encoded character. I'm able to clean everything I found so far (\r \n) with str_replace, but with \u00a0 I have no l...

building a navigation with nested sets, from the selected node up

Hi, I have the following tree structure using nested sets with lft & rgt values. node node node node node (selected) node node node node I'd like to build a navigation so that the tree is expanded, only to the path of the selected node, and non relevant nodes are collapsed/hidden. Using the above ...

php curl getting the resources(js,css,etc) of the webpage?

for example when i open http://code.google.com/apis/maps/documentation/examples/geocoding-simple.html for the first time, it doesn't load all the resources right away,but it pulls extra js files after it has loaded. ...

PHP: separate value in array according to alphabate order

hi, i want to find values in array according to alphabate and want to make list in of array values according to alphabate order. my array is like that: Array ( [0] => Array ( [0] => Adidas [1] => AKG [2] => Apple [3] => Barrats [4] => Canon ...

PHP: Classes to use functions from each other?

Hello I've been into this problem for a while already, and have asked some questions about it here Stackoverflow. I've got some advice, but I just can't understand it. Could someone provide me an example of classes working smoothly together. I have 3 (maybe more) classes: mysql user alerts As I said, could someone provide an exampl...