PDA

View Full Version : Capture and streaming webcam images.


atlanty
Jan 10, 2008, 12:04 PM
Hi ! it is possible the capture and streaming webcam images in a webpage with PHP ?
I have this source code below in my server however I want to change it to hold images from webcam and save them in MySQL database.

<form action="addcam.php" method="post">
Name<b>*</b>: <input type="text" name="requiredname"><br>
Homepage: <input type="text" name="homepage"><i> (be sure to include http://)</i><br>
Email address: <input type="text" name="email"><br>
URL of cam image<b>*</b>: <input type="text" name="requiredimage"> <i> (be sure to include http://)</i><BR>
<input type="Submit">
</form>

<?php

// create connection
$conn = mysql_connect($hostname, $username, $password);
if (!$conn) {
die ("Couldn't connect to server : " . mysql_error());
}

// select database
$db = mysql_select_db($database, $conn);
if (!$db) {
die ("Couldn't select $database : " . mysql_error());
}

$name=$_POST['requiredname'];
$homepage=$_POST['homepage'];
$email=$_POST['email'];
$image=$_POST['requiredimage'];

$sql = "INSERT INTO cams (cam_name, homepage, email, cam_url)
VALUES ('$name', '$homepage', '$email', '$image')";
mysql_query($sql);

mysql_close();

echo "<p><a href='$domain/index.php'>To the portal!</a></p>";
?>
Thanks for the answers !