Jump to content

fix3r

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Everything posted by fix3r

  1. I have a php form for changing a password for my users in the database, and I am trying to do this with ajax so it looks cleaner and doesn't have to wait on the load time, ect..anyways I just want to learn how to do this with ajax .. but I don't really know how exactly? Usually I would just do this: function submit(blah, blah2) { request.open('GET', '/blah.php?blah=' + escape(blah) + '&blah2=' + escape(blah2)); request.onreadystatechange = SubmitHandle; request.send(null); } then the handle ect.. But here is my question. I have 3 fields (current password, new password, confirm password) After submitting (perferably without a button(rather a hyper link) .. don't really know how because using document.change_password.submit(); is not really doing something, I need to check the "current password" field to check with the database. Of course I could do this through the GET command I posted above but I don't really want the info going plain text through headers is what I am getting at. Then, if the password is wrong, it would say its wrong, maybe with document.getElementById('submit').innerHTML = "wrong password" .. ect .. and if it's right then go onto another function to submit check the new password and confirm password and later say if its wrong or then send it through the database with another function.. What I am trying to get at is, I don't really want this sensitive data to be sent through the way I am sending it now and I need a way to check with the database first to see if your current password is right or not without it sending the way i am sending it now and how you normally would check it with a basic php page. I know, I am really bad at explaining but if anyone understanded the gibberish I just wrote here I would be very pleased to hear what you had to say.
  2. Maybe make all of them a link, and put make it redirect to this: http://www.barriemenshockey.com/statform.php?player=# Then the variable that you clicked will be stored into $_GET['player']; so when you are submitting your form to be entered, you just check to make sure you actually clicked a player, and if you did enter that info into that players spot or w/e
  3. I want to be able to search for text in a text file. For example if there was this in a text file: php1:mysql1 php2:mysql2 php3:mysql3 php4:mysql4 apple:orange php5:mysql5 php6:mysql6 php7:mysql7 php8:mysql8 php9:mysql9 I want to be able to search for the word "apple" and then echo what is next to it, which would be "orange". How would I go about doing this? Also, if I were to search through these files in php daily with a lot of people searching through them, would my text files become corrupt? Thank you!
  4. I have 3 curls in a row. It logins, then it logs out(first 2 curls) .. but then for some reason it doesn't log back in. Does anyone know why that would be? <?php $headers = array("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0. Gecko/20061025 Firefox/1.5.0.8"); //login to the site $url="THE WEBSITE/login.php"; $ch = curl_init(); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookies1.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies1.txt'); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, "THE FIELDS"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_MAXREDIRS, 4); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $store = curl_exec ($ch); curl_close ($ch); print($store); //logout of the site $url="THE WEBSITE/logout.php"; $ch = curl_init(); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookies1.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies1.txt'); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_MAXREDIRS, 4); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $store = curl_exec ($ch); curl_close ($ch); print($store); //log back into the site but gives me an error $url="THE WEBSITE/login.php"; $ch = curl_init(); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookies1.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies1.txt'); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, "THE FIELDS"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_MAXREDIRS, 4); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $store = curl_exec ($ch); curl_close ($ch); print($store); ?>
  5. Sorry, maybe you misunderstood. I really have no clue how to actually get the last character of ANY string. That's what I am asking for. Thank you for responding though. Hopefully you understand my question more clearly now. That was my fault.
  6. i need to find the last digit of a string. for example $pos = 1287120; I need to check if the last digit is "0". The number could be any length but I am positive it will be a number. How would I do this?
  7. Okay, sorry for spam. It seems that this code still outputs the html of the site. How do I make it not output the site at all? $url="WEBSITE"; $ch = curl_init(); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookies1.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies1.txt'); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, "ALL MY FIELDS"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 0); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_MAXREDIRS, 4); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $store = curl_exec ($ch); curl_close ($ch); //print($store);
  8. <?php $headers = array("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0. Gecko/20061025 Firefox/1.5.0.8"); $url="THE WEBSITE"; $ch = curl_init(); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookies.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt'); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, "email=email&pass=pass"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_MAXREDIRS, 4); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $store = curl_exec ($ch); curl_close ($ch); print_r($store); ?> Okay, I got the login to work. Now, how would I make it go to an existing page with the login information and then submit a whole new form? That I am a little confused about.
  9. I want to use php to login to another site and then go to that site using the screen name I was logged into and view a webpage on that site and submit a form and searching for text mostly, i need help logging into that site through a php script.. how would I go about doing this
  10. I don't really know the difference. The form processing page is the same as the form page :|
  11. This doesn't seem to work. What else would I have to do?
  12. Would it matter if the page that has the form is lets say a ".psp"?
  13. Lets say I have a website, that has a form on it. How would I go about using php to insert things into the form and push submit and see what it outputs. The website I want to submit to isn't on my server it would be a different designated site. It doesn't involve cookies or anything like that I just need to search for some text on the submitted page. How would I do this in curl? I'm very clueless because all the tutorials I see has to do with cookies and such and I don't need that.
  14. [b]With Quotes:[/b] [img]http://img267.imageshack.us/img267/6448/withquotesrl7.png[/img] [b]Without Quotes: [/b] [img]http://img201.imageshack.us/img201/6801/withoutquotesvi0.png[/img] Ugh, now my whole bbcode is getting messed up. If anyone has any bbcode for colors, ect, that they would like to share that replaces the WHOLE code, not just if you type in [color="red"] it will replace it and then if you don't do the other thing right it won't replace that.
  15. [quote author=effigy link=topic=124799.msg518037#msg518037 date=1170257335] I'm not sure I follow, but it sounds like your regex is working fine. Have you tried giving the span a class and using CSS, instead of using the whole table contraption? [/quote] Okay, what happen's is, when I use the quote bbcode. For every post it has <table>...</table> What happens is it cuts off my table and then starts it back up again and pretty much corrupts my html.
  16. I have my quote bbcode that I use on my custom forums that I did, but for some reason, when ever I use it, it somehow seem's to corrupt my tables (posts) to look like crap. Could anyone point me in the right direction of what I am doing wrong? [code] function parse($i) { $i = preg_replace("/\[quote=\"([a-zA-Z :\_\/\.\-]+)\"\]/","<br /><table width=\"100%\" cellspacing=\"0\" cellpadding=\"5\" style=\"border: 1px solid #000000; background: #262626;\"><tr><td><span style=\"font-size: 12px;\">Originally Posted By <b>$1</b><br /><i>",$i); $i = preg_replace("/\[\/quote\]/","</i></span></td></tr></table>",$i); return $i; } [/code]
  17. anyone please, i've been working on this for a day now trying figure out this error but I can't find it..it looks like its a long code to look through but there is only a few lines of code that really matter that displays the page ;\ thanks
  18. I've tryed to put this in without any php and the tables work but when I try to put in the update sql database part and some php the page doesn't load when I go to the usercp.. no errors..just doesn't load the included page. Does anyone know what could be the matter? [code] <?php session_start(); ob_start(); if(!isset($_SESSION['login'])){ echo "You are not logged in"; } else { ?> <div id="include_container"> <div id="include"> <h1>UserCP</h1> <p> <?php if (isset($submitted)) { //form submit code here $realname = $_POST['realname']; $aim = $_POST['aim']; $msn = $_POST['msn']; $yahoo = $_POST['yahoo']; $profile = $_POST['profile']; $current_password = $_POST['password']; $password1 = $_POST['password1']; $password2 = $_POST['password2']; if($current_password < 0) { mysql_query("UPDATE users SET realname='" . strip_tags($realname) . "', aim='" . strip_tags($aim) . "', msn='" . strip_tags($msn) . "', yahoo='" . strip_tags($yahoo) . "', profile='" . strip_tags($profile) . "' WHERE username='" . $rs['username'] . "'"); echo "Update Successful!"; } elseif (sha1($current_password) == $rs['password'] && $password1 == $password2) { mysql_query("UPDATE users SET realname='" . strip_tags($realname) . "', aim='" . strip_tags($aim) . "', msn='" . strip_tags($msn) . "', yahoo='" . strip_tags($yahoo) . "', profile='" . strip_tags($profile) . "', password='" . strip_tags(sha1($password1)) . "' WHERE username='" . $rs['username'] . "'"); echo "Update Successful!"; } else { ?> <form method="POST" action="<?php echo $SCRIPT_NAME ?>"> <table> <tr> <td><th align="center" bgcolor="#4F4F4F">Personal Info</th></td> </tr> <tr> <td><b>E-Mail Address</b></td> <td><?php echo $rs['email']; ?></td> </tr> <tr> <td><b>Real Name</b></td> <td><input type="text" name="realname" size="16" maxlength="20" value="<?php echo $rs['realname']; ?>"></td> </tr> <tr> <td><th align="center" bgcolor="#4F4F4F">Public Info</th></td> </tr> <tr> <td><b>AOL Messenger</b></td> <td><input type="text" name="aim" size="16" maxlength="16" value="<?php echo $rs['aim']; ?>"></td> </tr> <tr> <td><b>MSN Messenger</b></td> <td><input type="text" name="msn" size="16" maxlength="40" value="<?php echo $rs['msn']; ?>"></td> </tr> <tr> <td><b>Yahoo! Messenger</td> <td><input type="text" name="yahoo" size="16" maxlength="16" value="<?php echo $rs['yahoo']; ?>"></td> </tr> <tr> <td><b>Personal Profile</b></td> <td><textarea name="profile" cols="50" rows="7" id="profile"></textarea><?php echo $rs['profile']; ?></td> </tr> <tr> <td><th align="center" bgcolor="#4F4F4F">Change Password</th></td> </tr> <tr> <td><b>Current Password</b></td> <td><input type="password" name="current_password" size="16" maxlength="16" value=""> </tr> <tr> <td><b>Password</b></td> <td><input type="password" name="password1" size="16" maxlength="16" value=""> &nbsp;     <input type="password" name="password2" size="16" maxlength="16" value=""> * enter twice to make sure</td> </tr> </table> <br> <center><input type="submit" name="submitted" value="Save Changes"></form></center> <?php } } } ?> </div> </div> [/code]
  19. I didn't know where to put this, so I put it in both places. If this isn't aloud please delete the place where it is innapropriate to put it in. [code]http://www.phpfreaks.com/forums/index.php/topic,112357.0.html[/code] On the top of my page it shows the stats of players if they are logged in..for example, money used..attacks..unread messages..ect. Or if they aren't logged in, it telle them that they need to log in. When someone logs in, it redirects them to the menu page where it also gives them a little info about the person. Now here is where the problem is, when they log in and it redirects you to the page, neither top where it shwos the player's stats or the menu tells them how much of "whatever" they have. It says they have 0. But once you refersh it tells them an exact ammount of what they have. I'm going to show you some of my code but if anyone needs anymore to figure out what the problem would be please tell me. [b]Config:[/b] [code] $result = mysql_query("SELECT * FROM users WHERE username='" . decrypt($_SESSION['login']) . "'"); $rs = mysql_fetch_array($result); [/code] [b]Part of index where info is displayed:[/b] [code] echo'<td width="15%">Money:&nbsp;<b>$' . number_format($rs['moneyout']) . '</b></td>'; echo'<td width="15%">Power:&nbsp;<b>' . number_format($rs['power']) . '</b></td>'; echo'<td width="15%">Attacks:&nbsp;<b>' . number_format($rs['attacks']) . '</b></td>'; [/code] I apprecate your help, thank you.
  20. [quote author=alpine link=topic=112357.msg455917#msg455917 date=1161547057] Sounds like the session isn't set on the first pageview (is accessible as $_SESSION) [/quote] How do I make the session set on the first page view. In the index page I have started the session but I haven't started the session on the menu page because the menu page is included in the index. [code] <?php session_start(); include "config.php"; ob_start(); login_check(); ?> [/code] Thanks for your help.
  21. On the top of my page it shows the stats of players if they are logged in..for example, money used..attacks..unread messages..ect. Or if they aren't logged in, it telle them that they need to log in. When someone logs in, it redirects them to the menu page where it also gives them a little info about the person. Now here is where the problem is, when they log in and it redirects you to the page, neither top where it shwos the player's stats or the menu tells them how much of "whatever" they have. It says they have 0. But once you refersh it tells them an exact ammount of what they have. I'm going to show you some of my code but if anyone needs anymore to figure out what the problem would be please tell me. [b]Config:[/b] [code] $result = mysql_query("SELECT * FROM users WHERE username='" . decrypt($_SESSION['login']) . "'"); $rs = mysql_fetch_array($result); [/code] [b]Part of index where info is displayed:[/b] [code] echo'<td width="15%">Money:&nbsp;<b>$' . number_format($rs['moneyout']) . '</b></td>'; echo'<td width="15%">Power:&nbsp;<b>' . number_format($rs['power']) . '</b></td>'; echo'<td width="15%">Attacks:&nbsp;<b>' . number_format($rs['attacks']) . '</b></td>'; [/code] I apprecate your help, thank you.
×
×
  • 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.