PHP - Recovery Of Datafields From A Special Get Form
I generate php form lines from a database but cannot work out how to recover the text fields for lines 1, 2 & 4 using get or post - can anyone help?
The url string below(get to see what is happening) contains titles BF and SG in lines 1 and 2 for the field name 'book' and then TG for line 4 but no title for line 3: http://localhost/test/test.php ?book%5BArray%3F%5D=BF&row_count=Array%3F &book%5BArray%3F%5D=SG&row_count=Array%3F &book%5BArray%3F%5D=&row_count=Array%3F &book%5BArray%3F%5D=TG&row_count=Array%3F Similar TutorialsHi, im having trouble with the below code which is used in case user forgets password. If i enter username and ANY email, it will send there "Username" and "Password". off course i just want it to be sent only to existing email in db. any ideas? Thank you. <? include("fns.php"); include "config.php"; if(isset($_POST['Submit'])){ //1. Check if form fields are filled in if(!filledin($_POST)){ header( "Location:Messages.php?msg=7" ); exit(); } $name=$_POST['name']; $em=$_POST['mail']; //2. Check if entered name exist $query="Select pw from user where uname='$name'" or die(mysql_error()); $result= mysql_query($query); if(mysql_num_rows($result)>0){ for ($i=0; $i<mysql_num_rows($result); $i++) { $row = mysql_fetch_assoc($result); $pass=$row['pw']; $to="$em\r\n"; $from="From: \r\n"; $msg="Password:$pass\r\n"; $msg .="Username:$name\r\n"; $msg .="Your login information\r\n"; $subject=" Your Login Password\r\n"; } }else{ header( "Location:Messages.php?msg=8" ); exit(); } //4. Send password to user if(mail($to,$subject,$msg,$from)){ header( "Location:Messages.php?msg=9&email=<?php echo $em; ?>" ); exit(); //echo "Please click here to log"; }else{ header( "Location:Messages.php?msg=10"); exit(); } } Hi, I'm very new to PHP. I've been working on this code for password recovery for a week and I'm pretty close, but I'm having problems understanding why I keep getting the: "Can not send password to your email address". I know for certain that it has found the email in the table, but why is it still having problems sending? There are no other error messages thrown. Code: [Select] function frm_lostpass() { global $skn,$In,$db,$Film,$Url,$Date,$module,$userinfo; if(isset($_GET['check']) and trim($_GET['check'])=='ok') { $email = $In->get('email',0,''); $sql_check ="SELECT Count(m.Email) AS numrows FROM tbl_member AS m\n" ."WHERE m.Email = '$email'\n"; $numrow=$db->sql_get_first($sql_check); if($numrow['numrows']!=1) { return "<center>Email not found !</center>"; } else { global $skn,$In,$db,$Film,$Url,$Date,$module,$userinfo; // value sent from form $email_to=$_POST['email_to']; // retrieve password from table where e-mail = $email_to $sql ="SELECT m.Password FROM tbl_member AS m\n" ."WHERE m.Email = '$email'\n"; $result=mysql_query($sql); // if found this e-mail address, row must be 1 row // keep value in variable name "$count" $count=mysql_num_rows($result); // compare if $count =1 row if($count==1){ $rows=mysql_fetch_array($result); // keep password in $your_password $your_password=$rows['password']; // ---------------- SEND MAIL FORM ---------------- // send e-mail to ... $to=$email_to; // Your subject $subject="Your password here"; // From $header="example@example.com"; // Your message $messages= "Your password for login to our website \r\n"; $messages.="Your password is $your_password \r\n"; $messages.="more message... \r\n"; // send email $sentmail = mail($to,$subject,$messages,$header); } // else if $count not equal 1 else { return "That email address is not found in our database"; } // if your email succesfully sent if($sentmail){ return "  Your Password Has Been Sent To Your Email Address."; } else { return "  Cannot send password to your e-mail address"; } } } else { $skn ->set_file( 'lost_pass', 'member/frm_lostpass.html' ); return $skn -> output('lost_pass'); } } I am needing help designing password recover script. This script must include a password recovery script. I am needing for the person to reset there password, need to first answer a form named: Your Email. If the email is found, it goes to another form that asks for the secret answer. Then it goes to a form that asks the answer of there secret question that they entered when they first signed up. If the answer is correct it updates the database table value of the password with a random string generated with: abcdefghijklmnopqrstuvwxyz023456789 And it also, sends that password to the email provided. What I am wanting to know, is how would the code with the if statements would be structured like and the column types and names. Or if anyone has ever created something like this, and would be glad to post a snippet of there code would be great. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=314473.0 I created a form where someone can add their name and a comment and then submit it to my database. here's the code of the form PHP
Hi Hi guys, I am writing a "login" script that will be on my main page(I have it inside of <head></head> tags). I want it to take a user name and password, store it in a variable that is persistant with all pages on my website. Is that possible? How can I make a variable that will carry over to a page that doesn't have the original code? E,g, $Login = "alogin"; then when my client goes to a different page $Login still == "alogin"? I hope this is understandable. I am not writing a very advanced script, I just want the input form to store the users login name/password so he or she may access a section of the site that has more options available if they're logged in. Hi experts. I am received a GET variable into a page which is a id with a value as uuid:3242_2323_4444_9909_433/child_repeat[1]. Which is being used in my mysql query. So my query will be SELECT * from table_1 WHERE id = $id. However php is treating this string differently, my query fails, it says that it has a error near :3242_2323_4444_9909_433/child_repeat[1]. So it seems that its interpreting the colon as something else and removing the text before the colon. hello; I have: mysql: utf8_general_ci index.php: header( ... UTF-8) index.php: <meta ... content-type ... UTF-8> index.php, mysql query procedu ... mysql_set_charset( utf8 , .. ) ... So, if I put a special character in my db, it WILL display correctly in index.php But, if I put the same character in a php variable, it is BAD ... diamond-shape with question mark inside Since my special characters work from the db, I would like to also use them in html (index.php ). am I missing anything? thanks for your time .. Shannon Hi all I need to retrieve a remote file and store it on my server. There are several methods to do this, but all of them fail when the URL contains special characters such as spaces. Consider the following URL: 'http://www.somedomain.com/Images/Products/MyProduct (Large).jpg' Assuming the allow_url_fopen directive is set to "on" in the php.ini, one can normally call: $url = ... $handle = fopen($url); to access the file. However, the space in the filename causes a Bad HTTP Request (Response 400). Using urlencode to encode the url doesn't solve the problem either, as all forward slashes and the colon after the protocol get escaped, and fopen doesn't recognize it as a URL. Besides manually replacing all the characters in the URL that are not colons or forward slashes (and are considered 'special'), can anyone give me any other solutions to make this work? Thanks Hi everyone, I hope someone can give me an answer to problem that has eluded me for about 2 weeks. I just can not find the answer. My problem is that I have a database that I want to return the average of a column BUT the average number that gets calculated can not include the oldest two records that were entered in that particular column. In other words, if I have ten entries in a column only the latest 8 entries will be used to calculate the returned average. Here is the basic query I am using: Code: [Select] $result = mysql_query("SELECT *, avg(miles) AS av_miles FROM mpg WHERE vehicle_id='$id' "); Thank you for help in advance. I hope this is a fairly quick one, I've got a form I'm building where i may well have some special characters being inserted (accents mostly) now normally i would just pop in an HTML editor (TinyMCE) and let that deal with it. But i am looking to export this data as a CSV for use in excel, which means i can't afford to have HTML tags within the output. I am sure someone will have come across this before any suggestions? many thanks Matt I need to pass info to a php script via link while ignoring the character '&' for example: mywebsite.com/myphp.php?info=thisInformation&thecharacter& is there anyway I can tell php to ignore the character '&' and just read it as text (cause I understand its a special character.. maybe something like in XML you can ignore the character & by using <![CDATA[ ]]> thanks!!! much appreciated!!! PS: this is a must.. since in the end I am passing links.. and urls.. that are like amazon.com/blah&blah Sorry, but this is a copy/paste from another site, thought it would be helpful here. [size=115]Support Request Template[/size] What version of phpBB are you using? phpBB 3.0.7-PL1 What is your board's URL? http://asersmia.com/twenty-thirteen Who do you host your board with? webhostingpad.com How did you install your board? I used a tool provided by my host Is your board a fresh install or a conversion? Fresh Install Do you have any MODs installed? Yes Is registration required to reproduce this issue? Yes What MODs do you have installed? profile comments blogs mchat What styles do you currently have installed? dark grunge/custom/prosilver What language(s) is your board currently using? english Which database type/version are you using? MySQL 5 What is your level of experience? Comfortable with PHP and phpBB What username can be used to view this issue? n/a What password can be used to view this issue? n/a When did your problem begin? Just a few days ago. My hosting provider will not do squat about it, even though I did nothing to the database to cause this issue. Please describe your problem. it is a problem that has suddenly developed in the mysql database. I have several members that have previously registered with a " ' " (apostrophe special symbol) in their name. No problem for nearly a YEAR till just a few days ago, when the server was being sluggish yet again ( NOTE: DO NOT HOST WITH WEBHOSTINGPAD.COM as this is not an isolated incident with their server messing up a database). Now, people who have registered names cannot log in, they get a 404 not found error. Additionally, I cannot change their name to something without a ' in it through ACP, I get the same error... 404. I have to go into the DB to change it there and then I can pull up their name. And finally, when someone tries to register with a ' in their name like O'Brady, for instance, it will throw the same error. Has anyone seen this, and if so, how can it be resolved? [size=60]Generated by SRT Generator ($Rev: 4778 $)[/size] Code: [Select] <?php> $filename='http://www.example.com/polopoly_fs/1.1034350!/img/httpImage/image.jpg'; $size = getimagesize($filename); print $size; </php> If the image has symbol "!", it takes long time to execute the script. Please tell me how can we avoid this. Hello everyone! I'm working on a PHP employee database that uses the local network's active directory to allow users to log in. Basically, I'm using the ldap_bind command to authenticate and figure out what user is logging in. The main snippet of code is: Code: [Select] $username = $_POST['username']; $password = $_POST['password']; $convertedPassword = utf8_encode($password); if (ldap_bind($ds,"health1\\" . $username,$convertedPassword)){do stuff} This works fine for normal username/passwords, but has been getting hung up on special characters. I added the utf8_encode command, which allowed password with carrot (^) characters, but it still won't allow backslashes ( \ ). I get Code: [Select] Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Invalid credentials in /var/www/emp/index.php on line 22 every time with a password such as "Blabla12\" The utf8_encode command seems to be escaping the \, which I think is what I want. Has anybody else had any luck with this? -Sam |