php

Regex Pattern for findin http in PHP

Hello everyone, how can i extract the http from this text? "Text: Here's 2 free bonuses. http://blablabla.blabla/blabla " But the url can also be another one. Finaly After i have the array, wich contains usualy just one url, how can i add it to the above text exactly at the same position? but with html tag <a> the results should l...

How to remove the browser cache?

I have one image website where users can vote images. IMAGES ARE RANDOMLY GENERATED ON FIRST PAGE! Once they vote they're redirected using window.location to the image details page. If they click back they will see the same image...from the browser cache..and they can vote it unlimited times.... How to I remove the cache? I want the fir...

PHP Memory Overflow?

Hi all, Im currently building a php framework... again. I have a class called config. its pretty simple, its called like so: $conf = config::get('general'); $conf is now an array full of config goodies. the class sceleton is like so: final class config { private static $configs = array(); public static function get($name) { ret...

Executing a user Function in a array with php

I have an array containing much more items than just this one. This is just an example of an item. [0] => Array ( [id] => 6739380664 [created_at] => 1260991464 [text] => @codeforge thx for following [source] => web [user] => Array ( [...

How to make users able to upload images in a form ?

I have a classifieds website where users must fill in a form in order to put a ad. The form consists of name, password, category, specifications etc etc. Now, I need to add a image upload function into this form, which must have the following: 1- Upload up to 5 images. 2- A 'remove image link' beneath each image if the user wants anoth...

Php lottery issues multi winner problems

I have created a lottery script in php. My problem is now selecting more then one winner. Because it is possible for players to have the same number on their tickets. Here I am supplying the two table structures and the source code. lotto_game { id(int) jackpot(int) status(varchar10) pick_1(int) pick_2(int) pick_3(int) pick_4(int...

MultiLine Form in HTML ?

Hello, I'm trying to get some input from a user and use that input in a php script. Right now I have a form tag, from the little I understand, this cannot have multiline input. The solution seems to be a TextArea, however I'm not sure how to get the input from a TextArea. Here's my code with the form : <form action="traitement_cmd....

Zend_Date: How to get the date of an upcoming day?

I want to get the date of the closest Monday in the future (i.e. not in the past). So if today is Tuesday (Dec 1, 2009) I want to get the date of Monday (Dec 7, 2009). How can I do this with Zend_Date? Solution: Let's say today is Tuesday and we wanted to get the upcoming Monday. Monday is 6 days into the future. So, we would add 6 d...

MySQL/PHP: How to list results in groups but limit the DB queries required

I have a database as follows: --------------------------------------------------------------- | module_name | category | content | --------------------------------------------------------------- | module1 | category1 | content | | module2 | category1 | c...

PHP dom - How to get the contents within a span tag that includes a hyperlink

I've done this before but can't find my code snippet. I'd like to parse an html file and pull everything into my browser that sits between some span tags. There are other span tags in the html that I do not want so I figured I would limit the parsing to just the span tags that have the same css class. Can someone please give me an examp...

How do I list normalised data from MySQL in PHP?

I always struggle with dealing with normalised data, and how I display it. Maybe its because I don't fully understand the normalisation rules, like how to get it fully into Boyce-Codd. Performance is not really an issue at this stage, though maintainability of the schema is. user ID Name 1 Alice 2 Bob 3 Charlie skills ID ...

Is it wrong to use $_REQUEST for Data?

So, I've been coding for a little (2 years), and I have a very subjective question: Is it wrong to use $_REQUEST for Data? This mainly pertains to authentication by the way. If you think about the 3 ways data can occur in $_REQUEST, it can come from either a cookie, a form, or a query string. Now, I know that most people directly gra...

HTML customizing Select tag

I have this Code For example: <select > <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> <option value="audi">Audi</option> <option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><...

Which headers should I use for serving static content?

I am gzipping my static Javascript and CSS files using PHP. When the original file is requested, the server sends the Last-Modified and ETag headers. I'm not sending these with PHP just yet. I've also seen suggestions to use Cache-control and Expires headers and some more that I don't remember. Are those first two enough? I guess I can ...

PHP Include Error w/ CSS

I have having difficulties on this one page login.php becuase of the nature of the session it does not allow a $page to be called. I included the header the same way I did on all other pages. The code highlighted between the ===== is my header include with $page defined for the < ul > so I can call a different class each page. But it's n...

Facebook API - can't access any info.

I can login but the script below is not printing my status. What can I do to make it work? require_once 'facebook.php'; $facebook = new Facebook($appapikey, $appsecret); ?> <script src="http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script> <script type="text/javascript"> FB.init('<?php ...

access data in return value

I have the line if( getdate($start_time)['hours'] == 0 ){ and I am getting Parse error: syntax error, unexpected '[' But if I change the line to $start_time_as_date = getdate($start_time); if( $start_time_as_date['hours'] == 0 ){ I don't get an error. Do I always have to save an array to a variable to access its data? Or is th...

Upload and Crop image

Hi ... Im looking for upload and crop image in PHP. The scenario is: user choose image and upload to server after uploaded, the website display the uploaded image. user crop the image And upload the cropped image to the server. can you help me to implement this ? ...

PHP how to check if a MySQLi query needs to be closed?

I created a simple MySQLi class for a project I'm working on to make it easier and more streamlined to pull from and push to the DB. (also to get more familiar with OOP in PHP) A problem I keep running into is in an effort to make it as efficient as possible. I try to close / free every query / statement / result set. In doing so I get ...

need preg_replace help in php

now i want make this by the preg_replace $web = 'site.com'; i want the preg_replace make it http://www.site.com and if it http://site.com no prblem it whould add http:// in it found in the url thanks please i want do that is http:// not exsist ...