php

Problem with merging wildcard of subdomains with wildcard of few sub-subdomains

Hello! I have EHCP installed because it's simple and helpful on server with few FTP accounts and websites. It's testing only server. Problem is: I can access *.avki.zgarnijlicke.pl, *.kierowca.zgarnijlicke.pl but *.zgarnijlicke.pl isn't working. My config's are: a) Apache template: #______start of {domainname}paneluser:{panelusername}...

How I can implement an bad list in a WebService using PHP

I have an public API how needs authentication and block all users who try brute force... I'm thinking in log all operations in /var/log/auth.log using syslog, and configure fail2ban to add IP from user in deny list of iptables. This is a good solution? Any ideas? ...

Are there any good beginner tutorials for using SSL with your web app?

I have a program written in PHP, and I'd like to make sure that login pages etc. are all served over SSL. Is there any good start to finish tutorial for doing so? Also, does this affect my code in any way, or is it just a matter of getting a SSL cert, and setting up a server correctly? ...

PHP Redirect Headers Best Practices

I'm creating a PHP CMS and have some system pages like a 404 page, a maintenance page, and an unauthorized access page. When Page A isn't found, the CMS will redirect to the 404 page; if the user doesn't have access to Page B, it will redirect to the unauthorized access page, etc. I'd like to use the proper status code in the header of...

How do I array push this 2-D array? (PHP)

In this codeigniter model, I am trying to push the category name of each product. I want the array to look like: Array ( [0] => Array ( [id] => 1 [name] => Game 1! [category_id] => 3 [category] => games //the category element is in the [0] array. ) [1] => Array ( ...

php Curl error: Failure when receiving data from the peer

Hi guys, I had a basic Curl script which basically executed a script on remote server. I was working fine from around 6 months. Yesterday it stopped working, and was giving back following error. "Curl error: Failure when receiving data from the peer" Would like to know if anyone knows on which condition the curl would returned such e...

Retrieving variables from included files

Hi, I have a php file that includes another one using include() I defined a variable $something in the included file and that will change depending on a function that runs in the included file. Now, I want to print that variable in the original file, when I use echo $something it is printing absolutely nothing, help? ...

What's the easiest way to duplicate a column?

Currently, I'm getting the ID of the column via a select statement and insert all the returned values (except the ID). Is there an easier way to do it? ...

Why won't my HTML/PHP form work?

Ok, so I made a form using HTML, and I'd like to get it to submit the information to my email, so I found and modified this PHP script: <?php $to = "[email protected]"; $subject = "R&R Form"; $firstname1 = $_REQUEST['firstname1'] ; $lastname1 = $_REQUEST['lastname1'] ; $firstname2 = $_REQUEST['firstname2'] ; $lastname2 = $_REQUEST['lastnam...

display random images without repetition

Hi Everyone, My name is Shruti.I'm new to php. I have a program which displays images randomly, there are about 200 images in my program.I want to display the random images with out repetition, can any one please help with this. here is my code. Appreciate your help Thank you. ...

Symfony 1.4 Response Object & Page Title

Is there a way to get page title in a layout? I would expect sfResponse::getTitle() to work, but it doesn't. ...

best way to search data-base table for user input keywords?

I want to build a product-search engine. I was thinking of using google-site-search but that really searches Google's index of your site. I do not want to search that. I want to search a specific table (all the fields, even ones the user never sees) on my data-base for given keywords. But I want this search to be as robust as possible...

Programatically getting the order the user just completed in Ubercart

When the user is sent to the "thank you page" (cart/checkout/complete) I need to get some info about the order to send it to a 3rd party tracking API. Problem is that in this point there is no info about the order, either in session nor in any other place that I know of. As a workaround I tried querying the last order for the currently c...

Replace names in text with links

I want to replace names in a text with a link to there profile. $text = "text with names in it (John) and Jacob."; $namesArray("John", "John Plummer", "Jacob", etc...); $LinksArray("<a href='/john_plom'>%s</a>", "<a href='/john_plom'>%s</a>", "<a href='/jacob_d'>%s</a>", etc..); //%s shout stay the the same as the input of the $text. ...

Drupal 6 & PHP: how to crop part of string with php

Hi friends, I'm a newbie php guy. I have 1 string output from Drupal's date module as below; Dec 5 2010 (All day) - Dec 7 2010 (All day) and I need to display only date, without (All day). So, how can I display it as below? is there any php func that I can crop some parts of string? Dec 5 2010 - Dec 7 2010 appreciate he...

Constructing Child Objects in PHP

I have an abstract parent class Item, from which different types of items extend: ItemTypeA, ItemTypeB, and ItemTypeC. From my database result, I have an array: array( 'item_name' => 'This is the item name', 'item_type' => 'ItemTypeA' ); In PHP, what's the best way to create the item? Should I do something similar to the following? ...

The time function in php and 1969

I am trying to save the time in the database for when a user add an entry. Every time I run the time() function it prints (or returns) 1277155717 which represents 1969. I was wondering if there is a way to save the time to the database in a way that it represents the actual date today at this moment. I am using the function /* Works ...

post in the field

How to do it: There is field box is on form and the right link if click this link is open small box And then choose some data and is pasted in the field box edit ( from the comments ) the seem this: <input id='message-1' type="text" name="message-1"> <a href="checker.php" target="_blank" onclick="window.open(this.href,this.target...

PHP script aborts, causes MySQL transaction to fail, whole app locks for a little while

I'm using transactions in a MySQL database, along with Ajax, and I'm having some troubles with scripts timing out. So, here's a rundown of what happens: Ajax script on page makes request to server. Server receives request; script starts a MySQL transaction. Ajax script is set to timeout after two seconds; times out; tells server to abo...

Create a new copy of object itself with some new properties

Sometimes it's difficult to explain in human language what you want to do in programming, but I will try... Please explain to me, how can I implement the following logic. Suppose we have a template class: $obj1=new Tmpl($somevar1, $somevar2, ...); //we then add a new file to template //as we don't have any files yet, new object won't c...