php

PHP - Initiate SoapClient inside a SoapServer class function?

So I have a SoapServer class that handles whatever functions is requested of it from the client. Within one of those functions I need to call a 3rd party soap service, so I set about getting what I need as a SoapClient and returning the result back to my SoapServer. Here's a copy of the stack trace: ReadCategories Respsonse:SoapFault ex...

How to override preUpdate action to not modify my `updated_at` field in Doctrine?

Hi, I want to disable the automatic behaviour of changing the 'updated_at' field when an object is updated. I want to do it manually; or at least, have the posibility to disable it as wanted. I know I can do this by building my own behaviour as in this great answer. But I was searching for something 'cleaner' modifying a listener of th...

MySQL Update problem

$result=mysql_query(" UPDATE xxxxxx_users SET User_Password='$Password' WHERE FstName='$First' AND LstName='$Last'",$db) or die ("Password update successful!"); echo "Update failed, unknown user"; This correctly updates the db when the first and last names match and the db is not affected when they don't. My only issue is I always d...

php private mysql connection

I have 2 functions, the function get_user_info() which connects to a db called 'users', and another, called print_info() which connects to a db called 'blah'. I call get_user_info() inside print_info(), so it can retrieve the information. They connect to 2 different databases and make 2 different connections, i use another function to co...

Apple Push Notification Service APNS - Notifications not arriving

I am trying to add push notifications to my app. I have am using an ad hoc profile. My appID does not have a wildcard. I am using the following php code... $deviceToken="****";masked $time = time(); $apnsHost = 'gateway.sandbox.push.apple.com'; $apnsPort = 2195; $apnsCert = 'apns-dev-maui.pem'; $streamContext = stream_context_cr...

Can anyone help me make this an object. (php)

Hey, can someone help me make this an object please. Obviously not all my code is here, but i'm sure you'll get the gist. <?php $product_name_1 = $_POST['product_name_1']; $region_1 = $_POST['region_1']; $start_date_1 = $_POST['start_date_1']; $end_date_1 = $_POST['end_date_1']; $sku_1 = $_POST['sku_1']; $product_name_2 = $_POST['prod...

What is the best way to generate codes for a URL shortening service in PHP ?

hi guys , I have to use this way to generate codes for a URL shortening service $code = substr(md5(uniqid(rand(), 1)), 3, 5); but this is always generate a fixed length code (5 in this case) . what if there is a large number of URLs in the database that can't stand the five symbols here ? sorry for the bad English. ...

Change Column to Auto_Increment

Hi, I asked this question a little earlier today but am not sure as to how clear I was. I have a MySQL column filled with ordered numbers 1-56. These numbers were generated by my PHP script, not by auto_increment. What I'd like to do is make this column auto_incrementing after the PHP script sets the proper numbers. The PHP script wor...

Sending emails with PHPMailer()

I have created a newsletter system and my question is: How should i write my code considering that i have to send that mail to hundreds of email addresses? I've discussed with my host administrator and he told me that i should send my emails one by one but not more than 6 per minute. Can i use the $Timeout property? If so, how? Tha...

Web UI: Dynamic Web Forms

consider the following data structure: subject (stdClass) topic (stdClass) units (int) title (varchar 50) description (varchar 255) start_time (time) end_time (time) teacher (stdClass) first_name (varchar 50) last_name (varchar 50) students (stdClass[]) 1 (stdCl...

How to append file after string? php

Ok lets say I have a File called File.txt and it contains Hello World !!!!! Ok now I have it so they may Post something to add to the string But it has ot be right under the string "Hello". How would I go about doing that ? ...

interview assignment

My company is looking for a new web developer and we are eager to find someone that would be efficient as soon as hired and capable of making quality code. I will have to take interview and I would like to give them an assignment, so I can see their general programming skills if they are able to use CSS the general quality of what they...

storing and loading cart in the database

I am coding a E-commerce website/admin interface for a client. They are doing some B2B so they want the cart to be saved/loaded from database so if the user close his browser and reopen it the cart is intact. The application is using the Zend Framework and I've been looking to the Zend_Session_SaveHandler_DbTable. So I can save the ses...

Best way to create a random hash

What is the best way of making a md5 hash for the purpose of storing a session? Also, I am looking for one that works with PHP and works without many extensions added because I want my code to be portable. Also, I have heard of the word nonce, but how do I really use a nonce? ...

Web-based or PC based for process control application ?

I want to create a process control application. Events update the database and that should be reflected on the GUI. Although I personally prefer Linux, the hard fact it that 100% of the potential customers I can imagine run Windows. Ok, for Windows I am comfortable with C++ Builder. I suppose I could switch to NetBeans and use Java j...

How to make a basic Forum Thread on my website ?

How to make a basic Forum Thread on my website ? Like they click it shows the thread without going to a new page and what not. EDIT*** Like the user he clicks something that says Thread or a Programming* and it shows all the posts and they may view that post as if it were on a whole new page without the Programming and thread just the po...

MySQL / PHP Drag and Drop File Upload

I am looking to upload files into a MySQL database using a drag and drop application. Any ideas? I want to be able to drag a file into the browser and then type in a file name. THANKS! ...

Rounding using arbitrary precision libraries in PHP

I asked a question earlier about how to deal with rounding issues with floating point numbers in PHP, and was pointed to the bc and gmp libraries. I've looked at the functions in these libraries but nothing jumped out at me when I was looking for one to round off the number. How do you accurately round using these libraries? ...

Is SHA sufficient for checking file duplication? (sha1_file in PHP)

Suppose you wanted to make a file hosting site for people to upload their files and send a link to their friends to retrieve it later and you want to insure files are duplicated where we store them, is PHP's sha1_file good enough for the task? Is there any reason to not use md5_file instead? For the frontend, it'll be obscured using the...

Using the Google maps API with JavaScript or PHP?

i've read that you can use either javascript or php with google maps api. so what are the pros and cons for each of them? and if i got the geocodes stored in a database. should i get them with ajax and process them with javascript or should i use php? it says in the FAQ that 15000 requests are allowed per day per ip. does this mean tha...