Aftabeh
Messages postés1Date d'inscriptionvendredi 30 avril 2004StatutMembreDernière intervention 1 mai 2004
-
1 mai 2004 à 03:59
cs_Metrox
Messages postés267Date d'inscriptionjeudi 19 septembre 2002StatutMembreDernière intervention 8 septembre 2013
-
1 mai 2004 à 13:25
Hello France
Can someone here please help me to Convert this to CFMX and MSSQL.. Please.
I realy don't understand PHP..:(
Thank you in Advance
Merci
Jafangian
Canada
PS: I don't speak french.. :( but i hope someone here speaks english :)
Thanks again.....
<?
# Table structure for table `galleryComments`
#
# If you are using PHPmyAdmin like 99% of us are do this...
# Login and select(if db is not already chosen) your database
# There will be a tab called 'SQL' -- click it.
# Copy the code block below and paste it in the box and submit.
/*
CREATE TABLE gallerycomments (
ID int(11) NOT NULL auto_increment,
galID int(11) NOT NULL default '0',
picID varchar(255) NOT NULL default '0',
poster varchar(255) NOT NULL default '',
date varchar(255) NOT NULL default '',
body longtext NOT NULL,
PRIMARY KEY (ID)
) TYPE=MyISAM COMMENT='Holds the data for user comments in the CB Gallery';
*/
#
#
#________CONFIGURE DB CONNECTION HERE________
#
#
#
/*IF YOU WANT TO CONNECT TO YOUR DATABASE UNBLOCK THIS SECTION OF CODE (REMOVE THIS LINE AND THE OTHER LINE LIKE IT)
$host="localhost"; // this is the path to your MySQL DB, generally localhost. If it isnt, contact your host
$user="root"; // the username to you MySQL DB. Contact your host for your username if unknown.
$pass=""; // the password to you MySQL DB. Contact your host for your password if unknown.
$db="website"; // this is the MySQL DB name of your database. Once again...contact your host for your MySQL DB Name if unknown.
// Connect to your MySQL DB
$link=mysql_connect($host, $user, $pass) or die ("&replyStatus=badLink");
mysql_select_db($db) or die ("&replyStatus=badDB");
IF YOU WANT TO CONNECT TO YOUR DATABASE UNBLOCK THIS SECTION OF CODE (REMOVE THIS LINE AND THE OTHER LINE LIKE IT)*/
#
#
#________CONFIGURE DB TABLE NAME HERE________
#
#this is the name of your table where you will store your comments.
#if you used the tbl structure above the default name for this tbl
#is 'gallerycomments'
#
#
$galCom="`gallerycomments`";
if (isset($_REQUEST['appState']))
$appState=$_REQUEST['appState'];
else
die("&replyStatus=noAppState");
switch($appState){
case "createGalleryPost": {
$galID = $_POST['GALID'];
$picID = $_POST['PICID'];
$poster = $_POST['POSTER'];
$date = $_POST['DATE'];
$body = $_POST['BODY'];
$query="INSERT INTO $galCom (galID,picID,poster,date,body) VALUES ('$galID','$picID','$poster','$date','$body')";
$result = mysql_query($query) or die ("<status>bad query2</status>");
$lastInsertID=mysql_insert_id();
echo "Status=1&ID=$lastInsertID";
break;
}
case "getGalleryComments": {
$galleryID = $_POST['GALLERYID'];
$query="SELECT * FROM $galCom WHERE galID = $galleryID ORDER BY id DESC ";
$result = mysql_query($query) or die ("<status>bad query</status>");
echo "<response><gallery id='gallery'>";
while ($r = mysql_fetch_assoc($result)){
echo "";
while (list ($key, $val) = each ($r)){
echo "<$key><![CDATA[$val]]></$key>";
}
echo "
";
}
echo "</gallery></response>";
break;
}
case "listDir": {
$base_dir = $_REQUEST['DIR'];
recrusive_dirlist('dir',$base_dir);
}
case "listFiles": {
$gal_dir = $_REQUEST['DIR'];
recrusive_dirlist('files',$gal_dir);
}
}
function recrusive_dirlist($getWhat, $base_dir){
global $getDirList_alldirs,$getDirList_allfiles;
function getDirList($getWhat,$base){
global $getDirList_alldirs,$getDirList_allfiles;
if(is_dir($base)){
$dh = opendir($base); while (false !($dir readdir($dh))){
if (is_dir($base ."/". $dir) && $dir !== '.' && $dir !== '..'){
if($getWhat=='dir'){
$subs = $dir ;
$subbase = $base ."/". $dir;
$getDirList_alldirs[]=$subbase;
//getDirList($getWhat,$subbase);
}
}
elseif(is_file($base ."/". $dir) && $dir !== '.' && $dir !== '..'){
$getDirList_allfiles[]=$base ."/". $dir;
}
}
closedir($dh);
}
}
getDirList($getWhat,$base_dir);
echo "<response><content id='content'>";
if($getWhat=='files'){
$return_array = $getDirList_allfiles;
}else{
$return_array = $getDirList_alldirs;
}
while (list(, $value) = each ($return_array)) {
echo "<![CDATA[$value]]>";
}
echo "</content></response>";
}
?>