Is there a regex out there that can find a string that contains a word that starts with either http:// or www and wrap it with <a>$1</a>?
Been googling but I can't seem to find a ultimate one.
Another question, Could you somehow make it ignore it if its inside a <img> tag ?
Thanks a bunch!
...
In CakePHP we can use $this->Auth->allow('someMethod'); to make a page viewable without having to login. How do I make some the same page is not viewable when a user is logged in? An example of this would be a register page which we want to be accessible without user logged in ... but not accessible once a user logged in.
I put $this->A...
Hi all,
I'm trying to use cURL to grab an external web page to put into my own website, it's basically a "ladder" of a sports team, I contacted them, but they do not have a RSS feed of the ladder, so I'm trying to obtain the ladder by other means, is it possible to grab everything between < table > and < / table > using cURL? I can grab...
So, I have a file that sends the following:
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: private");
header("Content-type: application/pdf");
header("Content-disposition: inline; filename=file.pdf");
header("Content-length: 7735");
then I echo out the file - it is a PDF file.
Works fine in IE6 & 7 on XP (and ...
I develop in php and all the tutorials or pages such as wikipedia that I see don't really explain what mvc really is.
In my understanding so far mvc is a file structure which includes your classes, websites with their html, external style sheets or 3rd party plugins (seperated in its own folder).
I have created a structure such as this...
lets say;
I have a $friends array with 2,000 different friendID numbers
+
I have a $bulletins array with 10,000 bulletinID numbers, the $bulletins array will also have another value with a userID of who posted the bulletin entry
Now is it possible to get all the bulletinID numbers that have a userID matching a userID in the friends a...
I have the following code designed to begin a session and store username/password data, and if nothing is submitted, or no session data stored, redirect to a fail page.
session_start();
if(isset($_POST['username']) || isset($_POST['password'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$_SESSION['user...
This code selects cell values in MySQL and manually adds them to PHP variables:
$sql = "SELECT * FROM table LIMIT 0,1";
$result = mysql_query($sql);
while($rows = mysql_fetch_array($result)) {
$col1 = $rows['col1'];
$col2 = $rows['col2'];
$col3 = $rows['col3'];
.....
}
This is obviously unmanageable for multiple and la...
Hi all,
I need a good config file format. I plan on putting to table schema. Like symfony, ruby on rails, etc. What is the best file format for configuration file ? Yaml or XML or JSON encoded file ? Which is the best for this purpose ?
...
I have a file here which contains list of database names and its corresponding size.
Now I want to sort the size from the largest to the lowest, and the database name
should go along it upon display.Am using PHP here..
Can anyone help me out?
Here's a simple code for that:
$file_name = test.txt
$handle = @fopen($file_name, "r");
if (...
I need a function that given a relative URL and a base returns an absolute URL. I've searched and found many functions that do it different ways.
resolve("../abc.png", "http://example.com/path/thing?foo=bar")
# returns http://example.com/abc.png
Is there a canonical way?
On this site I see great examples for python and c#, lets get a...
I have php web service. and can consume it from php client.
But problem occurs when i try call from c# win app.
Do you have any ideas..
Problem is it returns null, also i cannot see it from object browser
My wsdl file
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1=...
I'm getting an error in my PHP code Strict Standards: Creating default object from empty value. The code I'm using is:
$u = new User();
$user->id = $obj['user_id'];
The error is appearing on the second line, where I set the id property. The user class has id set as a private property with magic getters and setters defined.
Strangely...
$url = 'the web address I want to get the first and second numbers close to $' ;
$str = file_get_contents($url);
preg_match_all('/ ([$]) *(\d+(:?.\d+)?)/', $str, $matches, PREG_SET_ORDER);
$i=0;
foreach ($matches as $val) {
if($i==0) $first=$val[2] ;
if($i==3) $second=$val[2] ;
$i++;
}
$bad_symbols = array(",", "."); $f...
In one of my project i have a requirement for live or on demand video streaming. I am using PHP and AJAX for this project so i want to know how to do Http Video Streaming PHP or an referece site to do this.
...
With my PHP form, I want to pass one value to the URL, but remove submit.x and submit.y. Here's my form:
<form action="booking.php" method="get">
<input type="image" value="access" class="rollbtn" src="../images/book-btn.gif" alt="Book" name="submit" />
</form>
I want the URL to display booking.php?submit=access - but omit the x a...
Hello folks,
I'm trying to send the PHPSESSID via a HTTP GET variable for a cookie-less client.
I've seen this in various drupal implementations where ?PHPSESSIONID=123ABC is appending to each link, but how do I specify this in PHP and is there any way of changing the GET parameter so it could be ?token=123ABC, or even sent via HTTP PO...
My project in php
I want to create a countdown timer for asking question in limited timeframe like LMS
here i have use the javascript countdown timer but when refresh the page javascript timer are reset.
...
This is called from flash/action script
File name: rssProxy.php
RSS reader uses PHP any work around on a non PHP server?
Script below:
<?php
$rss = $_GET['rss'];
// make sure that some page is really being called
if ($rss && $rss != ""){
// make sure that an http call is being made - otherwise there's access to any file on machine.....
I know how to select one random item from an array, but how about ten random items from an array of, say, twenty items? (In PHP.)
What makes it a little more complicated is that each item actually has two parts: a filename, and a description. Basically, it's for a webpage that will display ten random images each time you reload. The act...