Jump to content

Linjon

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Linjon's Achievements

Member

Member (2/5)

0

Reputation

  1. Thank's. By the way, how can i edit post ? Can't find "edit" button :/
  2. Hello, i'm stuck with if, else if and else. My script doesn't work (no errors but doesn't work). I think problem is in this part: //if username not found, insert that if (!$row){ mysql_query("INSERT INTO `users` (username, password, access, created, expired, days) VALUES('$username', '$password', '$access', '$created', '$expires', '$days')"); echo $reply1; } //if user have same "access" else if ($access == $accessCurrent){ mysql_query("UPDATE `users` (username, password, access, created, expired, days) VALUES('', '', '', '', '$expiresNew', '')"); echo $reply2; } //if user haves different "access" else{ mysql_query("INSERT INTO `users_2` (username, password, access, created, expired, days) VALUES('$username', '$password', '$access', '$created', '$expires', '$days')"); mysql_query("UPDATE `users` (username, password, access, expired, days) VALUES('', '', '$accessNew', '')"); echo $reply3; } If you know what's wrong then tell me
  3. Thanks Alex. I have question again. If there is "a" in $variable1 and also there is "a" in $variable2 then it will echo "aa". How to make it show "a" once ?
  4. Hello. How to make two variables to alphabet? Example: $variable1 = ace $variable2 = bd and script makes abcde Hope you understand, sorry for my bad English
  5. Exactly! Thanks for code. How to make it with two variable? changevariable.php: <html> <body> <form method="post"> <table> <tr><td>Name:</td><td><input type="text" name="name"></td> </tr> <tr><td>Age:</td><td><input type="text" name="age"></td> </tr> <tr><td><input type="submit" value="Submit" name="submit"></td></tr> </table> </form> </body> </html> <?php $defaultname = "nothing"; $defaultage = "0"; $age = $_POST['age']; $name = $_POST['name']; $fileContents = file_get_contents('vanafail.php'); $newFile = str_replace($defaultname, $name, $fileContents); $newFile = str_replace($defaultage, $age, $fileContents); file_put_contents('oldfile.php', $newFile); ?> oldfile.php: <?php $defaultname = "nothing"; $defaultage = "2"; ?> But that changes only AGE :/
  6. So i made new topic as some people wanted I have this script and i have file called "oldfile.php". There is variable $age = "0" but i want to change that via form. How to make that? <html> <body> <form method="post"> <table> <tr><td>Age:</td><td><input type="text" name="age"></td> </tr> <tr><td><input type="submit" value="Submit" name="submit"></td></tr> </table> </form> </body> </html> if (isset($_POST['submit'])) { $myFile = "oldfile.php"; $fh = fopen($myFile, 'w') or die("can't open file"); $age = $_POST['age']; fwrite($fh, $access); fclose($fh); echo "Done!"; } ?>
  7. Nah, can do it here too So, anyone know how to make that?
  8. I have some more questions but i will write these here. How can i edit php file via php? <html> <body> <form method="post"> <table> <tr><td>Age:</td><td><input type="text" name="age"></td> </tr> <tr><td><input type="submit" value="Submit" name="submit"></td></tr> </table> </form> </body> </html> if (isset($_POST['submit'])) { $myFile = "oldfile.php"; $fh = fopen($myFile, 'w') or die("can't open file"); $age = $_POST['age']; fwrite($fh, $access); fclose($fh); echo "Done!"; } ?> Example: in oldfile.php should have age = "24"
  9. Wow, so fast. Thanks, it worked!
  10. Hello. How to make script that adds number to name? Something like that: <?php $random = rand(10, 50); $name1 = "Jack"; $together = ($name1 + $random); ?> $together must be without space, example: jack32 Thanks!
  11. Hello. I made 2 php files, echo.php and variable.php. echo.php: <?php include ('variable.php'); echo "Random number is: $variable"; ?> variable.php: <?php function genRandomString() { $length = 10; $characters = ’0123456789abcdefghijklmnopqrstuvwxyz’; $string = ”; for ($p = 0; $p < $length; $p++) { $string .= $characters[mt_rand(0, strlen($characters))]; } return $variable; } ?> And here is the question. Why echo showing only "Random number is:" ? Where is the problem?
  12. Linjon

    php time

    Added but now Parse error: syntax error, unexpected T_VARIABLE
  13. Hi. I have problem with my script on line 35 Here is line 35: endtime = time() + (60 * 60 * 24 * 15); Hope someone can fix it
  14. mysql_fetch_array didn't solve that
  15. Problem: Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in change.php on line 13 My code: <?php $username = $_POST['username']; $password = $_POST['password']; $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("game", $con); //Do a query to get the results of the current logged in user $query = mysql_query("SELECT * FROM users WHERE username = ".$_POST['username'].""); $row = mysql_fetch_assoc($query); $oldpassword = $_POST['oldpassword']; if(sha1($oldpassword) == $row['password']) { //Or whatever encryption it is (sha1 I put in) //go along with the rest of the code you already have. } else { echo 'You current password entered is incorrect'; } mysql_query("UPDATE `game`.`users` SET `password` = '$password' where `username` = '$username'"); ?>
×
×
  • 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.