php

How can I work out if a date is on or before today?

My web application consists of library type system where books have due dates. I have the current date displayed on my page, simply by using this: date_default_timezone_set('Europe/London'); $date = date; print $date("d/m/Y"); I have set 'date' as a variable because I'm not sure if it makes a difference when I use it in the IF state...

define batch size, batch period, throttle in swiftmailer

What are the plugins available for the following php parameters in Swiftmailer define("MAILQUEUE_BATCH_SIZE",480); define the length of one batch processing period, in seconds (3600 is an hour) define("MAILQUEUE_BATCH_PERIOD",3600); to avoid overloading the server that sends your email, you can add a little delay between messages th...

PHP: Ajax ignores line foldings in the text

I don't understand why my AJAX script ignores all line foldings. I first type text to the textarea and then put onclick to send button. Here is my AJAX realization: // creating ajax object // ==================== function createRequestObject(){ try { return new XMLHttpRequest() } catch(e) { try { return new ActiveXObject('Msxml2.XMLHTT...

WordPress > microsites use main site's menu (same domain, multiple subdirectories, multiple WP installs)

I have a main site at site.com and several subdirectory "microsites" at site1.site.com, site2.site.com, etc. These are all on the same server. Each site is set up in its own folder under public_html and each with its own separate wordpress install. I'd like for each microsite to share the same top level menu (the page's menu) with the ...

simple jquery fetch from mysql

I am trying to use jQuery with MYSQL and I wrote something like this : <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt; <script> function example_ajax_request() { $('#example-placeholder').html('<p>Loading results ... <img src="ajax-loader.gif" /></...

PNGs alpha transparancy in AS3 - Unknown file-type

Hello there! After whittling down of the options we've encountered a problem with PNG's and ActionScript 3 (AS3). When loading a PNG 8 or PNG 32 with alpha transparancy we're getting the following error reported in Flash:- "Error #2124: Loaded file is an unknown type" Now, we're dealing with some legacy images, and it appears as thou...

Help on preg_match pattern

I want to parse a html content that have something like this: <div id="sometext">Lorem<br> <b>Ipsun</b></div><span>content</span><div id="block">lorem2</div> I need to catch just the "Lorem<br> <b>Ipsun</b>" inside the first div. How can I achieve this? Ps: the html inside the first div have multiple lines, its an article. Th...

Reading a .dat file as "rb" read binary

I have a folder \folder\ above the webroot that contains .php, .inc, .dat files the .php can access the .inc no problem but when the .inc tries to access the .dat using fopen('mydat.dat', "rb"); it gives an error that it can't find mydat.dat inside \folder\myinc.inc Of course it can't find it since .inc is a file not a folder. Why i...

Login in via curl then open that page logged in

I'm trying the following code to send post data to the login form, then reload that page in the browser as a logged in user. somehow it's not saving the cookie, and reusing it for the header() function, can the same thing as header be done by calling curl again after sending the login details? .. $ch = curl_init(); curl_setopt($ch, C...

jQuery Ajax returns the whole page

Dear all, I have a jquery-ajax function that sends data to a php script and the problem is with the return value, it returns the whole page instead of single value. Thank you for your time and help. $("#ajaxBtn").click(function(){ var inputText = $("#testText").val(); $.ajax({ type: "POST", url: "index.php", data: "testAjax="+inputTex...

How do you echo a string with every char in PHP?

I need to know if there's a way in PHP to echo a string with every char. For instance /n and the likes. Edit for clarification: When I have a webform and I submit it and I have this text: I am stupid and I cannot explain myself The text would be like this: I am stupid /n and I cannot /n explain myself If I use: nl2br I g...

how to parse a pdf file using php

Hi, Is there any good php parser to parse pdf files? I have a pdf file with text formatted differently. I want to still maintain that in my output. For example, content in the pdf is like this title content goes here. example is here so I want the text to be parsed preserving the bold tags where ever its used. please let me know. ...

jquery GET and POST confusion

Hi, I am not quiet sure how jquery works. I want to know few things about the GET and POST in terms of jQuery. I use the following code in my app : <script> function example_ajax_request() { $('#example-placeholder').html('<p>Loading results ... <img src="ajax-loader.gif" /></p>'); $('#example-placeholder').load("ind.php?show=" +...

Using SQlite3 in PHP how to count the number of rows in a result set?

currently I am using: $result = new SQLite3(sprintf("users/USERIDS_DB.sqlite")); $numRows = $result->exec ("SELECT count(*) FROM USERIDS"); echo sprintf("the number of rows are: %d", $numRows); but the result is 1 when it should be 6 (the number of rows I created using firefox sqlite3 addon) Can anybody help please? ...

Confused by this PHP Exception try..catch nesting

Hello. I'm confused by the following code: class MyException extends Exception {} class AnotherException extends MyException {} class Foo { public function something() { print "throwing AnotherException\n"; throw new AnotherException(); } public function somethingElse() { print "throwing MyException\n"; throw new ...

drop down box php

I have stored 6 records in mysql db,when i use this code each of the 6 records getting displayed in seprate drop down box,i want them to be displayed in a single drop down box.Where am i going wrong? Any help ii be appreciated. Thnx in advance. http://dpaste.com/hold/180077/ ...

Webbased data modelling and management tool

Is there a web-based tool available, where I am able to... ...define data models (like in a database admin tool) ...fill in data (in custom web forms, not too generic) with basic features like completion ...import data from CSV oder Excel Sheets ...export data to CSV or SQL ...create snapshots of my data models (versions, diff, etc.) ...

php form-input validation

i have a html page in which i enter data which then submits and inserts in a database on a php page. how would i validate in php that the data received is not a duplicate of the data in the database? any help appreciated. ...

Overriding Doctrine_Record (sfDoctrineRecord) instance methods in Doctrine PHP Symfony

My background is in Propel, so I was hoping it would be a simple thing to override a magical getter in a Doctrine_Record (sfDoctrineRecord), but I'm getting either a Segfault or the override method is simply ignored in favor of the one in the superclass. https://gist.github.com/697008eaf4d7b606286a class FaqCategory extends BaseFaqCate...

Loop through values and display in a pdf file

Hello all! i have written the following code: As you can see there is a for loop to go through some values and display them in the generated pdf. The problem is that all the values are being written at the same place. I have tried to insert a new line but it does not seem to work. Can anyone suggest me how i can do it? Do i need to write...