Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
[quote author=Jenk link=topic=104738.msg417927#msg417927 date=1155904584] and mac is strangely \n\r [/quote] I believe Mac is just \r or have I misunderstood something....
-
Noobie Stuff: Very Basics Explained Easily
Daniel0 replied to Pudgemeister's topic in PHP Coding Help
[quote author=simcoweb link=topic=102480.msg416931#msg416931 date=1155748790] Your query line needs brackets. Like this: [code]$sql_1=("SELECT * FROM user_buildings WHERE username == '$username' AND password == '$password'");[/code] Otherwise it thinks it's a string. It's not recognizing it as a valid query. [/quote] Incorrect. You are as a matter of fact defining a string and when passing the query argument to the function you are passing a string. -
Where was this survey taken? I'd like to see that, because I don't really believe that 90% of the internet users have it disabled. Try look at this forum, it uses javascript too (like most other forum systems). Could the site be one of those that show up on this page: http://www.google.com/search?hl=en&lr=&q=%22javascript+haters%22&btnG=Search
-
major php problems with windows server 2003 sp1
Daniel0 replied to DCalabrese's topic in PHP Installation and Configuration
If you use Apache, then try loading it as an Apache module. -
[quote author=jseddon001 link=topic=104511.msg416888#msg416888 date=1155744444] and \n. for line breaks etc. [/quote] A little more explanation: \n = line feed \t = tab \r = carriage return Windows uses \r\n for new lines. Linux uses \n for new lines. Mac uses \r for new lines.
-
[quote author=jcombs_31 link=topic=102991.msg416916#msg416916 date=1155746996] That still doesn't make sense to me. It would work great on a small scale, like a calendar where you know the names of the months and days will be there. But for a complete language transition for all content I don't see how you could possibly do it that way. [/quote] Lots of people (including me) do it. It's not very hard work, as long as you did it from the start. Just add strings as you need them.
-
Do you still have the code there? Because it shows up fine for me. And what it does is that it checks what type of encoding the browser accepts ("gzip", "deflate" or none at all) and then returns the output accordingly. That means if the user's browser supports it, it will compress the content. Try only using [code]ob_start("ob_gzhandler");[/code]
-
Add this to the top of your page: [code]ob_start("ob_gzhandler");[/code] and this on the bottom: [code]ob_end_flush();[/code]
-
I'm not sure if this will work, but try something like: [code]SELECT * FROM whatever WHERE date LIKE '%-month_here-% %:%:%';[/code]
-
Search issues at the main site.
Daniel0 replied to tomfmason's topic in PHPFreaks.com Website Feedback
I get different results depending on the keywords I searched for. Try again, it might work now. -
Included files can include files, and there is no limit on how many times it can be done.
-
Search engines prefer divs over tables since there is less tags, and therefor a smaller amount of data it has to read through.
-
I think that's the point of this forum.
-
This forum is for people to tell their opinion about your site (mostly layout), not for advertisements.
-
[quote author=shocker-z link=topic=104341.msg416239#msg416239 date=1155655622] yeah that's exacly what i want the only problem is that some addresses can be e.g. NG245YW and your script returns NG2-4 instead of NG24-5 Any idea's on how to overcome this? Thatnks for all your input :0 Regards Liam [/quote] Weren't the - supposed to be after the first number ???
-
[quote author=Stuve link=topic=104358.msg416238#msg416238 date=1155655614] Thanx a lot!! :D But one more question.. how to get [b]opendir('.');[/b] to open files in a subfolder?? [/quote] You would need recursion. Example: [code]<?php header("Content-type: text/plain"); function read_contents($directory='.') { if(substr($directory,-1) != '/') { $directory .= "/"; } $contents = @scandir($directory); if(is_array($contents)) { foreach($contents as $item) { if($item != '.' && $item != '..') { echo "{$directory}{$item}\n"; if(is_dir($directory.$item)) { read_contents($directory.$item); } } } } } read_contents("/home/daniel"); ?>[/code]
-
my full code for beginers to be able to have a paying login system.
Daniel0 replied to redarrow's topic in PHP Coding Help
redarrow, this forum is for people who need help, hence the name 'PHP Help'. If you wan't to submit a script, you can do it here: http://www.phpfreaks.com/scripts.php?action=addScript If you still wan't it on the forums, I think [url=http://www.phpfreaks.com/forums/index.php/board,21.0.html]PHP General[/url] would be more appropriate. -
PHP Mail Function Wont Send to Hotmail. HELP ME PLEASE!
Daniel0 replied to scott.russell's topic in PHP Coding Help
Try to check your junk mail folder or whatever it's called in hotmail. -
Exactly. And this line: [code] $images[] = $file;[/code] adds the files to an array. And another way to do this line: [code]$random_file = $images[rand(0,count($images)-1)];[/code] would be: [code]$max_num = count($images)-1; $random_number = rand(0,$max_num); $random_file = $images[$random_number];[/code] but the first way is shorter.
-
[quote author=redarrow link=topic=104356.msg416221#msg416221 date=1155654218] the array is multidiensional as it has two array elements. I think lol......................... looking at king arthur example defintly. [/quote] No, this is a multidimensional array: [code]<?php $array = array( array('hi','hi2','hi3'), 'hi again', ); ?>[/code] Since it have more "dimensions"
-
A modification of your code: [code]<?php $rep=opendir('.'); while ($file = readdir($rep)) { if ($file != '..' && $file !='.' && $file !='' && $file !=is_dir($file)) { $images[] = $file; } } closedir($rep); clearstatcache(); $random_file = $images[rand(0,count($images)-1)]; echo "<img src='{$random_file}' alt='random image' />"; ?>[/code]
-
His array is not multi-dimensional.
-
Use ksort if you wan't to sort the array after the keys. (ksort = key sort)
-
You could move the session_start() function to the top of the other file. When you include your file like that it will become: [code]<html> <head> </head> <body> <?php session_start(); include ("mysql_connect1.php"); if (isset($_REQUEST['submit'])){ $u = $_REQUEST['loginname']; $p = $_REQUEST['pass2']; $hp = md5($p); $query = "SELECT loginname, admin, member, wararranger FROM users WHERE loginname ='$u' AND pass2 = '$hp'"; $result = @mysql_query($query)or die ('Query could not be processed: '.mysql_error()); $row = mysql_fetch_array ($result, MYSQL_NUM); if($row){ $_SESSION['loginname'] = $row[0]; $_SESSION['admin'] = $row[1]; $_SESSION['member'] = $row[2]; $_SESSION['wararranger'] = $row[3]; echo "<p>Welcome,<b> {$_SESSION['loginname']}</b>!</p>"; }elseif(!isset($_SESSION['loginname'])){ echo "<p>Invalid login attempt!</p>"; } } if (isset($_SESSION['loginname'])){ }else{ include ("loginform.php"); } ?> </body> </html>[/code] And as you see, then session_start() is not run before something is sent to output.
-
natsort, sort, ksort. There are plenty to chose from.