Jump to content

myrddinwylt

Members
  • Posts

    84
  • Joined

  • Last visited

    Never

Everything posted by myrddinwylt

  1. For this table assuming it's name is "food" id food_id weight 1 1050 cup, tbsp 2 1050 oz 3 1053 tbsp 4 1058 cup 5 1058 cup,oz 6 1069 oz 7 1070 tbsp 8 1071 fluid 9 1078 tbsp Try SELECT * FROM `food` WHERE `weight` NOT LIKE '%oz%';
  2. This is gonna look like someone puked, but here goes I need to get the Account ID, Account Balance, and Account Status from this messy html I have attached (This amount of html is only displaying 10 records with very basic information --- OmniWare is poo!) I will be doing this for several thousand pages, so having a regex solution that can get this information out would be ideal. Thanks [attachment deleted by admin]
  3. Is there a faster way to do this ? UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.45 * `TotalTime`), `Location`='Maldives - Intl Premium Services' WHERE `OrigDestDigits` LIKE '0119600900900%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.35 * `TotalTime`), `Location`='Switzerland - Mobile' WHERE `OrigDestDigits` LIKE '0114186077357%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.17 * `TotalTime`), `Location`='Sweden - Mobile' WHERE `OrigDestDigits` LIKE '011467672673%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.35 * `TotalTime`), `Location`='Switzerland - Mobile' WHERE `OrigDestDigits` LIKE '011418607731%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.35 * `TotalTime`), `Location`='Switzerland - Mobile' WHERE `OrigDestDigits` LIKE '011418607730%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.65 * `TotalTime`), `Location`='Bulgaria - Temp' WHERE `OrigDestDigits` LIKE '011359881540%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.3 * `TotalTime`), `Location`='Azerbaijan - Mobile' WHERE `OrigDestDigits` LIKE '01199460540%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.3 * `TotalTime`), `Location`='United Kingdom - 44118343' WHERE `OrigDestDigits` LIKE '01144118343%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.3 * `TotalTime`), `Location`='United Kingdom - 44118181' WHERE `OrigDestDigits` LIKE '01144118181%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.3 * `TotalTime`), `Location`='United Kingdom - 44118178' WHERE `OrigDestDigits` LIKE '01144118178%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.3 * `TotalTime`), `Location`='United Kingdom - 44118006' WHERE `OrigDestDigits` LIKE '01144118006%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.3 * `TotalTime`), `Location`='United Kingdom - 44118005' WHERE `OrigDestDigits` LIKE '01144118005%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.26 * `TotalTime`), `Location`='Austria - Mobile' WHERE `OrigDestDigits` LIKE '01143650040%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.26 * `TotalTime`), `Location`='Austria - Mobile' WHERE `OrigDestDigits` LIKE '01143650035%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.26 * `TotalTime`), `Location`='Austria - Mobile' WHERE `OrigDestDigits` LIKE '01143650020%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.35 * `TotalTime`), `Location`='Switzerland - Mobile' WHERE `OrigDestDigits` LIKE '01141860777%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.35 * `TotalTime`), `Location`='Switzerland - Mobile' WHERE `OrigDestDigits` LIKE '01141860774%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.35 * `TotalTime`), `Location`='Switzerland - Mobile' WHERE `OrigDestDigits` LIKE '01141860772%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.4 * `TotalTime`), `Location`='Switzerland - 41773112' WHERE `OrigDestDigits` LIKE '01141773112%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.25 * `TotalTime`), `Location`='Latvia - Mobile' WHERE `OrigDestDigits` LIKE '01137168502%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.25 * `TotalTime`), `Location`='Latvia - Mobile' WHERE `OrigDestDigits` LIKE '01137168501%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.65 * `TotalTime`), `Location`='Bulgaria - Temp' WHERE `OrigDestDigits` LIKE '01135988297%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.12 * `TotalTime`), `Location`='Cyprus - Mobile' WHERE `OrigDestDigits` LIKE '01135712399%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.12 * `TotalTime`), `Location`='Cyprus - Mobile' WHERE `OrigDestDigits` LIKE '01135712397%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.12 * `TotalTime`), `Location`='Cyprus - Mobile' WHERE `OrigDestDigits` LIKE '01135712196%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126263969%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126263968%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126263967%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126263966%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126263965%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126263961%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126263960%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126263940%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126263919%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126263911%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126263910%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126263909%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126263900%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126226969%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126226968%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126226967%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126226966%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126226965%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.3 * `TotalTime`), `Location`='Mayotte - Other' WHERE `OrigDestDigits` LIKE '01126226964%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.3 * `TotalTime`), `Location`='Mayotte - Other' WHERE `OrigDestDigits` LIKE '01126226963%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.3 * `TotalTime`), `Location`='Mayotte - Other' WHERE `OrigDestDigits` LIKE '01126226962%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.3 * `TotalTime`), `Location`='Mayotte - Other' WHERE `OrigDestDigits` LIKE '01126226961%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126226919%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126226911%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.55 * `TotalTime`), `Location`='Mayotte - Mobile' WHERE `OrigDestDigits` LIKE '01126226910%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.14 * `TotalTime`), `Location`='Israel - Mobile' WHERE `OrigDestDigits` LIKE '0119721535%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.14 * `TotalTime`), `Location`='Israel - Mobile' WHERE `OrigDestDigits` LIKE '0119721515%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.24 * `TotalTime`), `Location`='Honduras - Mobile' WHERE `OrigDestDigits` LIKE '0115047252%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.24 * `TotalTime`), `Location`='Honduras - Mobile' WHERE `OrigDestDigits` LIKE '0115047251%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.24 * `TotalTime`), `Location`='Honduras - Mobile' WHERE `OrigDestDigits` LIKE '0115047250%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.24 * `TotalTime`), `Location`='Honduras - Mobile' WHERE `OrigDestDigits` LIKE '0115047240%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.24 * `TotalTime`), `Location`='Honduras - Mobile' WHERE `OrigDestDigits` LIKE '0115047219%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.24 * `TotalTime`), `Location`='Honduras - Mobile' WHERE `OrigDestDigits` LIKE '0115047218%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.24 * `TotalTime`), `Location`='Honduras - Mobile' WHERE `OrigDestDigits` LIKE '0115047217%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.24 * `TotalTime`), `Location`='Honduras - Mobile' WHERE `OrigDestDigits` LIKE '0115047216%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.24 * `TotalTime`), `Location`='Honduras - Mobile' WHERE `OrigDestDigits` LIKE '0115047215%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.24 * `TotalTime`), `Location`='Honduras - Mobile' WHERE `OrigDestDigits` LIKE '0115047214%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.19 * `TotalTime`), `Location`='United Kingdom - O2 Mobile' WHERE `OrigDestDigits` LIKE '0114478937%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.19 * `TotalTime`), `Location`='United Kingdom - O2 Mobile' WHERE `OrigDestDigits` LIKE '0114478936%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.19 * `TotalTime`), `Location`='United Kingdom - O2 Mobile' WHERE `OrigDestDigits` LIKE '0114478935%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.19 * `TotalTime`), `Location`='United Kingdom - O2 Mobile' WHERE `OrigDestDigits` LIKE '0114478934%' AND `TotalCost` IS NULL; UPDATE `cdrtemp`.`taqua` SET `TotalCost`=(0.19 * `TotalTime`), `Location`='United Kingdom - O2 Mobile' WHERE `OrigDestDigits` LIKE '0114478932%' AND `TotalCost` IS NULL; There are approximately 4000 UPDATE statements which are generated based off another table by the length of the dialed code DESC ... so "0114478932" would come before "011447893" for example. If "011447893" came before "0114478932", then the UPDATE would be incorrect as the cost of "011447893" and "0114478932" could be different. Currently, this process takes about 3 hours where the recordset for `cdrtemp`.`taqua` is around 500,000 records.
  4. I believe I have the concept of what you are trying to accomplish. You wish to either have that table repeat on the same page, broken down with headers "Monday, Tuesday, ....", or you wish to have a header accross the top, and choose the day. Either of those options would require a different mechanism for storing information in the database. This does seem to be something that could be fairly intense.
  5. Hello, Try replacing the way you are checking the contents of the field as follows: Current empty($_POST['username']) Replace with trim($_POST['username'] . "") != "" The . "" is a bit redundant, but I have had some cases where I needed to use that to ensure no errors. It's really out of laziness ^.^ trim Will remove any of the trailing spaces, so the string will be truncated. != "" means that the value is not Short and sweet, should fix your problem. EDIT: In the future, you might want to put a subject which is more descriptive of your problem than "HELP", or such. In this case, a good subject would be something like "IF statements not processing"
  6. Well, First thing. There is no where in your code to recieve any data as to which item the user has selected. PHP is a server side language and does not "talk" to client side, so anything the user is doing in the browser (click boxes, choosing select menu items, etc), PHP does not know this is happening, unless you send that information back to the server such as SOAP, Ajax, or a simple form POST/GET. To retrieve the value of POST or GET, you can simply use the following in the event that the field name is "yourvarname" // retrieving a POST variable $myphpval = $_POST['yourvarname']; // retrieving a GET variable $myphpval = $_REQUEST['yourvarname']; Then, you can modify your code such as the following: <?php require_once('config.php'); $query="SELECT domenii.nume, domenii.id FROM domenii INNER JOIN inregistrari ON domenii.email_1=inregistrari.email_1"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_assoc($result)) { $id_ales=$row['id']; $nume_ales=$row['nume']; } $select_box="SELECT nume,id FROM domenii"; $result2 = mysql_query ($select_box); echo "<select name=id_domeniu>"; echo "<option selected='selected' value='$id_ales'>$nume_ales</option>"; while($nt=mysql_fetch_array($result2)){ if($nt[id] != $myphpvar ) { echo "<option value=$nt[id]>$nt[nume]</option>"; } } echo "</select>"; ?> Which of course you would need to redraw your form. You could use an AJAX form POST, and have the response as the new form. This should help you with the PHP side of things anyway. For AJAX and such, I would suggest checking out jQuery, but that would be more for appearance than functionality ( aka, you wouldn't necessarily see a page refresh when reloading the form, depending on how the javascript code is setup).
  7. Could you please elaborate. From what I can tell, it looks like this is part of a scheduling function, and the code you really need to look at is more in the table class which isn't displayed here. You may need to do a trace through your code where something is being defined, go and review that function/class in whichever file it's located. The population of the current day is not really clear here either, so if you wrote the code, please define where you are putting the current day in, or highlighting the day... whatever this function is doing ^.^ Thanks
  8. Hello, Here is a very simple way to get this done // Define final day -- if this is less than the $startdate, then I am not sure what will happen ^.^ $enddate = "2010-12-25"; // Calculation of difference between now, and the end date $startdate = time(); $enddate = strtotime($enddate); $diff = $enddate - $startdate; $days = ceil($diff / 86400); // Output total echo $days;
  9. ohdang888, Thank you for the compliment ^.^ The gap is something I put there by design to ensure the footer doesn't come up to the middle part of the page when the actual page doesn't contain very much content (see the Videos page as an example of a page that would fall short). So inside the stylesheet, I set min-height on the actual whitespace in the middle (body texts). If you have a suggestion on how I could do this another way, I am open to ideas. Thanks again
  10. A website I designed for one of my larger clients. There are still a couple of areas under development (some text, and pricing badges). Base template is from http://www.dreamtemplate.com, however it has been dissected, and re-assembled in pieces from scratch, so only the original concept of layout remains. The entire code base is completely different. HTML files actually exist on the server in the exact location being loaded, however, those "real" html files only contain the body text which is editable in a WYSIWYG in the backend. The legal agreements are automatically filled out, essentially, I have created a simple system that my clients can edit the text of their website, and create new pages, but never deal with any code, or even see the structure their content is going into, complete with legal agreements. Please take a look at the Rates page, and any advice on optimizing that as it does run a bit slower than desired (260 images for the flags --- perhaps a method to combine them and shift the image which I don't know how to do). Rapidtel International - New Site (under construction and would like you to review) Also, the sign-up page which is designed from scratch, and uses phpmailer on the backend to send messages off to the person signing up, and to the administration (with BCC internally), of more personal and unique details of the form completion. The current site while this is going through the final stages of development is located here Rapidtel International - Live Site (to be replaced)
  11. Thankfully, I have never done <?phpphp Nor would I ever use <?php= The shortcode i did <? Was more the result of 38 hours of programming with no sleep, so I got a bit lazy on a couple of my opening tags, since I enabled the support in the php.ini file to allow for that (you would be suprised at how many commercial and open source projects use the short tag... which is why I enabled the support in the first place --- doing a search & replace in all files for "<?" would result in "<?phpphp" as you stated above. Much easier to simply enable short codes, and since ASP is something that will never work on php ..... "<?" and "<%" should work just peachy if enabled. Now im gonna have to read that whole php.ini file again to locate where the hell short-code support is, as I need to re-enable it for 3rd party app support. (Ridiculous, but some apps that are encoded with IONCUBE, like to use short-codes in the encrypted code, or protected areas). Cheers, and thanks again
  12. You could also modify the way the timestamp is formatted. From what it looks like, it is in 24 hour format, in which case 04:00 is 4am, and 08:00 is 8am. Switch the format to use either of the following formats 04:00:00 PM / 08:00:00 AM h:i:s A OR 16:00:00 / 08:00:00 H:i:s When formatting date/time in PHP, the characters used are case sensitive. Hours, Minutes, and Seconds, in 12 hour format without AM/PM are meaningless, especially when doing calculations. In 24 hour format, the math and appearance is much cleaner, and simpler.
  13. msaz87 is correct. To elaborate a bit, in your MySQL database, create a unique index column which is auto-incremented of type integer. You can then have that as the checkbox id on the html form when you retrieve the records. From there, it's a simple matter of having buttons that post to a page <input type=submit name=delete> <input type=submit name=update> Then on the post page switch ($_POST['submit']) { case "delete": // do delete stuff here break; case "update": // do update stuff here break; } I presently don't recall how to loop through checkboxes that have been posted, but I am sure that information is pretty easy to find if you search the site.
  14. This is what works for me. The problem is the "open" mime type exceeds the 60 character limit. case "docx": $type = "application/msword"; break;
  15. With the .htaccess problem, Try replacing it with Options -Indexes ErrorDocument 206 /error.php?p=error&err=206 ErrorDocument 301 /error.php?p=error&err=301 ErrorDocument 302 /error.php?p=error&err=302 ErrorDocument 400 /error.php?p=error&err=400 ErrorDocument 401 /error.php?p=error&err=401 ErrorDocument 403 /error.php?p=error&err=403 ErrorDocument 404 /error.php?p=error&err=404 ErrorDocument 408 /error.php?p=error&err=408 ErrorDocument 500 /error.php?p=error&err=500 ErrorDocument 501 /error.php?p=error&err=501
  16. I think I just realized the problem as you correctly inquired into. In some of my classes I got lazy and was using the short code to open PHP with <? instead of <?php . Where is this set again in the php.ini. It has literally been 2 years since I mucked about in it, and now I have a 70kb ini, instead of my 30kb ini, because of the insanity of comments XD. Thanks again
  17. The more complicated code in question is as follows: config.inc.php <?php $webserver["path"] = "c:/server/websites"; // Path without trailing slash $webserver["theme"] = "basic"; // Choose the webserver admin template $webserver["wysiwyg"] = "false"; // Default mode for editing html files (true = WYSIWYG on) $webserver["statspath"] = "C:/Program Files (x86)/AWStats/wwwroot/cgi-bin"; $webserver["editfiles"] = "conf,js,txt,sql,php,html,htm,pl,cgi,css,tpl,log,htpasswd,htaccess"; // Editable file types $dns['enabled'] = false; // Enable SimpleDNS server support (true/false) $dns['server'] = "127.0.0.1"; // SimpleDNS Server $dns['user'] = ""; // SimpleDNS Username $dns['pass'] = ""; // SimpleDNS Password $dns['port'] = 53; // SimpleDNS Port $filetypes['ext'] = split(",","bmp,dll,doc,exe,gif,hlp,html,ini,java,jpg,list,mpg,pdf,php,pps,ppt,reg,ttf,txt,xls,zip"); // Supported file types $mail['enabled'] = false; // Enable Merak Mail server support (true/false) $mail['path'] = "c:/program files/merak"; // Set to Merak Mail server path include("classes/template.php"); $template = new template($webserver["path"],$webserver["theme"]); ?> viewcsr.php <? if(!isset($webserver["path"])){ include("config.inc.php"); } if($_POST["submit_x"]) { $domain = $_POST["domain"]; $csr = file_get_contents($webserver["path"]."/".$domain."/certs/certificate.csr"); $data = $template->read("viewcsr2","Certificate Request for ".$domain); $data = str_replace("#domain#",$domain,$data); $data = str_replace("#csr#",$csr,$data); print $data; } else { $fields = ""; if (is_dir($webserver["path"])) { if ($dh = opendir($webserver["path"])) { while (($file = readdir($dh)) !== false) { if (is_dir($webserver["path"] ."/". $file)) { switch ($file) { case ".": break; case "..": break; default: if($file != "127.0.0.1") { if(file_exists($webserver["path"]."/".$file."/certs/certificate.csr")) { $fields .= "<p> <input id=\"domain\" type=\"radio\" name=\"domain\" value=\"".$file."\"> ".$file."</p>"; } } break; } } } closedir($dh); } } if($fields == "") { $data = $template->read("viewcsr-blank","View Certificate Requests"); } else { $data = $template->read("viewcsr","View Certificate Requests",""); $data = str_replace("#FIELDS#",$fields,$data); } print $data; } ?> template.class.php <?php class template { var $path = ""; var $theme = ""; public function __construct($path, $theme) { $this->path = $path; $this->theme = $theme; } function readfull($name,$title='',$body='') { $info = file_get_contents($this->path."/127.0.0.1/htdocs/templates/".$this->theme."/".$name.".html"); if($title==''){ $title = "Web Server Pro"; } else { $title = "Web Server Pro :: ".$title; } $info = str_replace("#TITLE#",$title,$info); if($body!=''){ $info = str_replace("#BODY#",$body,$info); } return $info; } function read($name,$title='',$body='',$header='',$fields='') { $info = file_get_contents($this->path."/127.0.0.1/htdocs/templates/".$this->theme."/header.html"); if($title==''){ $title = "Web Server Pro"; } else { $title = "Web Server Pro :: ".$title; } $info = str_replace("#TITLE#",$title,$info); $info = str_replace("#HEADER#",$header,$info); $info .= file_get_contents($this->path."/127.0.0.1/htdocs/templates/".$this->theme."/".$name.".html"); if($body!=''){ $info .= $body; } if($fields!=''){ $info = str_replace("#FIELDS#",$fields,$info); } $info .= file_get_contents($this->path."/127.0.0.1/htdocs/templates/".$this->theme."/footer.html"); return $info; } function status($name,$scriptname='',$timer=0,$title='',$message='',$secondtemplate='') { $info = file_get_contents($this->path."/127.0.0.1/htdocs/templates/".$this->theme."/header.html"); if($title==''){ $title = "Web Server Pro"; } else { $title = "Web Server Pro :: ".$title; } $info = str_replace("#TITLE#",$title,$info); if($timer>0) { $info = str_replace("#HEADER#","<meta http-equiv='refresh' content='".$timer."; url=".$scriptname."'>",$info); } else { $info = str_replace("#HEADER#","",$info); } $info .= file_get_contents($this->path."/127.0.0.1/htdocs/templates/".$this->theme."/".$name.".html"); $info = str_replace("#MESSAGE",$message,$info); if($secondtemplate) { $info .= file_get_contents($this->path."/127.0.0.1/htdocs/templates/".$this->theme."/".$secondtemplate.".html"); } $info .= file_get_contents($this->path."/127.0.0.1/htdocs/templates/".$this->theme."/footer.html"); return $info; } } ?> openssl.class.php <?php class openssl { var $path = ""; var $pathopenssl = ""; var $privatekey = ""; var $publickey = ""; var $csr = ""; var $domain = ""; var $certificate = ""; // public function __construct($path, $domain, $private='', $public='', $csr='', $signed='') { public function __construct($path, $domain) { $this->path = $path; $this->pathopenssl = str_replace("/websites","/bin/openssl.cfg",$path); $this->domain = $domain; } function save() { file_put_contents($this->path."/".$this->domain."/certs/certificate.key",$this->privatekey); file_put_contents($this->path."/".$this->domain."/certs/certificate.csr",$this->csr); if($this->publickey) { file_put_contents($this->path."/".$this->domain."/certs/certificate.pub",$this->publickey); } if($this->certificate) { file_put_contents($this->path."/".$this->domain."/certs/certificate.crt",$this->certificate); } } function save_public() { file_put_contents($this->path."/".$this->domain."/certs/certificate.pub",$this->publickey); } function save_private() { file_put_contents($this->path."/".$this->domain."/certs/certificate.key",$this->privatekey); } function save_signed() { file_put_contents($this->path."/".$this->domain."/certs/certificate.crt",$this->signed); } function save_csr() { file_put_contents($this->path."/".$this->domain."/certs/certificate.csr",$this->csr); } function save_cert($certificate) { file_put_contents($this->path."/".$this->domain."/certs/certificate.crt",$this->certificate); } function getprivatekey($password='') { $key = openssl_get_privatekey($private,$password); openssl_private_decrypt($key,$newsource,$res); } function generate_csr($country='CA',$state='Ontario',$locality='Oshawa',$organization='Organization',$organizationunit='IT Department',$domain='127.0.0.1',$email='admin@127.0.0.1') { $dn = array( "countryName" => $country, "stateOrProvinceName" => $state, "localityName" => $locality, "organizationName" => $organization, "organizationalUnitName" => $organizationunit, "commonName" => $domain, "emailAddress" => $email ); $config = array("config"=>$this->pathopenssl); $privkey = openssl_pkey_new($config); openssl_pkey_export($privkey, $private, null, $config); $csrnew = openssl_csr_new($dn, $privkey, $config); openssl_csr_export($csrnew, $csr); // while ($msg = openssl_error_string()) // echo $msg . "<br />\n"; // var_dump(openssl_pkey_get_private(array($private,""))); $this->privatekey = $private; $this->csr = $csr; $keys = array("private"=>$private, "csr"=>$csr); return $keys; } function generate_signed($country='CA',$state='Ontario',$locality='Oshawa',$organization='Organization',$organizationunit='IT Department',$domain='127.0.0.1',$email='admin@127.0.0.1', $days=365) { $dn = array( "countryName" => $country, "stateOrProvinceName" => $state, "localityName" => $locality, "organizationName" => $organization, "organizationalUnitName" => $organizationunit, "commonName" => $domain, "emailAddress" => $email ); $config = array("config"=>$this->pathopenssl); $privkey = openssl_pkey_new($config); $csrnew = openssl_csr_new($dn, $privkey, $config); $sscert = openssl_csr_sign($csrnew, null, $privkey, $days, $config); openssl_x509_export($sscert, $certificate); $pubkey = openssl_pkey_get_public($certificate); $public = openssl_pkey_get_details($pubkey); openssl_pkey_export($privkey, $private, null, $config); openssl_csr_export($csrnew, $csr); $this->certificate = $certificate; $this->privatekey = $private; $this->publickey = $public["key"]; $this->csr = $csr; $keys = array("private"=>$private, "csr"=>$csr, "certificate"=>$certificate,"public"=>$public["key"]); return $keys; } } ?> When browsing to viewcsr.php it should be displaying a form, but instead, it's going really wonky and displaying the following: read("viewcsr2","Certificate Request for ".$domain); $data = str_replace("#domain#",$domain,$data); $data = str_replace("#csr#",$csr,$data); print $data; } else { $fields = ""; if (is_dir($webserver["path"])) { if ($dh = opendir($webserver["path"])) { while (($file = readdir($dh)) !== false) { if (is_dir($webserver["path"] ."/". $file)) { switch ($file) { case ".": break; case "..": break; default: if($file != "127.0.0.1") { if(file_exists($webserver["path"]."/".$file."/certs/certificate.csr")) { $fields .= " ".$file." "; } } break; } } } closedir($dh); } } if($fields == "") { $data = $template->read("viewcsr-blank","View Certificate Requests"); } else { $data = $template->read("viewcsr","View Certificate Requests",""); $data = str_replace("#FIELDS#",$fields,$data); } print $data; } ?>
  18. Hello, Opening and closing PHP tags are as follows: <?php The PHP code is in here ?>
  19. Hello, Try changing "index" to the page name like this: if (isset($_GET['p'])) { $p = "error"; } else { $p = "index"; } And require "includes/menu.php"; require_once "pages/" . $p . ".php"; You could also optimize your If statement above by either using a switch/case, or an array and doing a search in the array for the page value, then returning based on the index, the description value as you have defined. $errors = array( 0 => 'An unknown error has occurred.<br /><br />If you reached this site via a bookmark, please note that the addresses of all pieces on this site changed in July 2010 and bookmarks must be updated to reflect our new format. We apologize for the inconvenience.', 404 => 'Document not found. Please check the URL and try again.', 206 => 'Partial content.', 301 => 'Document moved permanently.', 302 => 'Document found in another location.', 400 => 'Bad request.', 401 => 'Authorization required to access the requested area.', 403 => 'Access forbidden.', 408 => 'Request timed out. Please try again.', 500 => 'Internal server error.', 501 => 'Request type not supported.' ); $error = $_REQUEST['err']; if(!array_key_exists($error,$errors)) { $error = 0; } $errorText = $errors[$error];
  20. Hello, I decided to give php 5.3.2 another go: Got it working for the most part if I don't care about 100 of the 130 extensions available. Strange problem: $v = new test(); echo $v->testfunction(); class test() { function testfunction() { return "hello"; } } Any reason why the above code doesn't work on PHP 5.3.2 ? Did something change with the way classes are declared ? I have also tried: $v = new test; echo $v->testfunction(); class test { function testfunction() { return "hello"; } } By all rights and logic, this code should output "hello" to the browser, but instead nothing happens. I first noticed this problem with a much more complex class include which I have made regarding the creation of openssl certificates and such, and managed to break the problem down to the above -- it's simplest form. Please note that all of my classes work without error under PHP 5.2.8.
  21. Hello, Positive, that was not the reason. See, small problem with these distros, php should be installed in the same path where the apache bin is for optimal integration. Apache 2.2.15 with SSL support includes libeay32, and whatnot, and so does php. Also, MySQL requires that exact edition of libmysql.dll, and such to be in the php folder. Anyway, I have all of this stuff working PROPERLY using apache 2.2.15, MySQL 5.2, and php 5.2.8 with ALL extensions loadable. Was just hoping that there would be a simple way to upgrade to 5.2.3 for the new functions, optimizations, etc, but alas.... distro is still poo, and I don't remember who I got to help me with a PROPER WINDOWS compile. PHP 5.3.2 is clearly different to compile, and the distro doesn't work (try to load php_mhash.dll, or php_mbstring.dll for example --- epic fails.... EVEN ON A BOX WITH NOTHING BUT PHP!!!! Uncomment only php_mbstring.dll, crash!!). It would seem that the mystery of having a decent production copy of PHP remains unsolved almost a decade since PHP was released. --- And still..... "why not just download the zip" .... or "why do you want to compile on windows" ... well... my rehtoric is.... "why does the source not include everything needed to compile" ..... and ..... "why do YOU want to compile on linux" ... the answers to those questions, well... they don't really answer the real question! Compile PHP on Windows with ALL Necessary support!! PECL is horribly outdated windows compiles, the PHP sources do not contain all the libraries needed to compile (libpng, libjpg, etc) -- nor does any documentation state where and how those libraries are to be included / located .... not to mention downloading them 1 by 1 .... seriously.... why such a friggin headache ?.... The compile CAN be done ... in fact... it's done automatically on php.net, just they are jerks who don't want to release the code and / info on how it is being done. I can compile a kernel faster and easier than this!!! Hell, I can compile the entire sources for Windows CE easier .... I'm seriously pissed about this man as I keep coming back to the same problem and still, no one has resolved it where there are hundreds of thousands of people asking this very same thing .... The documentation seriously blows when it comes to this. I will give you an example on good compile information: Google for How to compile ManGOS for Windows. It's simple... and same instructions..... Install VC 2008 express or whatever edition + windows sdk --- download source from svn.... open project file.... select Release ... then Build Project. And what do you know.... IT WORKS!! ... Do the same instructions for PHP ... well... no project file.... it wants bison.exe, and other weird stuff as well... ok... so you get those. Now you try to compile, and whats this... almost every extension is missing a library. FAIL!!! All those libraries are open source, and any distro of sources should include at least the libraries of what was needed and/or instructions where to get them and where they should be placed in the source tree and/or any other source changes that may be required to do this. ---- But it doesn't. I'm just gonna roll back to PHP 5.2.8 and to hell with 5.3+++++++ Faster to write any of the "new" functions myself, and i can live with a few bugs. I may even switch back to .NET since PHP still can't get their damn act together. Would miss apache, but hey.... 99% of my headache would be gone with buggy lacking distro's. Rant aside, any help in getting this job done would be appreciated. And if done well enough, I would even be willing to cut a cheque!! Convince PHP.net to make a proper ZIP distro ---- even better !! ... Peace out.
  22. Hello, If you use PayPal, or something similar, and your cart supports it, then no, you would not need to generate a CSR, then buy, configure, and install an SSL certificate on your server. (yes it can be that complicated). If you use someone like Moneris, then your will need to do all of the above, and make sure that your shopping cart supports them. Some carts will claim they support that merchant, yet havn't updated that payment processor plugin in a long time.
  23. This post is part rant, part question. First ... the rant as this needs to be said === badly. What is it with the poorly built distributions for windows. - No updated PeCL Libraries - No proper downloadable zip containing everything needed to run the included extensions - The MSI installer contains more extensions than the ZIP does - Major changes to the php.ini need to be overwritten with a more bloated php.ini, then dissected for hours running through more comments than functions -- the functions are clearly defined -- no need to have 25 lines to comment "this is the mysql section". Alternatively, you can download a *amp project which is another over-bloated distro which due to customizations makes it a real pain in the arse to setup a more complicated server such as virtual hosting with virtual subdomains, and such and so forth, and still --- the extensions are nerfed. Latest and greatest problem :: Freshly download "STABLE" (tried all 5.3 Stable Editions on a clean Virtual Machine), extensions such as "php_mhash.dll", and many more.... maybe i will take an hour or so and analyze all the missing extensions -- are missing. "php_mhash.dll" is included in the MSI Installer --- but.... not in the zips. Next, try to load "php_mbstring.dll" --- needed for internal language crap, and wham...... CLI error if running "php" in the command prompt -- no error log... nothing... just CLI Error. Now starting apache trying to load "php_mbstring.dll" --- apache has caused an exception and is now closing.... .WTF ?? I understand this is "OpenSource" ... so.... lets try to compile this junk and make a REAL copy on windows --- well... now.... DOCUMENTATION SUCKS!! --- Best doc I found is this http://wiki.php.net/internals/windows/stepbystepbuild .... which is great --- except it doesn't work!! General statements at the beginning make it so Installed Visual Studio 2008 Team Suite + Windows SDK, and any other SDK I could grab that seemed somewhat relevent --- still no build --- WHY you ask ?? Well.. simple.... missing crap ... a whole lot of crap. But I guess the author of that wiki covered it under #2 above "Prebuilt libraries and headers for third party libraries that PHP uses in the correct location". What prebuilt libraries ?... well... I found some of them here http://wiki.php.net/internals/windows/libs . Not the most convenient to download, but, I have them all thanks to a great app called HTTRack (a site ripper). Now what ?... Where do I extract these billions of files to ... just a random location inside the PHP SRC folder ?.... doubtful . And then.... to end it all off --- Anytime I see a simple question posted online --- ANYWHERE --- it's flagged with no answer... just another question "Why do you want to compile on windows" ... or .... "Just download the ZIP from PHP.NET" .... ideal to just download the ZIP, but no good if it doesn't work properly. My question is this... and any of these would be a great answer: 1. What is the precise data and installation of developer tools, OS, etc required for a successful build of PHP without missing anything -- and if necessary, what libraries need to be downloaded, and where do they go in the PHP SRC tree, with whatever modifications, tools, etc necessary to compile. AKA -- If the PHP SRC is good, then I want a solution that will 100% Compile --- so pick the OS, Tools, Etc, to compile PHP For Windows, and explain how it should be done step by step. I don't care what is used to compile, as I own pretty much everything development wise. OR 2. Do you know of a good clean 5.3.2 up to date x86 build that doesn't segfault, which has built in support for all of the above, including the horribly outdated PECL (thanks php.net for damning that project to source includes only !!, or the latest windows zip from early 2008). Thank you (ps. I really hate that all the big players except for MySQL make these wonderful MSI files which include a crapload more than their ZIP distros. Why don't they just do flat compiles, and zip that ... and ONLY that... not make it available only in the MSI )
  24. The problem C:\linux\src\php-5.3.2>nmake > c:\nmake.txt Microsoft (R) Program Maintenance Utility Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. ext\pcre\php_pcre.def ext\sqlite\php_sqlite.def MC: Compiling win32\build\wsyslog.mc NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN \cl.exe"' : return code '0x2' Stop. I have attached the log file. [attachment deleted by admin]
  25. Hello, I have setup a fresh install of Windows XP inside of a VMWare Virtual machine, running my spare license of Visual Studio 2008 Team Suite (free from microsoft conference -- w00t). Anywho, I have done the following for the configuration and am encountering a small problem which I will explain after documenting all the steps for a fresh windows compile since the documentation is very lacking on the internet. 1. Install Windows XP fresh SP2 2. Install Visual C++ 2008 (Express, Pro, Enterprise, Team Suite .. take your pick) 3. Download bison.exe + flex.exe and copy to your Windows system folder (or any folder you have setup in your path environment) 4. Copy the following files: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\msobj80.dll C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\mspdb80.dll C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\mspdbcore.dll C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\mspdbsrv.exe to C:\Program Files\Microsoft Visual Studio 9.0\VC\bin 5. Open up a command prompt, and run C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat 6. Inside the same command prompt, navigate to where you have extracted the source, and run buildconf.bat 7. Inside the same command prompt, run configure --enable-one-shot --enable-zts --enable-apache2-2filter --enable-apache2-2handler --with-curl --enable-fileinfo --enable-mbstring --enable-mbregex --with-openssl --with-sqlite3 --with-mysql --with-mysqli --enable-pdo --with-pdo-mysql --with-pdo-mssql --with-pdo-odbc --with-pdo-sqlite --with-pdo-sqlite-external --enable-soap --with-sqlite --with-xmlrpc --with-xsl --enable-exif --enable-sockets --with-mhash --with-imap --enable-intl --with-pspell --with-snmp 8. Inside the same command prompt, run nmake ============================================================================= Now this is where I have a small problem. Which I will post in the next message to keep these instructions seperate.[/code]
×
×
  • 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.