jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
Good for you, next step is to change the html form method from GET to POST.
-
Is there a problem using an array(s) like: $instuments = array(array(1 => "Guitar"),array(2 => "Drums")); 1, it should be the key (id), the Guitar is gonna be the value.
-
Symfony is an enterprise level framework for me and it's not easy to learn. Don't be embarrassed
-
Do you get the value of: function checkusername(){ var u = _("username").value; alert(u); If your answer is - no, you need to show us the restrict() function also.
-
When you're trying to send emails as html document use only inline css, something like: <p style="color: red;">Your Text</p> @pbs, as I can see the Body is a property and should treat a css as a text, I think this is wrong but....I've never used phpMailer before and not sure.
-
Stripping unwanted (extra) </table> tags
jazzman1 replied to qwikaddotcom's topic in PHP Coding Help
For more universal solution, there is a "Freelance Section" to the forum or......I highly recommend you to start learning RegEX, I am a big their fan http://www.regular-expressions.info/ -
Stripping unwanted (extra) </table> tags
jazzman1 replied to qwikaddotcom's topic in PHP Coding Help
If your problem is only "</table>" you can remove all empty spaces between "><" tags then just to remove all "</table" and add just one. Take a look at this, not very elegant solution, b/s don't have a much time but it should work. <?php $str = '<table border="0"> <tr> </td> Some text.... </td> <td> Some text.... </td> </tr> </table> </table> </table> '; $tbl = preg_replace('~>(\s+)?<~', '><', $str); $html = implode('',array_unique(explode('</table>', $tbl))); echo $html.'</table>'; Results: -
Stripping unwanted (extra) </table> tags
jazzman1 replied to qwikaddotcom's topic in PHP Coding Help
Just treat the table content as a simple string, trim the content and remove only this duplicates that you want. -
@DaveyK, do you understand that script or you just copy/paste it from the web?
-
@Liam, how achived that without using a redirect flag? Can you show us your personal testing, please
-
Time Question - How do I set the time to half hours?
jazzman1 replied to toolman's topic in Javascript Help
Create two files on the same directory - datetime.html and dateformat.js. dateformat.js // Date Format Method // copyright Stephen Chapman, 20th November 2007, 19 January 2011 // http://javascript.about.com // permission to use this JavaScript on your web page is granted // provided that all of the code below in this script (including these // comments) is used without any alteration Date.prototype.getMDay = function() { return (this.getDay() + 6) % 7; }; Date.prototype.getISOYear = function() { var thu = new Date(this.getFullYear(), this.getMonth(), this.getDate() + 3 - this.getMDay()); return thu.getFullYear(); }; Date.prototype.getISOWeek = function() { var onejan = new Date(this.getISOYear(), 0, 1); var wk = Math.ceil((((this - onejan) / 86400000) + onejan.getMDay() + 1) / 7); if (onejan.getMDay() > 3) wk--; return wk; }; Date.prototype.getJulian = function() { return Math.floor((this / 86400000) - (this.getTimezoneOffset() / 1440) + 2440587.5); }; Date.prototype.getMonthName = function() { var m = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; return m[this.getMonth()]; }; Date.prototype.getMonthShort = function() { var m = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; return m[this.getMonth()]; }; Date.prototype.getDayName = function() { var d = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; return d[this.getDay()]; }; Date.prototype.getDayShort = function() { var d = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; return d[this.getDay()]; }; Date.prototype.getOrdinal = function() { var d = this.getDate(); switch (d) { case 1: case 21: case 31: return 'st'; case 2: case 22: return 'nd'; case 3: case 23: return 'rd'; default: return 'th'; } }; Date.prototype.getDOY = function() { var onejan = new Date(this.getFullYear(), 0, 1); if (onejan.getDST()) onejan.addHours(1); if (this.getDST()) onejan.addHours(-1); return Math.ceil((this - onejan + 1) / 86400000); }; Date.prototype.getWeek = function() { var onejan = new Date(this.getFullYear(), 0, 1); return Math.ceil((((this - onejan) / 86400000) + onejan.getDay() + 1) / 7); }; Date.prototype.getStdTimezoneOffset = function() { var jan = new Date(this.getFullYear(), 0, 1); var jul = new Date(this.getFullYear(), 6, 1); return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset()); }; Date.prototype.getDST = function() { return this.getTimezoneOffset() < this.getStdTimezoneOffset(); }; Date.prototype.getSwatch = function() { var swatch = ((this.getUTCHours() + 1) % 24) + this.getUTCMinutes() / 60 + this.getUTCSeconds() / 3600; return Math.floor(swatch * 1000 / 24); }; function _daysInMonth(month, year) { var dd = new Date(year, month, 0); return dd.getDate(); } ; Date.prototype.format = function(f) { var fmt = f.split(''); var res = ''; for (var i = 0, l = fmt.length; i < l; i++) { switch (fmt[i]) { case '^': res += fmt[++i]; break; case 'd': var d = this.getDate(); res += ((d < 10) ? '0' : '') + d; break; case 'D': res += this.getDayShort(); break; case 'j': res += this.getDate(); break; case 'l': res += this.getDayName(); break; case 'S': res += this.getOrdinal(); break; case 'w': res += this.getDay(); break; case 'z': res += this.getDOY() - 1; break; case 'R': var dy = this.getDOY(); if (dy < 9) dy = '0' + dy; res += (dy > 99) ? dy : '0' + dy; break; case 'F': res += this.getMonthName(); break; case 'm': var m = this.getMonth() + 1; res += ((m < 10) ? '0' : '') + m; break; case 'M': res += this.getMonthShort(); break; case 'n': res += (this.getMonth() + 1); break; case 't': res += _daysInMonth(this.getMonth() + 1, this.getFullYear()); break; case 'L': res += (_daysInMonth(2, this.getFullYear()) == 29) ? 1 : 0; break; case 'Y': res += this.getFullYear(); break; case 'y': var y = this.getFullYear().toString().substr(3); res += ((y < 10) ? '0' : '') + y; break; case 'a': res += (this.getHours() > 11) ? 'pm' : 'am'; break; case 'A': res += (this.getHours() > 11) ? 'PM' : 'AM'; break; case 'g': var h = this.getHours() % 12; res += (h == 0) ? 12 : h; break; case 'G': res += this.getHours(); break; case 'h': var h = this.getHours() % 12; res += (h == 0) ? 12 : (h > 9) ? h : '0' + h; break; case 'H': var h = this.getHours(); res += (h > 9) ? h : '0' + h; break; case 'i': var m = this.getMinutes(); res += (m > 9) ? m : '0' + m; break; case 's': var s = this.getSeconds(); res += (s > 9) ? s : '0' + s; break; case 'O': var m = this.getTimezoneOffset(); var s = (m < 0) ? '+' : '-'; m = Math.abs(m); var h = Math.floor(m / 60); m = m % 60; res += s + ((h > 9) ? h : '0' + h) + ((m > 9) ? m : '0' + m); break; case 'P': var m = this.getTimezoneOffset(); var s = (m < 0) ? '+' : '-'; m = Math.abs(m); var h = Math.floor(m / 60); m = m % 60; res += s + ((h > 9) ? h : '0' + h) + ':' + ((m > 9) ? m : '0' + m); break; case 'U': res += Math.floor(this.getTime() / 1000); break; case 'I': res += this.getDST() ? 1 : 0; break; case 'K': res += this.getDST() ? 'DST' : 'Std'; break; case 'c': res += this.format('Y-m-d^TH:i:sP'); break; case 'r': res += this.format('D, j M Y H:i:s P'); break; case 'Z': var tz = this.getTimezoneOffset() * -60; res += tz; break; case 'W': res += this.getISOWeek(); break; case 'X': res += this.getWeek(); break; case 'x': var w = this.getWeek(); res += ((w < 10) ? '0' : '') + w; break; case 'B': res += this.getSwatch(); break; case 'N': var d = this.getDay(); res += d ? d : 7; break; case 'u': res += this.getMilliseconds() * 1000; break; case 'o': res += this.getISOYear(); break; case 'J': res += this.getJulian(); break; case 'e': case 'T': break; default: res += fmt[i]; } } return res; } datetime.html <!DOCTYPE html> <html> <head> <title>Date/Time Format</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="dateformat.js"></script> <script type="text/javascript"> var today = new Date(); alert(today.format('l, jS F Y h:i:sa P')); </script> </head> <body> </body> </html> Results: Source - http://javascript.about.com/library/bldateformat.htm You might want to consider using some JS libraries which make this easier for you. -
Wow......very bad code buddy. If this is your first time using SQL in PHP you might want to consider some of the date/time MySQL functions which make this easier for you. Also, never ever run queries in loops.
-
Hey Liam! I've been a professional musicain for more then 18 years - I was a keyboard player. In 1998 I've been working in my country Bulgaria as a delphi programer for a year, but I used to loved women at the time more then the programming , so I decided to continue as musician Anyways....welcome to phpfreaks.com. jazz...
-
You want to run the script from your local machine or from remote one?
-
You have to get all content from this domain and using RegEX to grab only this one that you want to be displayed to your web site - this is my method. If this content is dynamic one and is being changed constantly, you could run the same script multiple times by cron job for example every 10 min to get updates. I've never used CURL in php only in Bash, so check the documention at php.net, there are lots of examples.
-
You want to make 50 HTTP requests to the same domain by CURL getting different content or 50 requests to different domain names?
-
How to get this content through the browser with log in or without it? Run that code and try to get the content from my server. I'm using session_start() and $_SESSION. <?php $testpage = file_get_contents('http://canada.lesno.net/info.php'); echo $testpage;
-
CURL works like a browser, did you try it?
-
Use curl, log in to the remote server and get the content that belongs to this particular user. Another alternative is to use ssh (if the server provide it) to log into it without GUI (graphical user interface) and to get the content by php-cli.
-
I think you should create a new canvas and then to put this two images all together inside it. I've made a quick test and it's work with jpeg: <?php ini_set("display_errors", true); error_reporting(-1); $canvas = imagecreatetruecolor(200, 200); $img1 = imagecreatefromjpeg('images/centos.jpeg'); $img2 = imagecreatefromjpeg('images/redhat.jpeg'); imagecopy($canvas, $img1, 0, 20, 0, 0, 100, 100); imagecopy($canvas, $img2, 0, 10, 0, 0, 100, 100); header('Content-Type: image/jpg'); // ... copy additional source images to the canvas as needed imagejpeg($canvas); PS. I am not familiar with GD
-
You have to know what type of value expect to be the $final variable. Check : echo gettype($final);
-
Not sure where could be the problem but can you put down that on the top of the script: ini_set("display_errors", true); error_reporting(-1)
-
Yes, I am a RegEx fan. http://www.regular-expressions.info/reference.html
-
When I run your script into my server I got next errors: 1. Notice: Use of undefined constant alto_final - assumed 'alto_final' in .... you're using - $escala_2=alto_final/$altooriginal (don't forget a dollar sign) 2. Warning: substr() expects parameter 1 to be string, resource given in ... 3. Warning: copy(): The second argument to copy() function cannot be a directory in ... Double check the script and redesign it, also use a code tags next time, please!