Jump to content

I-AM-OBODO

Members
  • Posts

    442
  • Joined

  • Last visited

Everything posted by I-AM-OBODO

  1. echo @reslt didn't echo anything.
  2. Hi all, I've been battling with this for a while and I don't know why I'm not getting it right. I want a user to be able to change their password. The problem is that I don't know why its not checking the database for the old password but it just changes the password straight up even when its not the correct old password. Thanks in advance Here is my code: <?php if(isset($_POST['submit'])){ $oldpwd = $_POST['oldpwd']; $newpwd = $_POST['newpwd']; $newpwd2 = $_POST['newpwd2']; if($oldpwd == ""){ $err1 = "<font color=red><strong>Current Password Empty</strong></font>"; } if($newpwd == ""){ $err2 = "<font color=red><strong>New Password Empty</strong></font>"; } elseif(strlen($_POST['newpwd']) <= 5){ $err3 = "<font color=red><strong>Password Must Be More Than 5 Characters</strong></font>"; } elseif($newpwd2 == ""){ $err4 = "<font color=red><strong>Confirm Password Empty</strong></font>"; } elseif($newpwd != $newpwd2){ $err5 = "<font color=red><strong>Password Do Not Match</strong></font>"; } else{ $checkold = "SELECT password FROM reg_users WHERE username = '$_SESSION[username]' AND password = '".md5($_POST['newpwd'])."'"; $reslt = mysql_query($checkold); if($reslt){ if(mysql_num_rows($reslt) != 1) { echo "Unrecognized User or Password"; }else{ $query = "UPDATE reg_users SET password = '".md5($_POST['newpwd'])."' WHERE username = '$_SESSION[username]' "; $result = mysql_query($query); $pass_changed = "<font color=blue><strong>Password Changed.</strong></font>"; $wrong = "<font color=red><strong>Something went wrong</strong></font>"; if ($result){ echo $pass_changed; } else{ echo $wrong; } } } } } ?>
  3. hi all, how can I hide the extension of my page eg instead of name.php should be just name without the extension. thanks
  4. This site is the bomb! I see no reason why someone will get help and won't be proud of the helper? It's crazy if you ask me! You coulda just go for it bro! I wish I have the opportunity to sing a song for you. Thank you very very much for conceiving this site! ps: I'm always proud to say I'm a member of phpfreaks. I'm not afraid or ashame to be helped Thanks a zillion dozen times
  5. hi all, is there any tutorial on custom payment gateway integration for opencart? I'd like to implement a payment that is not available in opencart. thanks
  6. hi. can you pls take a look at my last post? thanks
  7. Hi, Thanks for the help. I have decided that the file be uploaded from a form so that it could be referenced. Below is my code for the upload. The upload is now working but my problem now is on the user side. How can i retrieve the file from the database so that it could be view. From what i did, i could view the file name but can not see its content. My guess is, i am not directing to the path where the file is. Help needed pls PS: If what i am doing is wron pls point me to the right way Thanks Admin <?php //directory to store files $target = "test/"; $target = $target . basename( $_FILES['file_name']['name']); $username=$_POST['username']; $real_file=($_FILES['file_name']['name']); if($username == ''){ echo 'Username empty<br>'; } if($real_file == ''){ echo 'File field empty<br>'; }else{ // Connects to your Database mysql_connect("localhost", "user", "pwd") or die(mysql_error()); mysql_select_db("db_name") or die(mysql_error()); //Writes the information to the database mysql_query("INSERT INTO `client_file` VALUES ('', '$username', '$real_file')") ; //Writes the photo to the server if(move_uploaded_file($_FILES['file_name']['tmp_name'], $target)) { //Tells you if its all ok echo "The file ". basename( $_FILES['file_name']['name']). " has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } } ?> User Area <?php mysql_connect("localhost", "user", "paswod") or die(mysql_error()); mysql_select_db("db_name") or die(mysql_error()); $data = mysql_query("SELECT file_name FROM client_file WHERE username = 'john'") or die(mysql_error()); //Puts it into an array while($info = mysql_fetch_array( $data )) { //Outputs the image and other data Echo "<b>File Name:</b> ".$info['file_name'] . "<br> "; } ?>
  8. thanks man, but I really don't get you. the files are already in a folder. do I have to upload them again into another folder? the files are in html. I just need to find a way of getting the file name from the folder and insert it into the database and add a unique id for each.
  9. thanks man, but I really don't get you. the files are already in a folder. do I have to upload them again into another folder? the files are in html. I just need to find a way of getting the file name from the folder and insert it into the database and add a unique id for each.
  10. hi. thanks for the help. it's not an image that is being uploaded but an html file and the file is exported from a different application. the admin export the file to a folder from the application, every user have their own file. I have created a login page where users will login and view their respective html file. I am to write a code for the admin to insert the file path to database so that when users login, they see their respective pages. process required admin 1. upload files from application to folder (this is achieved) 2. inserts the file path to database users 1. login to view page 2. click on navigation to view respective file. (have two links for two viewable files, have to a select to determine which file to view) 3. logs out I have done the login and logout, but on the links, how can I do a select to view the file and how can I as the admin insert the file path to database thanks
  11. hi all. pls how can I store and retrieve files (html) path into database. supposing I have a folder that contains different files and each file belongs to different users, I want the user to only view his file. thanks
  12. Hi, what I really mean is tally 9 accounting software, if the stored data could be exported into PHP/mysql? ps: maybe I need to change the topic of my thread. how do I change it? thanks
  13. hi all. don't know if this is the right forum for this but pls bear with me. Is there a way to import tally data into MySQL? vise-versa thanks
  14. Thanks guys. It now working
  15. Thanks. It's working now
  16. Hi all. In my code I use MySQL curdate() and now() to insert the current date and time in my db. and to get the date and time output I used a calender script I found on internet. the calendar inputs date in the format 12/10/2020 and MySQL date and time format is different (which I believe that's why my script isnt working) I did a select * from table_name where user is boy and date between $start and $end but all I'm getting is blank page. I think I need to conver my form date to something MySQL will understand before I can get an output but I don't know how? how can I achive a result thanks
  17. Hi all. I am currently doing something like a banking project for myself. I am wondering if there is a way I can use a jQuery loader meter to indicate the transfer process so that when a user clicks on transfer, the meter will popup and be reading and when it gets to 100% shows transfer complete. Hope I'm clear enough. Thanks
  18. thanks but mysql_fetch_assoc didn't get the job done, it still brought out resource error. but mysql_fetch_object did the magic pls is there a better way of getting same objective? cos I feel my code is too amateurish and security loophole thanks
  19. Good day guys. Pls I'm stuck here. I am trying to design a payment platform. It's a project for my self. Users have to register and have money in their account just like bank. Users can transfer money from their account to another account. I'm having a problem verifying the sender's balance. The script is to check the senders balance to know if he has enough money to complete the transaction, if yes continues transaction and if no, gets an error message. My problem is that even if the balance is enough. It keeps bringing out error message "not enough money to perform transactions". Pls what am I doing wrong. Ps. My code might appear amateurish though. I wouldn't mind to know the best way to achieve a better result putting security into consideration Thanks <?php $sender = $_POST['sender']; $reciever = $_POST['reciever']; $amount = $_POST['amount']; $remarks = $_POST['remarks']; if($reciever ==''){ echo "<font color=red size=3>Reciever Field Empty</font><br>"; // verify that reciever's field not empty } if($reciever == $sender){ echo "<font color=red size=3>You can't transfer to same account</font><br>"; // verify the account is not the same } if($amount ==''){ echo('<font color=red size=3>Amount Field Empty</font><br>');// verify that amount field is not empty } else{ // verify if receivers account is in database $query = "SELECT Account_No FROM reg_users WHERE Account_No='$reciever'"; $query_result = mysql_query($query) or die(mysql_error()); $count=mysql_num_rows($query_result); if($count==0){ echo "Invalid Account. Check and retry later<br>"; }else{ // verify if the sender has enough balance to perform transaction $check = "SELECT Avail_bal FROM reg_users WHERE Account_No='$sender'"; $check_result = mysql_query($check) or die(mysql_error()); if( $check_result < $amount){ echo "You don't have enough balance to complete this transaction"; // if sender dont have enough balance to make transfer }else{ // if sender has enough balance, credit reciever $update = "UPDATE reg_users SET Avail_bal = '$amount' + Avail_bal WHERE Account_No = '$reciever'"; $query_update = mysql_query($update) or die(mysql_error()); if($query_update) echo "Transfer Completed" ; else{ echo "Something went wrong"; } } } } ?> [code]
  20. How do I become a better programmer? I can write codes to an extent and can read/modify codes very well, but I find it difficult to write some code from scratch. I just google and get a code and modify to my taste and I feel its killing my ability. I want to become a better programmer and so what can or should I do? Help pls
  21. thanks guys
  22. thanks. but what's the right way for my coloring?
  23. hi all. how can i link each row so that when i click the edit, it takes me to a new page where i can edit the row associated with the edit link? thanks in advance. my code <?php $result = mysql_query("SELECT * FROM domain_info") or die(mysql_error()); echo "<table border='0' cellspacing='2' cellpadding='2'>"; echo "<tr> <th bgcolor='#0cc' align='center'><font color='#fff'>Id</th> <th bgcolor='#0cc' align='center'><font color='#fff'>Clients' Name</font></th> <th bgcolor='#0cc' align='center'><font color='#fff'>Domain Name</th> <th bgcolor='#0cc' align='center'><font color='#fff'>Size</th><th bgcolor='#0cc' align='center'><font color='#fff'>Cost</th><th bgcolor='#0cc' align='center'><font color='#fff'>Created Date</th><th bgcolor='#0cc' align='center'><font color='#fff'>Last Renew</th><th bgcolor='#0cc' align='center'><font color='#fff'>Expiry Date</th></tr>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo "<tr><td width='25'>"; echo "$row['id']; echo "</td><td width='150'>"; echo $row['client']; echo "</td><td width='250'>"; echo $row['domain_name']; echo "</td><td width='50'>"; echo $row['size']; echo "</td><td width='50'>"; echo $row['cost']; echo "</td><td width='100'>"; echo $row['create_date']; echo "</td><td width='100'>"; echo $row['last_renewed']; echo "</td><td width='100'>"; echo $row['expiry_date']; echo "</td><td width='100'>"; echo "<a href='www.dis.com'> edit</a>"; // this is the edit link that should be linked to the rows echo "</td></tr>"; } echo "</table>"; ?>
  24. thanks. its okay now. had to define parola before the functions
  25. hi all, pls I dont know why am getting this error undefined variable: parola. but the script runs thanks <?php $my_array = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "0", "1", "2", "3", "4", "5"); for ($i=0; $i<=5; $i++) { $random = array_rand($my_array); //this generates the random number from the array $parola .= $my_array[$random]; //here we will display the exact charachter from the array } echo $parola; // printing result ?>
×
×
  • 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.