Jump to content

MCrosbie

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

MCrosbie's Achievements

Member

Member (2/5)

0

Reputation

  1. 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: <script type="text/javascript" language="javascript"> var TreePanels = function() { // shorthand var Tree = Ext.tree; return { init : function(){ // yui-ext tree var tree = new Ext.tree.TreePanel('tree-div1', { animate:false, loader: false, enableDD:true, containerScroll: true, rootVisible: false }); // set the root node this.root = new Ext.tree.TreeNode({ text: 'ROOT', allowDrug:false, allowDrop:true, id:'1' }); tree.setRootNode(this.root); buildCategoryTree(this.root, [ {"text":"General","id":"51","cls":"folder","allowDrop":true,"allowDrag":true, "children":[ {"text":"name","id":"96","cls":"system-leaf","allowDrop":false,"allowDrag":false,"leaf":true,"is_user_defined":"0","entity_id":"2078"}, {"text":"model","id":"495","cls":"leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"1","entity_id":"2087"},{ "text":"computer_manufacturers","id":"510","cls":"leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"1","entity_id":"2088"}, {"text":"sku","id":"98","cls":"system-leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"0","entity_id":"2079"}, {"text":"weight","id":"101","cls":"system-leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"0","entity_id":"2080"}, {"text":"color","id":"272","cls":"leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"1","entity_id":"2082"}, {"text":"status","id":"273","cls":"system-leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"0","entity_id":"2083"}, {"text":"tax_class_id","id":"274","cls":"system-leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"0","entity_id":"2084"}, {"text":"url_key","id":"481","cls":"system-leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"0","entity_id":"2086"}, {"text":"visibility","id":"526","cls":"system-leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"0","entity_id":"2089"}, {"text":"gift_message_available","id":"562","cls":"system-leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"0","entity_id":"2505"}, {"text":"manufacturer","id":"102","cls":"leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"1","entity_id":"2543"} ] } ]); // render the tree tree.render(); this.root.expand(false, false); tree.expandAll(); this.ge = new Ext.tree.TreeEditor(tree, { allowBlank:false, blankText:'A name is required', selectOnFocus:true, cls:'folder' }); this.root.addListener('beforeinsert', editSet.leftBeforeInsert); this.root.addListener('beforeappend', editSet.leftBeforeInsert); //this.ge.addListener('beforerender', editSet.editGroup); this.ge.addListener('beforeshow', editSet.editGroup); //this.ge.addListener('startedit', editSet.editGroup); //------------------------------------------------------------- var tree2 = new Ext.tree.TreePanel('tree-div2', { animate:false, loader: false, enableDD:true, containerScroll: true, rootVisible: false, lines:false }); // set the root node this.root2 = new Ext.tree.TreeNode({ text: 'ROOT', draggable:false, id:'free' }); tree2.setRootNode(this.root2); buildCategoryTree(this.root2, [{"text":"activation_information","id":"496","cls":"leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"1"},{"text":"country_orgin","id":"507","cls":"leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"1"},{"text":"default_category_id","id":"108","cls":"leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"0"},{"text":"finish","id":"509","cls":"leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"1"},{"text":"gender","id":"501","cls":"leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"1"},{"text":"megapixels","id":"513","cls":"leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"1"},{"text":"room","id":"508","cls":"leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"1"},{"text":"shape","id":"476","cls":"leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"1"},{"text":"shirt_size","id":"525","cls":"leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"1"},{"text":"shoe_size","id":"502","cls":"leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"1"},{"text":"shoe_type","id":"107","cls":"leaf","allowDrop":false,"allowDrag":true,"leaf":true,"is_user_defined":"1"}]); this.root2.addListener('beforeinsert', editSet.rightBeforeInsert); this.root2.addListener('beforeappend', editSet.rightBeforeAppend); this.root2.addListener('append', editSet.rightAppend); this.root2.addListener('remove', editSet.rightRemove); // render the tree tree2.render(); this.root2.expand(false, false); tree2.expandAll(); }, rebuildTrees : function(){ editSet.req.attributes = new Array(); rootNode = TreePanels.root; var gIterator = 0; for( i in rootNode.childNodes ) { if(rootNode.childNodes[i].id) { var group = rootNode.childNodes[i]; editSet.req.groups[gIterator] = new Array(group.id, group.attributes.text, (gIterator+1)); var iterator = 0 for( j in group.childNodes ) { iterator ++; if( group.childNodes[j].id > 0 ) { editSet.req.attributes[group.childNodes[j].id] = new Array(group.childNodes[j].id, group.id, iterator, group.childNodes[j].attributes.entity_id); } } iterator = 0; } gIterator ++; } editSet.req.not_attributes = new Array(); rootNode = TreePanels.root2; var iterator = 0; for( i in rootNode.childNodes ) { if(rootNode.childNodes[i].id) { if( rootNode.childNodes[i].id > 0 ) { editSet.req.not_attributes[iterator] = rootNode.childNodes[i].attributes.entity_id; } iterator ++; } } } }; }(); function buildCategoryTree(parent, config){ if (!config) return null; if (parent && config && config.length){ for (var i = 0; i < config.length; i++) { var node = new Ext.tree.TreeNode(config[i]); parent.appendChild(node); node.addListener('click', editSet.register); node.addListener('beforemove', editSet.groupBeforeMove); node.addListener('beforeinsert', editSet.groupBeforeInsert); node.addListener('beforeappend', editSet.groupBeforeInsert); if( config[i].children ) { for( j in config[i].children ) { if(config[i].children[j].id) { newNode = new Ext.tree.TreeNode(config[i].children[j]); node.appendChild(newNode); newNode.addListener('click', editSet.unregister); } } } } } } var editSet = function() { return { register : function(node) { editSet.currentNode = node; }, unregister : function() { editSet.currentNode = false; }, submit : function() { if( TreePanels.root.firstChild == TreePanels.root.lastChild ) { return; } if( editSet.SystemNodesExists(editSet.currentNode) ) { alert('This group contains system attributes. Please move system attributes to another group and try again.'); return; } if( editSet.currentNode && editSet.currentNode.attributes.cls == 'folder' ) { TreePanels.root.removeChild(editSet.currentNode); for( i in editSet.currentNode.childNodes ) { if( editSet.currentNode.childNodes[i].id ) { child = editSet.currentNode.childNodes[i]; newNode = new Ext.tree.TreeNode(child.attributes); if( child.attributes.is_user_defined == 1 ) { TreePanels.root2.appendChild(newNode); } } } editSet.req.removeGroups[editSet.currentNode.id] = editSet.currentNode.id; editSet.currentNode = false; } }, SystemNodesExists : function(currentNode) { for( i in currentNode.childNodes ) { if( currentNode.childNodes[i].id ) { child = editSet.currentNode.childNodes[i]; if( child.attributes.is_user_defined != 1 ) { return true; } } } }, rightAppend : function(node) { return; }, addGroup : function() { var group_name = prompt("Please enter a new group name",""); if( group_name == '' ) { this.addGroup(); } else if( group_name != false && group_name != null && group_name != '' ) { var newNode = new Ext.tree.TreeNode({ text : group_name, cls : 'folder', allowDrop : true, allowDrag : true }); TreePanels.root.appendChild(newNode); newNode.addListener('click', editSet.register); } }, editGroup : function(obj) { if( obj.editNode.attributes.cls != 'folder' ) { TreePanels.ge.cancelEdit(); return false; } }, save : function() { TreePanels.rebuildTrees(); var _validator = new Validation('set_prop_form', {onSubmit:false}); if( !_validator.validate() ) { return; } editSet.req.attribute_set_name = $('attribute_set_name').value; var req = {data : Ext.util.JSON.encode(editSet.req)}; var con = new Ext.lib.Ajax.request('POST', '?id=save', {success:editSet.success,failure:editSet.failure}, req); }, success : function(o) { var response = Ext.util.JSON.decode(o.responseText); if( response.error ) { $('messages').innerHTML = response.message; } else if( response.url ){ setLocation(response.url); } else if( response.message ) { alert(response.message); } }, failure : function(o) { alert('Unable to complete request. Please try again later.'); }, groupBeforeMove : function(tree, nodeThis, oldParent, newParent) { if( newParent.attributes.cls == 'folder' && nodeThis.attributes.cls == 'folder' ) { return false; } if( newParent == TreePanels.root && nodeThis.attributes.cls != 'folder' ) { return false; } }, rightBeforeAppend : function(tree, nodeThis, node, newParent) { if( node.attributes.is_user_defined == 1 ) { return true; } else { alert('You cannot remove system attribute from this set.'); return false; } }, rightBeforeInsert : function(tree, nodeThis, node, newParent) { var empty = TreePanels.root2.findChild('id', 'empty'); if( empty ) { return false; } if( node.attributes.is_user_defined == 1 ) { return true; } else { alert('You cannot remove system attribute from this set.'); return false; } }, groupBeforeInsert : function(tree, nodeThis, node, newParent) { if( node.allowChildren ) { return false; } }, rightAppend : function(tree, nodeThis, node) { var empty = TreePanels.root2.findChild('id', 'empty'); if( empty && node.id != 'empty' ) { TreePanels.root2.removeChild(empty); } }, rightRemove : function(tree, nodeThis, node) { if( nodeThis.firstChild == null && node.id != 'empty' ) { var newNode = new Ext.tree.TreeNode({ text : 'Empty', id : 'empty', cls : 'folder', is_user_defined : 1, allowDrop : false, allowDrag : false }); TreePanels.root2.appendChild(newNode); } }, leftBeforeInsert : function(tree, nodeThis, node, newParent) { if( node.allowChildren == false ) { return false; } } } }(); function initVars() { editSet.req = {}; editSet.req.attributes = false; editSet.req.groups = new Array(); editSet.req.not_attributes = false; editSet.req.attribute_set_name = false; editSet.req.removeGroups = new Array(); } initVars(); Ext.EventManager.onDocumentReady(TreePanels.init, TreePanels, true); </script>
  2. 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.
  3. 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
  4. 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.
  5. 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
  6. 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,
  7. 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();
  8. Brilliant. Thanks for all your help, it's greatly appreciated.
  9. Worked like a charm! Can you explain the difference that that has made and why it worked?
  10. 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
  11. 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!
  12. 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
  13. 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
  14. 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;
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.