Jump to content

Lokolo

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Lokolo's Achievements

Member

Member (2/5)

0

Reputation

  1. Ok I have been told this before, but in such a way that it just goes right over my head. (I have always learn that " " for strings, ' ' for ints, but I can't use " " so I went for ' ' but this also doesn't work in this case). So for things like SESSION and POST, inside the square brackets, should I always try and use quotes of some sort, but why? Thanks if you can explain in simple Lokolo terms p.s. omg why did i not see it, the lines below have the quotes taken out of them ARGH
  2. http://pastebin.com/m66e4c3a0 I pasted it on there. Now I have counted the {'s brackets and its not that, but I cannot see anything else. I just thought 2+ heads is better than 1. Its line 14 btw. (although my actual page is a lot larger but I thought I only needed that part). Thanks for any help
  3. I am on Vista by the way, just before I explain the problem. ok so I have installed Apache 2.2.4 and this all works (I can get onto http://localhost and it says "It works"). Now I am trying to install PHP 5.2.4 and I put everything correctly to my knowledge, however, at the end of the installation it did say there was a script missing, which is what I was thinking is the problem, so I cannot load PHP files. From a few installation tutorials it seems the PHP should add something to the httpd.conf but I am not sure what, the "Load" thing but I am not sure what the actual command is. Also I have 2x httpd.exe processes running, is this right? (ones 1,856k, the other 4,388k) So anyone could help?
  4. i had tried to return thing but that didn't work either. it was the == thing. thanks everyone
  5. hm i keep doing this. its not even funny anymore. im use to other programming. i'll try that but not sure if it'll work. (as you can see in the other if statement below i did use == rather than = so i do know some things hehe ) i'll try that out
  6. This is my function: function filenamecreator(&$newfilename) { $chars = "abcdefghijkmnopqrstuvwxyz023456789"; srand((double)microtime()*1000000); $i = 0; $newfilename = '' ; while ($i <= 7) { $num = rand() % 33; $tmp = substr($chars, $num, 1); $newfilename = $newfilename . $tmp; $i++; } I can use it in the main program it works however i use it in another function, the code used below $flag = 0; while ($flag = 0) { $flag = 1; filenamecreator($newfilename); $get_otherfilenames = mysql_query("SELECT * FROM logfileinfo"); $num=mysql_numrows($get_otherfilenames); $count = 0; while ( $count < $num ) { $otherfilename = mysql_result($get_otherfilenames, $count, "filename"); if ( $newfilename == $otherfilename ) { $flag = 0; } $count++; } } $add_logfile = mysql_query("INSERT INTO logfileinfo (hotelID, filename) VALUES ('$hotelID','$newfilename')"); However, its not adding $newfilename as anything (i.e. its "") Hope someone can help! Thanks
  7. ah. they user doesn't upload it. I create it! i create and update the log. the only things they can do are download and upload. the only thing I can now think of is create a MySQL table with the hotelID and Encryption i create the encryption completely randomly, check if one already exists (just incase), and then store it. hotelID Encryption 1 ab5nsj478sn 2 384jfn39jd0 3 83ncnc93j9 so files would be ab5nsj478sn.txt , 384jfn39jd0.txt, 83ncnc93j9.txt then when updating/downloading etc. I can just get the encyrption from the table. Thoughts? (I would use your code but I am not exactly experienced! )
  8. Ok so I have some code case "Download Log": echo "Downloading... <br><br>"; rename("$_SESSION[hotelID].txt", "log.txt"); //download file break; but I am not sure how to get it to download the file. (on the //download file bit). _____________________ the next thing. as you can see from the above the files are based around the hotelID. how can I stop people typing www.url.com/1.txt and then gaining access to the files? (if this is possible) - I was thinking of having the hotelID go through some sort of algorithm like (*56 + 50)*4 to make the file name (so ID 1 would be file 424.txt - am I thinking correctly? If so how could I encrypt it better, such as adding letters to the name. _____________________ Wow long, should be simple enough for the uber programmers, thanks, Lokolo
  9. Passing by refence is done by putting an & sign in the fucntion define i.e. function(&$variable) { } will pass it back. for anyone that wants to know.
  10. I can't figure out how to do it. so if i have this code $count = 5; somefunction($count); echo "$count <br>"; -------------------- somefunction($count) { $count = 1000; } but obviously the echo will print off 5, not 1000, which is what I want. w3schools goes on about the return syntax but that only works when the function is returning 1 value! hope you can help (and understand what I am on about), Lokolo
  11. ok will try that. however, i got it to work by removing the echo "$_SESSION[totalcost] <br>"; echo "$_SESSION[funds] <br>"; statements, as a PHP Expert (you seem to be answering everyones questions with ease) why could this be?! [edit] your way worked. hm i deleted a few statements and it didnt work again, so used yours, and harruh!
  12. echo "$_SESSION[totalcost] <br>"; echo "$_SESSION[funds] <br>"; IF ( $_SESSION[funds] < $_SESSION[totalcost] ) { echo "You do not have enough cash to upgrade <br>"; } ELSE { echo "Upgrading... <br>"; } Output: 75,000 622,500 You do not have enough cash to upgrade I have no idea why. What reasons could it be?
  13. indeed - i tried that but it then just goes back to the first form. obviously that value of submit is wiped as soon as i touch the 2nd form. (if you understand me) not sure how i can get around this though
  14. ok basically i have 2 forms, one shows up at the start, that gets submitted and the page refreshes wth the 2nd one. however, i cannot figure how to submit the 2nd one as the forms are both submit forms. (basically once i submit the first one, it then goes to the elses of both. i can get the 2nd form to display if i change the 2nd !isset($_POST['submit']) to something else but then i can't submit that one) <? if (!isset($_POST['submit'])) { ?> <h2> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" onsubmit="return checkSubmit(this);"> Number of Rooms: <input type="text" size="3" multiple style="height: 20px" maxlength="2" name="numrooms"> <input type="submit" name="submit" value="Upgrade"> </form> </h2> <? } else { upgradehotel($_POST['numrooms']); if (!isset($_POST['submit'])) { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" onsubmit="return checkSubmit(this);"> <input type="submit" name="confirm" value="Yes"> <input type="submit" name="confirm" value="No"> </form></h2> <? } ELSE { echo "work damnit work"; } ?> heh thanks!
×
×
  • 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.