PHP - Moved: Onchange Function Will Change The Value Of Php
This topic has been moved to JavaScript Help.
http://www.phpfreaks.com/forums/index.php?topic=330989.0 Similar TutorialsThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=320136.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=305968.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=333787.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=323252.0 Hi guy, Does any know how to add a variable value to the name of a function in a loop e.g. Code: [Select] $i=1; while($qryRowName = mysql_fetch_assoc($qryName)){ $i++; function test$i(){ ***** } Is this possible? Please any help will be very much aprreciated Thanks } Hi there I'm a newbie to all of this so please be gentle! I am starting up my own online business and I am feeling my way through PHP. I have been doing ok so far but I'm having problems with the "change your password" function. I change the password, I receive a reactivation email, but when I try to log in with the new password it hasnt changed. Code I'm using as follows: <?php // process.php include 'config.php'; if(isset($_POST['changepassword'])) { $current = trim($_POST['current']); $new = trim($_POST['new']); $confirm = trim($_POST['confirm']); $pw = md5($current); $query = mysql_query("SELECT * FROM Users WHERE Password = '$pw' LIMIT 1") or die(mysql_error()); if(mysql_num_rows($query) > 0) { while($row = mysql_fetch_array($query)) { if ( $_POST['new'] == $_POST['confirm'] ) {}else{ echo '<script>alert("Your passwords were not the same, please enter the same password in each field.");</script>'; echo '<script>history.back(1);</script>'; exit; } $password = md5($new); $do = mysql_query("UPDATE Users SET Password = '$password' WHERE Password = '$pw' LIMIT 1") or die(mysql_error()); $dotwo = mysql_query("UPDATE Users SET Activated = 0 WHERE Password = '$password' LIMIT 1") or die(mysql_error()); $send = mail($row['Email'] , "Password changed" , "Your password has been changed to: ".trim($_POST['new'])."\n\nYou can change it again via the members only panel, but first you must re-activate your account:\nhttp://www.infinite-monkey.co.uk/activate.php?id=".$row['Actkey']."\n\nDo not reply to this email, it is automated. Thanks." , "From: auto@mailer.com"); if((($do)&&($dotwo)&&($send))) { echo '<script>alert("Password changed. You will now be logged out and you must re-activate your account, check your email, a confirmation email has been sent.");</script>'; echo '<script>location.replace("logout.php");</script>'; exit; } else { echo '<script>alert("There appears to have been an error in the script. 1 or 2 of 3 things may have happened:\n\n• Your password could have been reset/changed\n• Your account could have been deactivated, see the resend validation email page\n• Your email may not have been sent.\n\nYou will now be logged out, if you are not able to login, reset your password using the form, or resend the validation email to activate your account again.\n\nWe are sorry for the inconvenience.");</script>'; echo '<script>location.replace("logout.php");</script>'; exit; } } } else { echo '<script>alert("Incorrect password.");</script>'; echo '<script>history.back(1);</script>'; exit; Hi all , here is a question about a disabled button . If I have a button: Code: [Select] <input id='submit' type='submit' disabled='disabled' value='submit'> Is it possible to change the "disabled=true" through php function ? such as Code: [Select] function change_button(){ echo "<script language=\"javascript\">"; echo "document.getElementById('submit').disabled=true;"; echo "</script>"; } I tried it , not working...is this function possible or have I make any mistake ? Thanks for every reply . I used the move_uploaded_file function to upload files to my server ,but the function changes the Arabic names of files because most of my files are Arabic named
how can I fix that ?
I wrote a bunch of code just to realize that there's a huge security hole in my script. Here's a how I've built it: 1. first you enter the new email address into the input box and click submit 2. an email gets sent to you where you have to click on an activation link to confirm the change, and of course the email gets send to the inbox to make sure it's a valid email the activation link looks as follows: Code: [Select] http://localhost/changeemail_confirm.php?id=$dbuser_id&email=$user_email The dbuser_id gets taken from the session variable, and the user email is the new entered user email. 3. After clicking the link you get directed to an activation page, I thought about letting the user enter his password and letting it match with the password in the database as added security, so he can't just change the user_id in the link so that the email of another user gets changed. the query on the activation page looks like this: "UPDATE user SET email = '$user_email' WHERE nickname = '$dbuser_name' AND WHERE user_id = '$id'"; The $id is being taking from the activation link per GET, and the $dbuser_name is being taking from the session variable. And now this is the problem where I'm stuck, even though I've added a bunch of security, and even the necessary to enter a password there's still a major security hole, which is the user can easily change the email in the activation link to something else, something that is not a valid email. E.g. this Code: [Select] http://localhost/changeemail_confirm.php?id=35&email=mail@phpmail.local can become to this, when the user manually edits the url and pastes it into his browser: Code: [Select] http://localhost/changeemail_confirm.php?id=35&email=MAIL@ANYTHING.com How can I prevent this, is there any way I could tell the script the CONFIRMED and VALID email, with a more secure way? BTW this script works as it is, it's just that the user can manually change the email to something else what makes this script worthless for now. Hello All I currently have a function that takes in user input from form fields $email & $password. If all is well the function logs the user in, if not redirects back to the login form. What I require is two things. 1) Allow the user to login with either "email" or "username" (entered in the $email form field). 2) Allow the system to have a "master" password and if that is entered with a valid email or user from above then log that user in. Here is my current function, any help is greatly received. Regards function loginMember($email,$password,$returnURL){ if ($email != "" && $password != ""){ $result = mysql_query("SELECT mid,memberid,forename,surname FROM tbl001_member WHERE emailaddress='$email' AND password='".$password."' AND online=1"); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_row($result); $_SESSION["logged_user"] = $row[2]." ".$row[3]; $_SESSION["logged_id"] = $row[0]; $_SESSION["logged_memid"] = $row[1]; session_unregister('wrong_email'); if (isset($_SESSION["logged_user"])) { header('Location:'.$returnURL); exit; } } else { session_register('wrong_email'); $_SESSION['wrong_email'] = $email; return "* There is no registered account with typed email & password."; } } else { session_register('wrong_email'); $_SESSION['wrong_email'] = $email; return "* Please input email and password correctly."; } } This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=351591.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=316053.0 Hi all Would like to ask for help . Generally I would like to run a webpage which will display actual price + price movements of selected cryptocurrencies.
I´m recieving data from extrernal API. (JSON) This is how code looks like: <?php $json = file_get_contents('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd&include_market_cap=true;include_24hr_vol=true;include_24hr_change=true'); $bitcoinPrice = json_decode($json); $json = file_get_contents('https://api.coingecko.com/api/v3/simple/price?ids=dash&vs_currencies=usd&include_market_cap=true;include_24hr_vol=true;include_24hr_change=true'); $dashPrice = json_decode($json); $json = file_get_contents('https://api.coingecko.com/api/v3/simple/price?ids=netchain&vs_currencies=usd&include_market_cap=true;include_24hr_vol=true;include_24hr_change=true'); $netchainPrice = json_decode($json); $json = file_get_contents('https://api.coingecko.com/api/v3/simple/price?ids=pivx&vs_currencies=usd&include_market_cap=true;include_24hr_vol=true;include_24hr_change=true'); $pivxPrice = json_decode($json); function formatter($amount) { // $formatter = new NumberFormatter('en_US', NumberFormatter::CURRENCY); return '$'.number_format($amount, 2);; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>Masternodes monitor</title> <!-- Font Awesome --> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"> <!-- Bootstrap core CSS --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- Material Design Bootstrap --> <link href="css/mdb.min.css" rel="stylesheet"> <!-- Your custom styles (optional) --> <link href="css/style.css" rel="stylesheet"> <!-- MDBootstrap Datatables --> <link href="css/addons/datatables.min.css" rel="stylesheet"> </head> <body> <table id="dtBasicExample" class="table table-striped table-bordered table-sm" cellspacing="0" width="100%"> <thead> <tr> <th class="th-sm">Coin name </th> <th class="th-sm">ROI </th> <th class="th-sm">Daily income </th> <th class="th-sm">Price </th> <th class="th-sm">24 change </th> <th class="th-sm">Volume </th> <th class="th-sm">Marketcap </th> <th class="th-sm">Node price </th> <th class="th-sm">Coins for MN </th> <th class="th-sm">Nodes </th> </tr> </thead> <tbody> <tr> <td><img src="/img/btc.png" width="15" height="15" title="Bitcoin logo" alt="Bitcoin logo" /> Bitcoin (BTC) </td> <td>Unknown</td> <td>Unknown</td> <td><?=formatter($bitcoinPrice->bitcoin->usd) ?></td> <td><?=formatter($bitcoinPrice->bitcoin->usd_24h_change) ?></td> <td><?=formatter($bitcoinPrice->bitcoin->usd_24h_vol) ?></td> <td><?=formatter($bitcoinPrice->bitcoin->usd_market_cap) ?></td> <td>Unknown</td> <td>Unknown</td> <td>Unknown</td> </tr> <tr> <td><img src="/img/pivx.png" width="15" height="15" title="Pivx logo" alt="Pivx logo" /> Pivx (PIVX)</td> <td>Unknown</td> <td>Unknown</td> <td><?=formatter($pivxPrice->pivx->usd) ?></td> <td><?=formatter($pivxPrice->pivx->usd_24h_change) ?></td> <td><?=formatter($pivxPrice->pivx->usd_24h_vol) ?></td> <td><?=formatter($pivxPrice->pivx->usd_market_cap) ?></td> <td>Unknown</td> <td>10,000</td> <td>1,536</td> </tr> <tr> <td><img src="/img/dash.png" width="15" height="15" title="Dash logo" alt="Dash logo" /> Dash (DASH)</td> <td>7.5%</td> <td>14,40 $</td> <td><?=formatter($dashPrice->dash->usd) ?></td> <td><?=formatter($dashPrice->dash->usd_24h_change) ?></td> <td><?=formatter($dashPrice->dash->usd_24h_vol) ?></td> <td><?=formatter($dashPrice->dash->usd_market_cap) ?></td> <td>$69,696.22</td> <td>1000</td> <td>4001</td> </tr> <tr> <td><img src="/img/ntx.png" width="15" height="15" title="Netchain logo" alt="Netchain logo" /> Netchain (NTX) </td> <td>350%</td> <td>0,12 $</td> <td>$0.00004</td> <td><?=formatter($netchainPrice->netchain->usd_24h_change) ?></td> <td><?=formatter($netchainPrice->netchain->usd_24h_vol) ?></td> <td><?=formatter($netchainPrice->netchain->usd_market_cap) ?></td> <td>$7</td> <td>100.000</td> <td>55</td> </tr> </tbody> <tfoot> <tr> <th>Coin name </th> <th>ROI </th> <th>Daily income </th> <th>Price </th> <th>24 change </th> <th>Volume </th> <th>Marketcap </th> <th>Node price </th> <th>Coins for MN </th> <th>Nodes </th> </tr> </tfoot> </table> <!-- SCRIPTS --> <!-- JQuery --> <script type="text/javascript" src="js/jquery-3.4.1.min.js"></script> <!-- Bootstrap tooltips --> <script type="text/javascript" src="js/popper.min.js"></script> <!-- Bootstrap core JavaScript --> <script type="text/javascript" src="js/bootstrap.min.js"></script> <!-- MDB core JavaScript --> <script type="text/javascript" src="js/mdb.min.js"></script> <!-- MDBootstrap Datatables --> <script type="text/javascript" src="js/addons/datatables.min.js"></script> <script> $(document).ready(function () { $('#dtBasicExample').DataTable(); $('.dataTables_length').addClass('bs-select'); setTimeout(function() { location.reload(); }, 900000); }); </script> </body> </html>
I need section usd_24h_change in percent %. I tryed : <td><($bitcoinPrice->dash->usd_24h_change) ? % ></td> <td><($dashPrice->dash->usd_24h_change) ? % ></td> <td><($netchainPrice->dash->usd_24h_change) ? % ></td> <td><($pivxPrice->dash->usd_24h_change) ? % ></td> But it doesn´t work… Please help Edited October 26, 2019 by NetchainThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=350095.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=342245.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=346762.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=342929.0 This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=350544.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=305930.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=319719.0 |