MCrosbie
-
Posts
36 -
Joined
-
Last visited
Never
Posts posted by MCrosbie
-
-
It's the processing of the images is where it's cutting out. The ZIP folder is uploaded fine, and the unzipping works fine, it's just the processing.
-
bumpety bump
-
Yep they are changing and I've added budimirs suggestions and this still hasn't change the outcome.
This is my php.ini file now:
; Maximum size of POST data that PHP will accept. post_max_size = 50M ; Whether to allow HTTP file uploads. file_uploads = On ; Maximum allowed size for uploaded files. upload_max_filesize = 50M ; Maximuum execution time max_execution_time = 1000000000 ; Maximum input time max_input_time = 6000000000 ; Memory limit memory_limit = 800M
-
There is a great MySQL Program called Navicat (www.navicat.com) which allows you to import xml files into MySQL databases. I use it and it's fantastic, highly recommended.
-
This is the php.ini file that I had originally:
; Maximum size of POST data that PHP will accept. post_max_size = 50M ; Whether to allow HTTP file uploads. file_uploads = On ; Maximum allowed size for uploaded files. upload_max_filesize = 50M ; Maximuum execution time max_execution_time = 500000
I will add budimir's suggestions and get back to you on how these went. Thanks PFMa for your help
-
Hi,
Thanks both for your help.
Resago, I already tried doing this, but it still wasn't able to handle the larger files. Thanks for your suggestion though.
Budimir, I already have php.ini value for max_execution_time set to 10000. Is this different from max_exec_time?
Thanks again,
-
Hi,
I'm trying to make a photo gallery script where the admin can upload a ZIP file with photos inside.
Once uploaded it will be automatically unpacked, copied, resized for thumbnails, watermarked.
I've got Verot's upload class to do the processing, but the script always cuts out if the photos are larger, i.e. 1.9 MB etc. Below is my code for processing the files once they have been unzipped. It can handle processing files that are smaller than about 500KB but over that it tends to timeout.
$dirpath[0] = '../../../../media/DM_photogallery/'.$_GET['id'].'/'; $dirpath[1] = '../../../../media/DM_photogallery/'.$_GET['id'].'/original/'; $dirpath[2] = '../../../../media/DM_photogallery/'.$_GET['id'].'/watermarked/'; $dirpath[3] = '../../../../media/DM_photogallery/'.$_GET['id'].'/thumbs/'; $dirpath[4] = '../../../../media/DM_photogallery/'.$_GET['id'].'/ziptemp/'; $picsdir=dir($dirpath[4]); $x = 1; while(($file = $picsdir->read()) !== false) { if($file != 'thumbs' and substr($file,0,1)!="."){ if($file){ $filename = $file; preg_replace('`[^a-z0-9-_.]`i','',$filename); $filename = str_replace(' ','_',$filename); $filename = str_replace(',','_',$filename); mysql_query("Insert into DM_photogalleryimg (gallery_id, file_name, title) values ('".$_GET['id']."','".$filename."','".$filename."')")or die("Error". mysql_error().""); copy($dirpath[4].''.$file,$dirpath[1].''.$filename); $handle = new Upload($dirpath[1].''.$filename); if ($handle->uploaded) { // save uploaded image with no changes $handle->image_resize = true; $handle->image_x = 150; $handle->image_y = 150; $handle->image_ratio = true; $handle->Process($dirpath[3]); if ($handle->processed) { } else { echo 'error : ' . $handle->error; } $handle->image_watermark = '../../../../media/watermark.png'; $handle->image_resize = true; $handle->image_x = 650; $handle->image_y = 650; $handle->image_ratio = true; $handle->Process($dirpath[2]); if ($handle->processed) { } else { echo 'error : ' . $handle->error; } } if($x == 1){ $x = 0; sleep(4); } $x++; echo $filename.' Processed<br />'; $processed_images = 1; } } } $picsdir->close();
-
Brilliant. Thanks for all your help, it's greatly appreciated.
-
Worked like a charm!
Can you explain the difference that that has made and why it worked?
-
This is the template here:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> </head> <body style="margin: 0px; height: 100%; min-height: 100%; background-color: rgb(255, 255, 255); font-family: Geneva,Verdana,Arial,Helvetica; font-size: 14px; color: rgb(51, 51, 51); font-stretch: semi-expanded;"> <table width="750" cellspacing="0" cellpadding="0" border="0" bgcolor="#ffffff" align="center"> <tbody> <tr> <td width="750" height="150" colspan="2"> <p style="border: 1px solid rgb(190, 188, 183); padding: 13px 18px; background: rgb(248, 247, 245) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">A new invoice has been billed to your account.</p> <img width="750" height="150" alt="9th Design . web design . print media . corporate identity . logos . web hosting . web domains . creating opportunities" src="http://www.9thdesign.co.nz/dimensions/skins/default/media/sales/invoice_header.gif" /></td> </tr> <tr> <td width="50%" valign="top" height="139" style="font-family: Geneva,Verdana,Arial,Helvetica; font-size: 14px; color: rgb(51, 51, 51);"> <p><b>Billed To:<br /> </b>{var customer.id}<br /> {var customer.company}<br /> {var customer.fname} {var customer.lname}<br /> {var customer.address}<br /> {var customer.address2}<br /> {var customer.city}<br /> {var customer.state}<br /> {var customer.country}<br /> <br /> {var customer.email} <strong><br /> <br /> </strong></p> </td> <td width="50%" valign="top" style="font-family: Geneva,Verdana,Arial,Helvetica; font-size: 14px; color: rgb(51, 51, 51);"> <p><strong>Invoice number: </strong>{var invoice.id}<br /> <strong>Date issued:</strong> {var invoice.created}<br /> <strong>Date due: </strong>{var invoice.due}<br /> <strong>Date paid: </strong>{var invoice.paid}<br /> <strong>Invoice Total: </strong>${var invoice.total}</p> </td> </tr> <tr> <td colspan="2"> <p align="left">{var invoice.statement}</p> <p align="left"><span style="font-weight: bolder;">Late payment policy</span><br /> All accounts must be paid by the 30th of the month due. If not paid by the 30th interest will be applied at a rate of and will be carried forward.</p> <p align="left">If you have questions concerning this invoice, please email: <br /> <br /> </p> </td> </tr> <tr> <td colspan="2" style="border-bottom: 1px solid rgb(204, 204, 204);"> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody> <tr style="border-bottom: 0px solid rgb(204, 204, 204);"> <td colspan="3" style="border-bottom: 1px solid rgb(204, 204, 204);"><strong>Payment options </strong></td> </tr> <tr style="border-bottom: 0px solid rgb(204, 204, 204);"> <td><strong>Cheques:</strong></td> <td><strong>PayPal:</strong></td> <td><strong>Bank transfer </strong></td> </tr> <tr style="border-bottom: 0px solid rgb(204, 204, 204);"> <td>Make payable to </td> <td>Make payments to </td> <td>Account name: 9th Design<br /> Bank number: <br /> Bank: <br /> Branch: <br /> Reference:</td> </tr> </tbody> </table> </td> </tr> <tr> <td height="50" colspan="2" style="border-bottom: 1px solid rgb(204, 204, 204);"> <div align="center"> <p style="font-family: Geneva,Verdana,Arial,Helvetica; font-size: 12px; color: rgb(105, 105, 105);">Copyright 2007-9, 9th Design. All rights reserved.</p> </div> </td> </tr> </tbody> </table> </body> </html>
The values are as follows:
$calc[0] = 28
$invoice_id = 101067
-
I have a function for sending email using email templates. This is for transactional emails. Inside these email templates are variables, e.g. {var customer.id}.
This is the function:
// TRANSACTIONAL EMAILS SEND function transaction_email($tag,$var = array(),$sendto){ $res_template = mysql_query("Select * from DM_email_templates where tag='".$tag."'"); $row['template'] = mysql_fetch_array($res_template); $message = $row['template']['content']; $subject = $row['template']['subject']; foreach ($var as $tags => $data) { $message = eregi_replace("{" . $tags . "}", $data, $message); $subject = eregi_replace("{" . $tags . "}", $data, $subject); } $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: '.DM_site('website_name').' <'.DM_site('admin_email').'>' . "\r\n"; mail($sendto['name']."<".$sendto['email'].">",$subject,$message, $headers); }
This is a call to the function for it to send:
$sendto['name'] = $form['billed_to']; $sendto['email'] = $row['custid']['email']; transaction_email('new_invoice',array( "var invoice.total" => $calc[0], "var invoice.id" => $invoice_id, "var customer.id" => $row['custid']['id'], "var customer.company" => $calc[4]['company'], "var customer.fname" => $calc[4]['fname'], "var customer.lname" => $calc[4]['lname'], "var customer.address" => $calc[4]['address'], "var customer.address2" => $calc[4]['address2'], "var customer.city" => $calc[4]['city'], "var customer.state" => $calc[4]['state'], "var customer.country" => $calc[9], "var customer.telephone" => $calc[4]['telephone'], "var customer.email" => $calc[4]['email'], "var invoice.created" => $calc[5]['created'], "var invoice.due" => $calc[5]['due'], "var invoice.paid" => $calc[5]['paid'], "var invoice.statement" => $calc[10], "var site.name" => DM_SITE('website_name'), "var site.addr" => "http://".$_ENV['SERVER_NAME']."" ),$sendto);
Now the problem I have, and it has only happened with the above example, is that both var invoice.total and var invoice.id don't come through.
var invoice.total simply replaces the tag with nothing. I have checked and the value ($calc[0], lets say it is 28 for now), and it is passed all the way till eregi_replace, and even afterwards, but for some reason it doesn't replace it with the value, rather it replaces it with " " - nothing.
var invoice.id is a similar situation, but instead of replacing it with nothing it replaces it with a "?". I can think of no logical reason for why it would be doing this.
I have tried to change the names of the variable and change the values, but nothing seems to change the outcome.
Please help!
-
Hi there,
I have the following tag, which I want the contents of which to be hidden. This is a email that is being emailed to two people, one who is allowed to view the price, one who isn't.
This is what I have at present:
<price>$ 10.99</price>
(Prices will change)
I want this to be replaced with
<price>$ --.--</price>
Any ideas?
Cheers, Michael
-
Hi,
I'm trying to convert the URL's of the CMS system I made to SEF URL's.
At present these have several variables in them, that can change for every page. Is there anyway, like ?action=go&send=yes, to get what the variable name is, e.g. action, send, and also the value of the variable, e.g. go, yes.
Can it be done like www.mysite.com/home/action,go/send,yes ? If so, how does that work?
Thanks for your help,
Michael
-
Hi,
Right, here is what I'm up to. In this CMS system all of the PHP code for the different variables e.g. {title} are stored in a MySQL database. The code searches for these variables in the pages contents, e.g. "<td>{title}</td>}", and replaces it with whatever the PHP code for that variable is e.g. $echo = $row['content']['title'], "<td>My Title</td>". In some of the pages, the variable is actually variable in it self, for instance for photo galleries, instead of creating a seperate variable for each gallery created, just use one. So for instance in a pages contents may be {PhotoGallery #100921}, this number needs to be named as $var['varivari'], before the PHP for variable is evaluated. I have already tried one solution using preg_match, which works fine, however on some pages where status=1, I get Internal Server Errors. Could you please help me to add in code to the "Current PHP code", to be able to enable this number to be picked up.
Database: DM_content
---------------------------------------------------------------------------------------------------------------------------------
| id | level | uplevel | title | description | keywords | content | author | template |
---------------------------------------------------------------------------------------------------------------------------------
| 100920 | 0 | 0 | Page 1 | Description | page 1 page | My content| Michael | 100500 |
---------------------------------------------------------------------------------------------------------------------------------
| 100921 | 1 | 100920 | Page 2 | Description | page 2, page | {title} | Michael | 100500 |
---------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------
| status | membersonly | zorder | menu |
------------------------------------------------------------
| 0 | 1 | 0 | 1 |
------------------------------------------------------------
| 1 | 0 | 0 | 0 |
------------------------------------------------------------
Page 1 - Live to the public (status = 0), Members only page (membersonly = 1), Is not shown on the menu (menu = 1)
Page 2 - Child page to Page 1, Under development (status = 1), Is shown in the menu (menu = 0)
Database: DM_variables
------------------------------------------------------------------------------------------------------------------
| id | code | php |
------------------------------------------------------------------------------------------------------------------
| 300221 | /AO_photogallery #\b([1-9][0-9]{5})\b/ | $echo = PhotoGallery ... etc |
------------------------------------------------------------------------------------------------------------------
| 300222 | {title} | $echo = $row['content']['title'] |
------------------------------------------------------------------------------------------------------------------
Current PHP code:
Code:
include('includes/startup.php'); $res['chlock'] = mysql_query("Select * from DM_site where variable='HS_status'"); $row['chlock'] = mysql_fetch_array($res['chlock']); if($row['chlock']['value'] != 0 ){ include('includes/lockdown.php'); }else{ $res['contentselect'] = mysql_query("Select * from DM_content where level='1' and title LIKE '%home%'")or die("Error ". mysql_error().""); $row['contentselect'] = mysql_fetch_array($res['contentselect']); if(!$_GET['id']){$_GET['id'] = $row['contentselect']['id'];} $res['content'] = mysql_query("Select * from DM_content where id='".$_GET['id']."'")or die("Error ". mysql_error().""); $row['content'] = mysql_fetch_array($res['content']); $res['template'] = mysql_query("Select * from DM_templates where id='".$row['content']['template']."'")or die("Error ". mysql_error().""); $row['template'] = mysql_fetch_array($res['template']); $content = $row['template']['template']; $res['variables'] = mysql_query("Select * from DM_variables")or die("Error ". mysql_error().""); while($row['variables'] = mysql_fetch_array($res['variables'])){ $echo = ''; eval($row['variables']['php']); $content = str_replace($row['variables']['code'], $echo, $content); } echo $content; }
PHP code that gets the number, but sometimes gives Internal Server Errors for unknown reasons
Code:
include('includes/startup.php'); $res['chlock'] = mysql_query("Select * from DM_site where variable='HS_status'"); $row['chlock'] = mysql_fetch_array($res['chlock']); if($row['chlock']['value'] != 0 ){ include('includes/lockdown.php'); }else{ $res['contentselect'] = mysql_query("Select * from DM_content where level='1' and title LIKE '%home%'")or die("Error ". mysql_error().""); $row['contentselect'] = mysql_fetch_array($res['contentselect']); if(!$_GET['id']){$_GET['id'] = $row['contentselect']['id'];} $res['content'] = mysql_query("Select * from DM_content where id='".$_GET['id']."'")or die("Error ". mysql_error().""); $row['content'] = mysql_fetch_array($res['content']); $res['template'] = mysql_query("Select * from DM_templates where id='".$row['content']['template']."'")or die("Error ". mysql_error().""); $row['template'] = mysql_fetch_array($res['template']); $content = $row['template']['template']; $res['variables'] = mysql_query("Select * from DM_variables ORDER by id ASC")or die("Error ". mysql_error().""); while($row['variables'] = mysql_fetch_array($res['variables'])){ $echo = ''; if(preg_match($row['variables']['code'],$content,$matches)){ $var['varivari'] = $matches[1]; if($matches[1] = "[1-9][0-9]{5}"){ $row['variables']['code'] = "{".$matches[0]."}"; } eval($row['variables']['php']); $content = str_replace($row['variables']['code'], $echo, $content); } } echo $content;
-
Hi Peeps,
Right, here is what I'm up to. In this CMS system all of the PHP code for the different variables e.g. {title} are stored in a MySQL database. The code searches for these variables in the pages contents, e.g. "<td>{title}</td>}", and replaces it with whatever the PHP code for that variable is e.g. $echo = $row['content']['title'], "<td>My Title</td>". In some of the pages, the variable is actually variable in it self, for instance for photo galleries, instead of creating a seperate variable for each gallery created, just use one. So for instance in a pages contents may be {PhotoGallery #100921}, this number needs to be named as $var['varivari'], before the PHP for variable is evaluated. I have already tried one solution using preg_match, which works fine, however on some pages where status=1, I get Internal Server Errors. Could you please help me to add in code to the "Current PHP code", to be able to enable this number to be picked up.
Database: DM_content
---------------------------------------------------------------------------------------------------------------------------------
| id | level | uplevel | title | description | keywords | content | author | template |
---------------------------------------------------------------------------------------------------------------------------------
| 100920 | 0 | 0 | Page 1 | Description | page 1 page | My content| Michael | 100500 |
---------------------------------------------------------------------------------------------------------------------------------
| 100921 | 1 | 100920 | Page 2 | Description | page 2, page | {title} | Michael | 100500 |
---------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------
| status | membersonly | zorder | menu |
------------------------------------------------------------
| 0 | 1 | 0 | 1 |
------------------------------------------------------------
| 1 | 0 | 0 | 0 |
------------------------------------------------------------
Page 1 - Live to the public (status = 0), Members only page (membersonly = 1), Is not shown on the menu (menu = 1)
Page 2 - Child page to Page 1, Under development (status = 1), Is shown in the menu (menu = 0)
Database: DM_variables
------------------------------------------------------------------------------------------------------------------
| id | code | php |
------------------------------------------------------------------------------------------------------------------
| 300221 | /AO_photogallery #\b([1-9][0-9]{5})\b/ | $echo = PhotoGallery ... etc |
------------------------------------------------------------------------------------------------------------------
| 300222 | {title} | $echo = $row['content']['title'] |
------------------------------------------------------------------------------------------------------------------
Current PHP code:
include('includes/startup.php'); $res['chlock'] = mysql_query("Select * from DM_site where variable='HS_status'"); $row['chlock'] = mysql_fetch_array($res['chlock']); if($row['chlock']['value'] != 0 ){ include('includes/lockdown.php'); }else{ $res['contentselect'] = mysql_query("Select * from DM_content where level='1' and title LIKE '%home%'")or die("Error ". mysql_error().""); $row['contentselect'] = mysql_fetch_array($res['contentselect']); if(!$_GET['id']){$_GET['id'] = $row['contentselect']['id'];} $res['content'] = mysql_query("Select * from DM_content where id='".$_GET['id']."'")or die("Error ". mysql_error().""); $row['content'] = mysql_fetch_array($res['content']); $res['template'] = mysql_query("Select * from DM_templates where id='".$row['content']['template']."'")or die("Error ". mysql_error().""); $row['template'] = mysql_fetch_array($res['template']); $content = $row['template']['template']; $res['variables'] = mysql_query("Select * from DM_variables")or die("Error ". mysql_error().""); while($row['variables'] = mysql_fetch_array($res['variables'])){ $echo = ''; eval($row['variables']['php']); $content = str_replace($row['variables']['code'], $echo, $content); } echo $content; }
PHP code that gets the number, but sometimes gives Internal Server Errors for unknown reasons
include('includes/startup.php'); $res['chlock'] = mysql_query("Select * from DM_site where variable='HS_status'"); $row['chlock'] = mysql_fetch_array($res['chlock']); if($row['chlock']['value'] != 0 ){ include('includes/lockdown.php'); }else{ $res['contentselect'] = mysql_query("Select * from DM_content where level='1' and title LIKE '%home%'")or die("Error ". mysql_error().""); $row['contentselect'] = mysql_fetch_array($res['contentselect']); if(!$_GET['id']){$_GET['id'] = $row['contentselect']['id'];} $res['content'] = mysql_query("Select * from DM_content where id='".$_GET['id']."'")or die("Error ". mysql_error().""); $row['content'] = mysql_fetch_array($res['content']); $res['template'] = mysql_query("Select * from DM_templates where id='".$row['content']['template']."'")or die("Error ". mysql_error().""); $row['template'] = mysql_fetch_array($res['template']); $content = $row['template']['template']; $res['variables'] = mysql_query("Select * from DM_variables ORDER by id ASC")or die("Error ". mysql_error().""); while($row['variables'] = mysql_fetch_array($res['variables'])){ $echo = ''; if(preg_match($row['variables']['code'],$content,$matches)){ $var['varivari'] = $matches[1]; if($matches[1] = "[1-9][0-9]{5}"){ $row['variables']['code'] = "{".$matches[0]."}"; } eval($row['variables']['php']); $content = str_replace($row['variables']['code'], $echo, $content); } } echo $content;
-
Actually I can't. The page is actually grabbing this php code from a mysql db and evaluating the code.
Thanks for your suggestion, but I dont think it would work.
Cheers!
-
Hello,
I am getting this error:
"Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /*/*/public_html/client/ecom.php(119) : eval()'d code on line 491"
This is the code:
$echo .= ' <script language="javascript" type="text/javascript"> counter=1; max_per_upload=5; checker=""; function addPhoto() { img=eval("document.photoaddform.photofile"+counter+".value"); img=img.replace(\'&\',\'&\').replace(\'<\',\'<\').replace(\'>\',\'>\'); checkString=img+"," if (checker.indexOf(checkString)>-1) { alert("The photo "+img+" was already selected. Please select a different photo."); } else { document.getElementById("upload").style.visibility = "visible"; document.getElementById("cumulativeDiv").style.visibility = "visible"; thisChooser=eval("document.photoaddform.photofile"+counter); thisChooser.style.position="absolute"; thisChooser.style.top=-1000; if (counter<max_per_upload) { nextChooser = eval("document.photoaddform.photofile"+(counter+1)); nextChooser.style.position="relative"; nextChooser.style.top=0; document.getElementById("prompt").innerHTML="Add photo "+(counter+1)+"):"; } else { document.getElementById("prompt").innerHTML=""; } checker+=img+","; var imgsrc = "file:///" + img.replace(/\\/g, "/"); moreHTML="<table width=\'100%\' border=0 cellspacing=0 cellpadding=0><tr bgcolor=#efefef>"+ "<td width=\'10px\'>"+counter+") </td>"+ "<td><img style=\'display: none;\' id=\'img_"+counter+"\' src=\'"+imgsrc+"\' width=60 vspace=2></td>"+ "<td>"+img+"</td>"+ "</tr>"+ "<tr><td><img src=http://s.bebo.com/img/vid.gif width=1 height=1></td></tr>"+ "</table>" var currentHTML=document.getElementById("cumulativeDiv").innerHTML; document.getElementById("cumulativeDiv").innerHTML=currentHTML+moreHTML; if (navigator.appVersion.indexOf("MSIE")!=-1) { var thisImage="img_"+counter; img=img.replace(/\\/g,"|"); var testImage=new Image(); testImage.src=img; if (testImage.height>0) { document.getElementById(thisImage).src=img; } setImage(thisImage,img) } counter+=1; } } setCountTries=0 function setImage(id,path) { path=path.replace(/\|/g,"\\"); var testImage=new Image(); testImage.src=document.getElementById(id).src if (testImage.height<1 && setCountTries<10) { document.getElementById(id).src=path ; setCountTries+=1; 491 path=path.replace(/\\/g,"|"); setTimeout("setImage(\'"+id+"\',\'"+path+"\')",500); } else { document.getElementById(id).src=path; } } </script>';
Any ideas how to fix this? I've already tried to double up the backslashes, as in "path=path.replace(/\\\\/g,"|");".
If you could help that would be great,
Cheers,
Michael Crosbie
-
TO MODERATOR: Please move this post into the forum Regex within PHP
Cheers! -
Hi again,
I tried this
[code] $content = 'ajklsfnkljsanfjkndjsnfadsnfdnjnk {AO_photogallery_cat #100192 } asjkdfnkjadsna'; // This is actually pulled off a database
$variable = '/AO_photogallery_cat #([0-9])\b/';
if(preg_match($variable,$content,$matches)){
echo $matches[1];
} [/code]
But it still doesn't work. -
Hey thanks for replying!
So first what do all the slashes etc mean? I tried reading the PCRE Pattern Syntax but it didn't make much sense.
And what should it be in the content? -
Hi there,
I am trying to use Preg_match to do the following:
[code]$content = 'ajklsfnkljsanfjkndjsnfadsnfdnjnk {AO_photogallery_cat #100192 } asjkdfnkjadsna'; // This is actually pulled off a database
$variable = '{AO_photogallery_cat #[0-9]{6} }';
if(preg_match($variable,$content,$matches){
$var['varivari'] = explode("#",$matches[0]); // Here I am trying to get the number by itself and set it as a variable
$var['varivari'] = substr($var['varivari'][1], -1);
echo $var['varivari'];
} [/code]
Please help me get this preg_match thing to work. I dont understand PCRE Pattern Syntax so if someone could explain the basic concepts that would be fantastic. -
Hi there,
I'm new to OOP and I have a question.
[code] $front_function = new $$class_name;
$front_function->$$prefix_name_front();[/code]
How could I make something like what I've got above work?
Chur,
Michael -
I have got the below code in the database. Why isn't the <script ...> tags working?
[code]<?PHP echo '
<form action="back.php?functid='.$_GET['functid'].'" method="post" enctype="multipart/form-data" name="FormID'.$_GET['functid'].'">
<div id="xToolbar"></div>
<p>Name of page
<input type="text" name="title" />
<br />
Status <br />
<label name="statuslive"><input name="status" type="radio" value="0" /> Live to the public</label><br />
<label name="statusdevelopment"><input name="status" type="radio" value="1" /> Under development</label><br />
Place your page on the tree:<br />
<script type="text/javascript">
<!--
tree = new treemenu(\'tree\', true, true, true, false);
tree.put(1,\'<input type="radio" name="type" value="1"><a> Add page here </a>\',\'_self\',\'\',\'Add page here\',\'\',\'\'); // For use with a form';
$var['spacing'] = "";
$var['level'] = 1;
findView($_GET['functid']);
if(isset($var['viewID'])){
$var['link'] = "front.php?functid=".$var['viewID']."&id={id}"; }
PTLevels($var['link'],'form'); // If you don’t want it for a form replace ‘form’ with ‘’.
echo '
document.write(tree);
//-->
</script>
<br />
Page Description';
$oFCKeditor = new FCKeditor( 'description' ) ;
$oFCKeditor->BasePath = '../fckeditor/';
$oFCKeditor->Height = 300 ;
$oFCKeditor->ToolbarSet = 'Basic';
$oFCKeditor->Value = '' ;
$oFCKeditor->Config[ 'ToolbarLocation' ] = 'Out:xToolbar' ;
$oFCKeditor->Create() ;
echo '<br />
Contents of page<br />
';
$oFCKeditor = new FCKeditor( 'content' ) ;
$oFCKeditor->BasePath = '../fckeditor/';
$oFCKeditor->Height = 300 ;
$oFCKeditor->ToolbarSet = 'Basic';
$oFCKeditor->Value = '' ;
$oFCKeditor->Config[ 'ToolbarLocation' ] = 'Out:xToolbar' ;
$oFCKeditor->Create() ;
echo '
<br />
Template
<select name="template">
';
connectdb('');
$res['templates'] = mysql_query("Select * from DM_templates");
while($row['templates'] = mysql_fetch_array($res['templates'])){
echo '
<option value="'.$row['templates']['id'].'">'.$row['templates']['title'].'</option>
'; }
echo '
</select><br />
Permissions<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr class="table_header">
<td width="100">Permission</td>
<td>Username</td>
</tr>
';
$var['changestyle'] = 2;
$i = 0;
$res['permissions'] = mysql_query("Select * from DM_users where userlevel < '3'");
while($row['permissions'] = mysql_fetch_array($res['permissions'])){
print("<tr ".(!($i%$changestyle)?"class='table_alternative'\"":"").
'><td><input name="permissions[]" type="checkbox" id="permissions[]" value="'.$row['permissions']['id'].'" /></td><td>'.$row['permissions']['username'].'</td></tr>');
$i = $i+ 1;
} echo '
</table>
<input name="permissionscount" id="permissionscount" type="hidden" value="'.mysql_num_rows($res['permissions']).'" />
</p><br />
<div id="form_submit" align="right">
<A HREF="javascript:document.FormID'.$_GET['functid'].'.reset()"><img name="Reset" type="image" id="Reset" alt="Cancel" border="0" src="../images/form_bcancel.png" /></a>
<input name="Submit" type="image" id="Submit" src="../images/form_bnext.png" />
</div></form>';
?>[/code] -
Hi there,
I have PHP in a MySQL entry. I am wanting to spit this out again however the echo function somehow turns the PHP code into html and the PHP is not processed. Can you think of anyway to make it spit out the MySQL entry and run the PHP code that is inside it?
Yours Sincerely,
Michael
JSON + AJAX + PHP
in Javascript Help
Posted
Hi there,
I'm using this code for the front end of an application which has the following features:
- Rename Groups/Categories
- Add Groups/Categories
- Remove Groups/Categories
- Cannot drag and drop certain "leafs" out of one panel
- Reorder leafs
- Add leafs from one panel to another
The problem is however that it didn't come with a backend php/json solution and I know very little about json. Could someone give me some suggestions?
Here is the code here: