Jump to content

dlcmpls

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dlcmpls's Achievements

Member

Member (2/5)

0

Reputation

  1. This is a bugger. I ran the query you mentioned. All the password fields that should have been populated with the ENCODE are empty. All the other password fields that were not populated with encode do have text in them - though its mush. I've attached a screen shot. Any additional ideas? [attachment deleted by admin]
  2. I ran the whole query via phpMyAdmin. Same result. No data in the PASSWORD field. The field type for PASSWORD is char(100)
  3. I'm viewing the database via phpMyAdmin. The field for PASSWORD is empty. The field is populated for other records that I created during testing, so I know that it's possible to insert data into that field. If I run the SELECT statement you mention, I get some odd looking characters: �-*��
  4. Well, removing the single quotes around the ENCODE removed the error message I was getting, but now the field in my db that should be populated is empty. Here's my updated query: mysql_connect("localhost", "user", "pass") or die(mysql_error()); mysql_select_db("dbname") or die(mysql_error()); mysql_query("INSERT INTO members (ID, rec_no, email, PASSWORD, firstname) VALUES('', '', 'boo@somewhere.com', ENCODE('pw101', 'key101'), 'dave' ) ") or die(mysql_error()); Query runs fine, but no insert into the PASSWORD field in my db.
  5. Sorry about that. I modified my code to remove real variable data. Here's my code: mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("dbname") or die(mysql_error()); mysql_query("INSERT INTO members (ID, rec_no, email, PASSWORD, firstname) VALUES('', '', 'ENCODE('pw101', 'key101')', 'pass2', 'dave' ) ") or die(mysql_error()); I've modified the variables in the connect and select strings. Here's my error message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'pw101', 'key101')', 'pass2', 'dave' )' at line 2
  6. I need a little help with encode. I'm just learning how to work with ENCODE and DECODE. I've written this sql query, which works just fine (minus the encode): mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("dbname") or die(mysql_error()); mysql_query("INSERT INTO mymembers (ID, rec_no, email, PASSWORD, firstname) VALUES('', '', 'grr@t.com', 'pass2', 'dan' ) ") or die(mysql_error()); Now I want to try and ENCODE the password, so I wrote this query: mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("dbname") or die(mysql_error()); mysql_query("INSERT INTO mymembers (ID, rec_no, email, PASSWORD, firstname) VALUES('', '', 'grr@t.com', ENCODE('pw101', 'key101'), 'dan' ) ") or die(mysql_error()); But that query fails and throws this error message: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'pw101', 'key101')', 'pass2', 'dave' )' at line 2" This seems to be a quotation mark issue to me. Can anyone help me write a sql insert that will use ENCODE on the password? Thanks in advance for any help.
  7. I tried this: AND subscriptions.recieve_by IN('mail','both','e-mail') but that returned 0 records. Here's more of my query, including the mysql_error which doesn't return an error: $dbh=mysql_connect ("$Host", "$User", "$Password") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("$DBName"); /******************************************** Write the query, call it, and find the number of fields /********************************************/ $export = mysql_query(" (SELECT subscribers.bfname, subscribers.bname, subscribers.baddr1 as addr1, subscribers.baddr2 as addr2, subscribers.bcity as city, subscribers.bstate as state, subscribers.bzip as zip, subscribers.email as email, subscribers.user_id, subscribers.password, subscriptions.expiration_date, subscriptions.type FROM subscribers, subscriptions WHERE saddr1 = '' AND subscriptions.user_id = subscribers.user_id AND (subscriptions.recieve_by = 'mail' OR subscriptions.recieve_by = 'both') ) UNION (SELECT subscribers.bfname, subscribers.bname, subscribers.saddr1 as addr1, subscribers.saddr2 as addr2, subscribers.scity as city, subscribers.sstate as state, subscribers.szip as zip, subscribers.email as email, subscribers.user_id, subscribers.password, subscriptions.expiration_date, subscriptions.type FROM subscribers, subscriptions WHERE saddr1 <> '' AND subscriptions.user_id = subscribers.user_id AND (subscriptions.recieve_by = 'mail' OR subscriptions.recieve_by = 'both') ) ORDER BY bname, bfname, user_id, expiration_date DESC "); the "recieve_by" column in my table is varchar(10) I know that the dash in "e-mail" isn't a problem because I can change the AND to: AND (subscriptions.recieve_by = 'e-mail' OR subscriptions.recieve_by = 'both') and I don't get an error. Could it be a Union problem? I don't have a recieve_by column in both tables. Would that cause a problem?
  8. Here's my current sql statement which gives me almost what I want: mysql_select_db ("$DBName"); /******************************************** Write the query, call it, and find the number of fields /********************************************/ $export = mysql_query(" (SELECT subscribers.bfname, subscribers.bname, subscribers.baddr1 as addr1, subscribers.baddr2 as addr2, subscribers.bcity as city, subscribers.bstate as state, subscribers.bzip as zip, subscribers.email as email, subscribers.user_id, subscribers.password, subscriptions.expiration_date, subscriptions.type FROM subscribers, subscriptions WHERE saddr1 = '' AND subscriptions.user_id = subscribers.user_id AND (subscriptions.recieve_by = 'mail' OR subscriptions.recieve_by = 'both') ) UNION (SELECT subscribers.bfname, subscribers.bname, subscribers.saddr1 as addr1, subscribers.saddr2 as addr2, subscribers.scity as city, subscribers.sstate as state, subscribers.szip as zip, subscribers.email as email, subscribers.user_id, subscribers.password, subscriptions.expiration_date, subscriptions.type FROM subscribers, subscriptions WHERE saddr1 <> '' AND subscriptions.user_id = subscribers.user_id AND (subscriptions.recieve_by = 'mail' OR subscriptions.recieve_by = 'both') ) ORDER BY bname, bfname, user_id, expiration_date DESC "); See the 2nd AND? That gives me 2 bits of data about how a user receives their newsletter. But there's a third option which is "e-mail." I need the query to include anyone who has a recieve_by set to "e-mail." (yes, I know "recieve" is misspelled!) If I simply extend both AND's like this: AND (subscriptions.recieve_by = 'mail' OR subscriptions.recieve_by = 'both' OR subscriptions.recieve_by = 'e-mail' ) I get a 500 internal server error. What am I doing wrong?
  9. Hi everyone. I want to use php to protect some files. The files are of different types: pdf, skp, dwg. I can handle creating a php page that requires authentication. That's easy. BUT, let's say a user logs in to my php page, and then is presented with a list of links for pdf's. User clicks a link and I open the pdf in a new window. All is good so far. But now the user can copy and paste the url into an email and send the url to an evil person. The evil user now has direct access to my pdf via the url. By the way, I know a user can simply save my pdf and then forward it to whoever they want. I have to live with that. I know I could restrict access to a directory with a .htaccess file, and then put all my pdf's in that restricted directory, but for a variety of reasons, that's not gonna work. Maybe my real question is "How can I hide the url of my pdf from a user." That by itself would solve my problem. Can anyone help?
  10. Hi all. I have a customer who wants a search engine for pdf files on their website. I’ve done a bit of checking and this basic approach seems to be the way to go: 1. upload the pdf to a temp dir. 2. run pdftotext on it (part of the xpdf package) 3. store the pdftotext output in db. 4. store the orig pdf in a dir on the server for later download. I'm wondering if there is an existing application that I can use, rather than start from scratch? Does anyone have any suggestions for an existing App? In no suggestions for an existing app, do you have any general suggestions for creating this type of app? Thanks, dlc
  11. Yes, php is enabled. To recap, this code works fine: <?php $to = "bill@bob.com"; $subject = "Check it out!"; $message = "test message"; $from = "someone@somewhere.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); ?> and an email gets sent. But with this code, no email is sent: <?php $myemail="jane@jane.com"; $to = "bill@bob.com"; $subject = "Check it out!"; $message = "test message"; $from = "someone@somewhere.com"; $headers = "From: $myemail"; mail($to,$subject,$message,$headers); ?> I don't understand why simply changing the name of the variable in $headers line would disable the script.
  12. i use a webhost in minneapolis, visi.com. The files are on a Windows server.
  13. Yep, I understand that Flame. Let's drop the idea of a form for now. Why doesn't this script work: <?php $myemail="jane@jane.com"; $to = "bill@bob.com"; $subject = "Check it out!"; $message = "test message"; $from = "someone@somewhere.com"; $headers = "From: " . "$myemail"; mail($to,$subject,$message,$headers); ?>
  14. Thanks phreeek. but that didn't work. I tried this code: <?php $myemail="jane@jane.com"; $to = "bill@bob.com"; $subject = "Check it out!"; $message = "test message"; $from = "someone@somewhere.com"; $headers = "From: " . "$myemail"; mail($to,$subject,$message,$headers); ?> And no luck. One thing I don't understand at all...why would replacing one variable ($from) with another ($myemail) cause a problem to begin with?
  15. Hello all. I have no hair left! I'm working with a very simple email script, but I'm having trouble getting the script to work with a "from" email address supplied via a form (or even hard coded). Here's the code that I know works (with no references to the external form) <? $to = "bill@bob.com"; $subject = "Check it out!"; $message = "test message"; $from = "someone@somewhere.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); ?> Works a-ok. But, now I want the "From" email address to be the email supplied by the user of the form. So I have an input field called "Email" in my form. If I try to modify the above code like so: <? $to = "bill@bob.com"; $subject = "Check it out!"; $message = "test message"; $from = "someone@somewhere.com"; $headers = "From: ($_POST)"; mail($to,$subject,$message,$headers); ?> No email gets sent. In fact, I can't even set a hard code my own variable in the above code like so: <?php $myemail="myemail@someplace.com"; $to = "bill@bob.com"; $subject = "Check it out!"; $message = "test message"; $from = "someone@somewhere.com"; $headers = "From: $myemail"; mail($to,$subject,$message,$headers); ?> That doesn't work. No email gets sent which confuses me because I'm simply replacing one variable ($from) with another ($myemail) in the $headers line. What am I missing? Any help would be greatly appreciated. dlc
×
×
  • 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.