Jump to content

Huijari

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Everything posted by Huijari

  1. Sorry if this is wrong place, I did not see anything else. So I have this on the .htaccess: RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?sub\.site\.net RewriteCond $1 !^sub/ RewriteRule ^(.*)$ sub/$1 [L] It works very well, except when you type in url eg. sub.site.net/folder Then it will change the url to sub.site.net/sub/folder But it works fine if you type sub.site.net/folder/ You can see the trailing slash on end. Is there any solutions for this?
  2. It works but, well if you test the url I showed, you see it won't get those variables. I think its because there should be &var1=something but there isnt.
  3. So I have code: foreach($_REQUEST as $var => $value) { echo '&' . $var . '=' . $value . "&"; } I would need to to do urldecode() to all REQUEST (posted variables) How would I do it? Because my url is: http://www.finsite.net/testi/example1/example2/get_level.php?levelcode2=%26var1%3D403%26var2%3D254%26varname%3Dvariable And I need to get those vars in php. Have to put somekind of code urldecode(_REQUEST) all requests...
  4. nevermind, go it fixed with using instead of this $array[$plays] = $level; this $array[$level] = $plays;
  5. That code is supposed to sort all the levels by number of $plays thats why cant use that
  6. So I have a code: //Example there are 2 levels with same number of plays (3 plays) $array[$plays] = $level; // at the end of code krsort($array,SORT_NUMERIC); If it now takes level with 3 plays, it adds it to array but when next level with same plays comes, it comes in array as it. My code is to sort these levels so that level with most plays is first. Here's what I mean: $array[3] = level1; // next time $array[3] = level2; I tried this: if ($array[$plays]=="") { $array[$plays] = $level; } else { $array[$plays+1] = $level; } But it won't work because if you have 3 levels with plays 3,3 and 4, and level with 4 plays comes first to array Then when comes 3, its ok But then the next 3, it adds 1 to it, so its 4, but there is already array[4] so it won't work
  7. thanks, works like a dream. This really helps me with my project
  8. If I have array with keys [1] [12] and [25] So when I use ksort($array) it will set first 1, then 12 and last 25. I want it to act like it sets first 25, then 12 then 1 So when 1 its at the end, when big its first in array. How to do this?
  9. So here's my code: I want it to do so if there is variable &number=5& in textfile1.txt and &number=8& in textfile2.txt then it should sort it textfile2 first in array and textfile1 next... $array = array(); // Open the local directory $Directory = opendir("."); // Read each file name while ($filename = readdir($Directory)) { // Deconstruct the file name to get the file suffix in lowercase $temp = explode(".", $filename); $fileSuffix = strtolower(end($temp)); // Only add to list if it ends in 'txt' if ($fileSuffix == "txt") { $file = file_get_contents($filename); // SOME CODE TO HERE THAT SEARCH VARIABLES FROM TXT FILES AND SORT BY ITS SIZE // like there is variable &number=5& in textfile1.txt and &number=7& in textfile2.txt // then it should sort it so textfile2.txt is first then textfile1.txt and so on.. // here below it just adds it in array for the last $addfile = pathinfo($filename, PATHINFO_FILENAME); array_push($array, "$addfile"); } } // Close directory closedir($Directory);
  10. Thank you so much Monkeh. I am not so good with PHP, I thought it would automatically loop. Thanks a lot
  11. Ok, so I previously posted a problem and got fix on it. Unfortunately I found that my script doesn't work like I want it to do. Here's the code: if(!file_exists($file)){ $fh=fopen($file, 'w'); if ($iii>0) { fwrite($fh,"&s" .$iii. "x=$x_coord2,&s" .$iii. "y=$y_coord'w'\n"); $iii -1; } else { fclose($fh); echo "<br/>"; echo "ok<br/><br/>"; } Ok, so now $iii is number 3 for example. And if its greater than 0, it will write to file. But it should do fwrite 3 times, always when $iii -1; It should do this 3 times: fwrite($fh,"&s" .$iii. "x=$x_coord2,&s" .$iii. "y=$y_coord'w'\n"); And all 3 would be same but $iii in then would be 3,2,1 So how to do it so, it always return to do fwrite if $iii is greater than 0?
  12. Thank you so much jl5501! This really helps me with my project.
  13. Hello, so this is my code: $iii=$_REQUEST['iii']; $x_coord=$_REQUEST['word'$iii]; echo "$iii"; echo "$x_coord"; So example: I type url: mysite.com/pathtomyphpfile.php?iii=3&word3=27 Then it should echo: 3 (iii) and 27 (x_coord) Because it should request word+iii so, word3 that is 27 Tell me what I am doing wrong. I hope this is possible because its important for my project.
  14. Hello, so this is my code: if ($act=="changeattrib") { echo"<center><form method=post action=?act=permission&te=$te&path=$dir><FONT SIZE=2 COLOR=#00000>Change $te perms</FONT><BR><input type=hidden name=u value=\"$te\"><input type=radio name=no value=0555>Chmod 555<BR><input type=radio name=no value=0666>Chmod 666<BR><input type=radio name=no value=0777>Chmod 777<BR><input type=submit value=Change> <a href='?dir=$dir'>Cancel</a></form></center>"; } if ($act=="permission") { $v=chmod("$root$path/$u",$no); echo "<center>$te has been CHMOD $v<BR><A HREF=?&dir=$path>Return</A></center>"; } The thing that is not working, is the $no. When I run that script it will change the file's permission to 1411. And it will echo: index.html has been CHMOD 1. So would be nice if someone would see the bug in radio button's script's.
  15. ... the problem is that it doesn't do anything. There is no error but it is not working. And the problem is in that code...
  16. Hi, can you tell me what is wrong with my code? Nobody wants to help me $result = mysql_query("SELECT * from webid_auctions where closed = '1' and sold = 'n' and user ='" . $user->user_data['id'] . "'", $conn); Thank you
  17. Please could you post the fixed php code here? I have tried to use you things but I am maybe not understanding
  18. I am not sure do I understand... But firstly when I replace this: $numlot = mysql_num_rows($result); for ($i = 0; $i < $numlot; $i++) { // SAVE THEM IN ARRAY $lot[$i] = mysql_result ($result, $i, "id"); $title[$i] = mysql_result ($result, $i, "title"); $duree[$i] = mysql_result ($result, $i, "duration"); $B_Now[$i] = mysql_result ($result, $i, "buy_now"); $prix[$i] = mysql_result ($result, $i, "minimum_bid"); } TO THIS: while ($row = mysql_fetch_assoc($result)) { $lot[] = $row['id']; $title[] = $row['title']; $duree[] = $row['duration']; $B_Now[] = $row['buy_now']; $prix[] = $row['minimum_bid']; } Then there is nothing in the list ( There should be seen some items, (auctions)) And do you mean I have to move this: $result2 = mysql_query("update webid_auctions set starts = '$a_start' where id = $lot[$i]", $conn); $result1 = mysql_query("update webid_auctions set ends = '$a_end' where id = $lot[$i]" , $conn); $result3 = mysql_query("update webid_auctions set closed = '0' where id = $lot[$i]", $conn); $result4 = mysql_query("update webid_auctions set relisted = '$n_relist' where id = $lot[$i]" , $conn); To under the if (count($relist) > 0) Please help I am not the best with php.
  19. Ok I tried this: $numlot = mysql_num_rows($result); for ($i = 0; $i < $numlot; $i++) { // SAVE THEM IN ARRAY $lot[$i] = mysql_result ($result, $i, "id"); $title[$i] = mysql_result ($result, $i, "title"); $duree[$i] = mysql_result ($result, $i, "duration"); $B_Now[$i] = mysql_result ($result, $i, "buy_now"); $prix[$i] = mysql_result ($result, $i, "minimum_bid"); } CHANGED TO THIS: while ($row = mysql_fetch_assoc($result)) { $lot[] = $row['id']; $title[] = $row['title']; $duree[] = $row['duration']; $B_Now[] = $row['buy_now']; $prix[] = $row['minimum_bid']; } It is still saying the same:
  20. Yes I have read it but I am not sure how to use it for this...
  21. Please help me! Could you maybe explain using the mysql_fetch_assoc
  22. Hi, in my php file, it gets data from flash (.swf) file and then post the data in .txt file. When I type example: läääd Then php should code it to utf-8 and send it in .txt file as utf-8 encoded. But for some reason, it sends it as läääd in .txt file.. it should be like sääd (then it would work) Please help me get special chars (åäö..áóí...)
  23. Ok I did. Now it says: Parse error: syntax error, unexpected T_LOGICAL_OR in /home/a5292922/public_html/bulk_relist_auctions.php on line 55 That line: $resulti = mysql_query("select * from webid_auctions where id = $lot[$i]", $conn); What could be wrong?
  24. It is saying this: Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/a5292922/public_html/bulk_relist_auctions.php on line 83 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/a5292922/public_html/bulk_relist_auctions.php on line 84 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/a5292922/public_html/bulk_relist_auctions.php on line 85 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/a5292922/public_html/bulk_relist_auctions.php on line 86 Those lines are: mysql_free_result($result1); mysql_free_result($result2); mysql_free_result($result3); mysql_free_result($result4); And could you help me with that mysql_fetchassoc()
  25. Hello again... Something is wrong with this PHP code, can't figure out what is it ... Getting mysql_free_result error ... and maybe something else <?php print("<html>"); print("<head>"); print("<title>Auction Bulk Relisting Tool</title>"); print("</head>"); print("<body bgcolor=\"#FFFFFF\" link=\"#800080\" vlink=\"#400040\" alink=\"#8E85CF\">"); print("<div align=\"center\">"); print("<table width=580>"); print("<tr>"); print("<td align=\"CENTER\" width=200>"); print("<img src=\"LOGO.GIF\"></td></tr></table><BR>"); // change or remove previous line for LOGO //connect to the database $conn = mysql_connect("localhost","myusername","mypass"); mysql_select_db("mydatabase" , $conn); $desc=array(); $prix=array(); $duree=array(); $B_Now=array(); $title=array(); $lot=array(); // check if update mode if (isset($_GET['action']) && $_GET['action'] == "update") { // each auction # to relist if (count($relist) > 0) { $nlot = count($relist); for ($i = 0; $i < $nlot ; $i++) { // relist selected auctions $lot[$i] = $relist[$i]; $resulti = mysql_query("select * from webid_auctions where id = $lot[$i]", $conn); $duration = mysql_result($resulti, 0, "duration"); $closed = mysql_result ($resulti, 0, "closed"); $n_relist = mysql_result ($resulti, 0, "relisted") + 1; $a_start = time(); // start right now $a_end = $a_start + (($duration * 24 * 60 * 60) + ($i * 300)); // add 5 minutes to end time between auctions thus the $i*300 mysql_free_result($resulti); $result2 = mysql_query("update webid_auctions set starts = '$a_start' where id = $lot[$i]", $conn); $result1 = mysql_query("update webid_auctions set ends = '$a_end' where id = $lot[$i]" , $conn); $result3 = mysql_query("update webid_auctions set closed = '0' where id = $lot[$i]", $conn); $result4 = mysql_query("update webid_auctions set relisted = '$n_relist' where id = $lot[$i]" , $conn); print (" AUCTION \"$relist[$i]\" has been relisted successfully<BR>"); } } else { echo " NEED TO MAKE AT LEAST ONE SELECTION - use BACK button and select"; } mysql_free_result($result1); mysql_free_result($result2); mysql_free_result($result3); mysql_free_result($result4); exit; } // LIST OPTION if (!isset($_GET['action']) && $_GET['action'] != "update") { // LOOK UP CLOSED AUCTIONS NOT RELISTED AND UNSOLD $result = mysql_query("select * from webid_auctions where closed = '1' and num_bids = '0' ", $conn); // HOW MANY FOUND $numlot = mysql_num_rows($result); for ($i = 0; $i < $numlot; $i++) { // SAVE THEM IN ARRAY $lot[$i] = mysql_result ($result, $i, "id"); $title[$i] = mysql_result ($result, $i, "title"); $duree[$i] = mysql_result ($result, $i, "duration"); $B_Now[$i] = mysql_result ($result, $i, "buy_now"); $prix[$i] = mysql_result ($result, $i, "minimum_bid"); } print("<h1>CLOSED AUCTIONS <BR></H1><table BORDER=\"1\" CELLPADDING=\"2\" ALIGN=\"Center\">\n"); print("<tr>\n"); print("<td><p ALIGN=\"Center\"><font COLOR=\"#ff0080\">select</font></td>\n"); print("<td><p ALIGN=\"Center\"><font COLOR=\"#ff0080\">Title</font></td>\n"); print("<td><p ALIGN=\"Center\"><font COLOR=\"#8000ff\">Price</font></td>\n"); print("<td><p ALIGN=\"Center\"><font COLOR=\"#ff0080\">Buy Now</font></td>\n"); print("<td><p ALIGN=\"Center\"><font COLOR=\"#ff0080\">Days</font></td>\n"); print("<FORM action=\"http://www.mysite.net/bulk_relist_auctions.php\">"); // change to your URL print("<INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\"update\">"); for ($i = 0; $i < $numlot; $i++){ print("<tr>\n"); print("<td><input type=\"checkbox\" name=\"relist[]\" value=\"$lot[$i]\"> </td>\n"); print("<td>$title[$i]</td>\n"); print("<td>$prix[$i]</td>\n"); print("<td>$B_Now[$i]</td>\n"); print("<td>$duree[$i]</td>\n"); print("<td>"); } print("</TR></TABLE><INPUT TYPE=\"SUBMIT\" VALUE=\"Submit Form\">"); print("<INPUT TYPE=\"RESET\" VALUE=\"Reset Form\">"); print("</FORM>"); } ?>
×
×
  • 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.