Unserialize?
Posted: Fri Jan 23, 2009 12:44 pm
I had someone write a script for my website and he used serialize and unserialize to get file contents. What I want to do is allow the user to pull up their "scrollname" and info in the database. This is the script that I used:
I need to know how to make those 4 digit codes ie: DXFP, IpZb, 5ygz, bq4k, and wPOE come up as images.
The address form the images is http://dragcave.net/image/"4 digit code here"
And it pulls this from the database...<?php
if(isset($_POST['submit'])){
if(isset($_GET['go'])){
if(preg_match("/^[ a-zA-Z]+/", $_POST['name'])){
$name=$_POST['name'];
//connect to the database
$db=mysql_connect ("localhost", "user_name", "user_password") or die ('I cannot connect to the database because: ' . mysql_error());
//-select the database to use
$mydb=mysql_select_db("hdragons_newsite");
//-query the database table
$sql="SELECT id, scrollname, eggs, hatchlings, icu FROM scrolls WHERE scrollname LIKE '%" . $name . "%'";
//-run the query against the mysql query function
$result=mysql_query($sql);
//-create while loop and loop through result set
while($row=mysql_fetch_array($result)){
$scrollname =$row['scrollname'];
$eggs =$row['eggs'];
$hatchlings =$row['hatchlings'];
$icu =$row['icu'];
$id=$row['id'];
//-display the result of the array
echo $scrollname . "<br>\n";
echo $eggs . "<br>\n";
echo $hatchlings . "<br>\n";
echo $icu . "<br>\n";
}
}
else{
echo "<p>Please enter a search query</p>";
}
}
}
?>
dragonsmistress
a:4:{i:0;s:4:"DXFP";i:1;s:4:"IpZb";i:2;s:4:"5ygz";i:3;s:4:"bq4k";}
a:1:{i:0;s:4:"wPOE";}
a:0:{}
I need to know how to make those 4 digit codes ie: DXFP, IpZb, 5ygz, bq4k, and wPOE come up as images.
The address form the images is http://dragcave.net/image/"4 digit code here"