Jump to content

aleksanteri

Members
  • Posts

    130
  • Joined

  • Last visited

Posts posted by aleksanteri

  1. Must admit W3Schools was the way I got to real coding...I had been viewing page sources to learn HTML, but my syntax was far from correct, for example, I used <body> in <head> because I thought it was used to define the background color! :) Here I learned CSS, JavaScript, VBScript, PHP and SQL. I would never have been developing my skills in WWW without this site :)I use W3Schools for references for client scripting and PHP. PHP.net I use when I want info on things not on W3S yet or if I need another description when I am like :blink: .EDIT: OOH, almost forgot XML and especially XML:SVG. Really great tutorial. I am just hoping all major browsers would support SVG (OK, Opera supports it by default) by default. Then I could use SVG freely. :)

  2. I have used PHP now for a while and would like to have MySQL with it too, but it looks like I need to compile PHP manually. I had PHP installed in a binary and I have now the source code (the binary is safe still :)) Few questions:- If I have PHP in C:\php-5.1.4\, what is the directory for MySQL? If MySQL doesn't come to the PHP directory, how do I configure PHP to use MySQL?- How do I configure PWS to use PHP?- Where can I get the tool to compile PHP?

  3. Version 5 has some more functions:

    DATE:date_default_timezone_get()date_default_timezone_set()date_sunrise()date_sunset()idate()FILE / DIR:scandir()file_put_contents()fputcsv()FTP:ftp_alloc()ftp_chmod()ftp_raw()ARRAY:array_combine()array_diff_key()array_diff_ukey()array_intersect_key()array_intersect_uassoc()	array_intersect_ukey()array_product()array_udiff_assoc()array_udiff_uassoc()array_uintersect()array_uintersect_assoc()	array_uintersect_uassoc()array_walk_recursive()HTTP:headers_list()setrawcookie()STRING:convert_uudecode()convert_uuencode()fprintf()htmlspecialchars_decode()str_ireplace()stripos()strpbrk()strripos()substr_compare()vfprintf()MISC:time_sleep_until()

    I caught these old release articles with my RSS reader from PHP.net

    The PHP development team is proud to announce the release of PHP 5.1.3. This release combines small number of feature enhancements with a significant amount of bug fixes and resolves a number of security issues. Some of the key changes of PHP 5.1.3 include: Disallow certain characters in session names. Fixed a buffer overflow inside the wordwrap() function. Prevent jumps to parent directory via the 2nd parameter of the tempnam() function. Enforce safe_mode for the source parameter of the copy() function. Fixed cross-site scripting inside the phpinfo() function. Fixed offset/length parameter validation inside the substr_compare() function. Fixed a heap corruption inside the session extension. Fixed a bug that would allow variable to survive unset(). Fixed a number of crashes in the DOM, SOAP and PDO extensions. Upgraded bundled PCRE library to version 6.6 The use of the var keyword to declare properties no longer raises a deprecation E_STRICT. FastCGI interface was completely reimplemented. Multitude of improvements to the SPL, SimpleXML, GD, CURL and Reflection extensions. Over 120 various bug fixes. Further details about this release can be found in the release announcement and the full list of changes is available in the PHP 5 ChangeLog.
    A critical bug with $_POST array handling as well as the FastCGI sapi have been discovered in PHP 5.1.3. A new PHP release 5.1.4 is now available to address these issues. All PHP users are encouraged to upgrade to this release as soon as possible. Further details about this release can be found in the release announcement and the full list of changes is available in the PHP 5 ChangeLog. The tarballs were updated to include the PEAR's phar file, previously missing from the release.
  4. I was just thinking that could EasyPHP be changed with first- installing IIS from Settings \ Add and remove programs \ Add and remove Windows Components \ IIS- installing PHP binary and configuring it with IIS (included in installer)- installing MySQL from www.mysql.com but I don't know about configuring it, quess download just the binaryif it wouldn't be a problemThese links might come in handy: http://en.php.net/get/php-5.1.4-installer.exe/from/a/mirrorhttp://dev.mysql.com/get/Downloads/MySQL-4...2.zip/from/pickI needed the OS because if you were running for example Win98 like me, this trick would need PWS.It is important that you install the server first and select the same server from the list when PHP servers come.This trick worked on my Win98 when I downloaded PWS and PHP binary.

  5. No. W3Schools don't have a feed and I don't think they intend on making one.By the way, I looked at your signature and... do you know Opera has WML support?

    Really? :) got to check that out, but if it really works, I didn't add WML to my NP++ supported user-defined languages for nothing :)
  6. You don't need to use regular expressions, it would be faster to use strpos and test for boolean false for each bot.  Regular expressions would work better if all of the bot strings followed a pattern that browser strings don't, but that's not the case.Here are some lists of bot user agent strings:http://en.wikipedia.org/wiki/User_agent#Botshttp://www.pgts.com.au/pgtsj/pgtsj0208d.htmlYou probably don't need to test for all of them, just choose the 10 or 20 that you see the most in your logs or that are the largest sites.  You would use strpos to test like this:if (strpos($_SERVER["HTTP_USER_AGENT"], "bot") !== false)This statement would be true if the string contains "bot", which would match a lot of different strings.  You would probably just have a pretty big if statement with a condition for each string you want to check for.  Make sure to use !== or === instead of != or ==.

    You could put an empty space to the end and the start of a string and the test. Then you could check whole word:$user_agent = $_SERVER["HTTP_USER_AGENT"];$user_agent = " " . $user_agent;$user_agent .= " ";if(strpos($user_agent, " bot ") !== false)
  7. Has W3Schools or this forum got an rss feed? I just got a free reader and I'm looking for interest feeds (currently got one from PHP Group). Actually I'm just hoping to have my daily digest in feed form... :)

  8. Use a table with no cellpadding and cellspacing.

    <table border="0" cellpadding="0" cellspacing="0"><tr><td><img src="img1.gif" alt="Image" /></td></tr><tr><td><img src="img2.gif" alt="Image" /></td></tr></table>

  9. I understand...What about not giving the menu imgs to divs but to the table tag?

    <table border="0" cellspacing="0"><tr><td id="tojlogo"></td></tr><tr><td id="link_anv_on">Användare</tr></td><tr><td id="link_admin_off"><a href="#" class="linksbutton">Administratör</a></tr></td><tr><td id="link_rapport_off"><a href="#" class="linksbutton">Intressent</a></tr></td><tr><td id="wrapper"></tr></td><tr><td id="wrapper_top"></tr></td></table>

  10. When you write XHTML, is it mandatory to use the XML definition?

    <?xml version="1.0" ?><!DOCTYPE ...><html><head><!-- some things --></head><body><!-- some things --></body></html>

  11. I mean I try to stop the month starting from sunday, you know to make the weekday valid for each date, the empty spaces before "1 June".However, although June 2006 starts from thursday, 1 June on my calendar starts on saturday...I used mktime to update the $timestamp with the new info.I am not able to use getdate(), it returns an assosiative array and my PHP shows me a warning of having constants when I try to use it.

    $getdate = getdate(time());$getdate[mon]

    returns a warning that constant "mon" is undefined...

  12. Hi, i was wondering if you knew the best way to validate a form by mail set up with php. I have got the mail working but want to ensure all fields have been filled and that the email address is a valid one.

    PHP:
    $email = $_REQUEST["email"];$field1 = $_REQUEST["field1"];$field2 = $_REQUEST["field2"];$field3 = $_REQUEST["field3"];$field4 = $_REQUEST["field4"];if(!empty($field1) && !empty($field2) && !empty($field3) && !empty($field14) &&  str_match("@", $email) == "@" && str_match(".", $email))// form valid

    The email can be tricked however.

  13. OK, I'm doing a calendar but I don't know what is wrong on making PHP clear where is the month's first day. My solution was to valiadate each date's week number (0=sunday, 6=saturday).I don't know what is now wrong... it starts from saturday.

    <?php$months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");$daynames = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");$timestamp = time();$month = (isset($_GET["month"])) ? $_GET["month"] : date("F",$timestamp);$year = (integer) (isset($_GET["year"])) ? $_GET["year"] : date("Y",$timestamp) ;$monthname = $month;foreach($months as $index => $temp){	if($temp == $month)		$month = $index;}$timestamp = mktime(0, 0, 0, $month, $year);$days = (integer) date("t", $timestamp);$monthnum = (integer) date("n", $timestamp);?><html><body><form action="date.php" method="GET"><!-- month selector --><select name="month"><?phpforeach($months as $x){	$sel = "";	if($x == $month)		$sel = " selected=\"selected\"";	print("\t<option value=\"$x\" $sel>$x</option>\n");}?></select><!-- year selector --><select name="year"><?phpfor($y = 1970; $y <= 2010; $y++){	$totals++;	$sel = "";	if($y == $year)		$sel = " selected=\"selected\"";	print("\t<option value=\"$y\" $sel>$y</option>\n");}?></select><input type="submit" /></form><table border="1" cellspacing="0" style="text-align: center"><tr><?phpfunction validate_month($weekday_int, $month, $year, $date){	$info_timestamp = mktime(0, 0, 0, $month, $date, $year);		$right_week = date("w", $info_timestamp);		if($weekday_int == $right_week)		return true;	else		return false;}foreach($daynames as $day)	print("\t<th>$day</th>\n");?></tr><?php$cellnum = 0;$datecount = 1;$weekdaycount = 1;for($x = 1; $x <= $days; ++$x){	$cellnum++;	if($datecount % 7 == 1 && $datecount != 1)		print("</tr>\n<tr>\n");	if(validate_month($weekdaycount, $month, $year, $x))	{		print("\t<td>$monthname $x</td>\n");		++$weekdaycount;	}	else	{		print("\t<td> </td>\n");	}	++$datecount;}?></table></body></html>

    thanks for advice.

  14. I found on the XMLDOM tutorial that you can do a test on creating ADO objects."window.ActiveXObject" returns boolean true when the browser is IE (or should be)."(document.implementation && document.implementation.createDocument)" returns true when the browser is Mozilla etc etc.And now comes the coolest part. What if you can test that can it handle it. You can't give support to browser in the "Edit Preferences" section, eh? So:

    <script type="text/javascript">var browser = navigator.appNameif (!window.ActiveXObject && !document.implementation && !document.implementation.createDocument){alert("Your browser will not execute the slideshow script" + '\n' "It must be viewed in either Internet Explorer or Firefox")}</script>

    Note I'm not 100% sure about does this script work, but I think it should work... expect when Opera can return true in "(document.implementation && document.implementation.createDocument)", that might be a bummer that I'm really afraid of.

×
×
  • Create New...