[PHP] HELP WITH UPLOAD REQUIRED!!!!!!!!
I am trying to allow various users to upload their own picture. What I would like to happen is to have the copy statement rename the .jpg image to the username. For example, if the username is mike, then I want the picture to be renamed mike.jpg The following is a snippet of code: The errors I get are as follows: Warning: unable to open " for reading: Permission denied in c:\phpweb/fuploadconfirm.php on line 15 Warning: Unlink failed (No such file or directory) in c:\phpweb/fuploadconfirm.php on line 31 Line 15 is the if copy($userfile) line in the above code AND Line 31 is the unlink statement at the end. Thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] BIG PROBLEM WITH SEARCH!!!!!!
I'm developing a site that requires people to sign up. During this time, we get their name, email, city, etc. There is also optional informational like (age, education) that they don't have to fill in. Now, the problem we have is we allow people search through the database using mostly the same criteria people filled in during their sign up. However, if someone does not have a preference in Education or age, how do we create a query that selects all the records. Currently, the SQL statement has several "OR" clauses in between the optional fields (ie: select * form clients where (CID='$CID' AND CUserName='$CUserName') OR CAge='$CAge' OR CEducation='$CEducation'). You can see from the query that if someone has no preference, it will take the value from the form and search just on that value - NOT everything. I'm stumped on how to solve this problem. Can anyone help me out? Thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Image problem
Can anyone tell me how to display both jpg and gif images. Basically, what i've got is: Now, I know I probably need slashes in there and I played around with it but no luck. Where do I put them? Thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] What's wrong with this link?
I realize my slashes are most likely in the wrong spot and i'm new to this PHP stuff so a little help would be appreciated. I get a parse error print "/">Click Here"; Thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Session not destroying properly
Got a problem with sessions. On my index page, there's a place for people to login. Well, when I test with two different user names (ie: mike and jlo) it reverts to the first one when login fails. For example: I enter in the username "myuen" and a wrong password. I get my "Password/Username invalid" message which is what I want. The page refreshes, the username slot already has myuen in it from the last entry, I erase it, enter in a new username "jlo" and the correct password and it will not log me in. I know once you attempt to login, it saves the username as a session variable. On my index.php page, I have a script that checks if a session exists (particularly the Username), if it exists, destroy it otherwise, continue on. Obviously it's not destroying it once we enter in a wrong username and try to login again. Any ideas on how to fix this? Here's my coding: Thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session not destroying properly
Thanks for the suggestion, I tried that and it still doesn't seem to be working. Here's what i've got so far on my page (index.php). Hope you can see something I don't. Thanks, Mike On Tue, 6 Mar 2001, trogers wrote: > > Hi > You will need to kill the session data on the exit of your failed login not > on entry to the login page as the data will already be overwritten by the > previous session value. > I use > unset($name); > unset($password); > ... > > Tom > > > At 04:24 PM 6/03/01 +0900, Yasuo Ohgaki wrote: > >Do you use custom session handlers? > >Try session_unset() also. It may help. > > > >Regards, > >Yasuo Ohgaki > > > > > > > Got a problem with sessions. > > > > > > On my index page, there's a place for people to login. Well, when I test > > > with two different user names (ie: mike and jlo) it reverts to the first > > > one when login fails. For example: > > > I enter in the username "myuen" and a wrong password. I get my > > > "Password/Username invalid" message which is what I want. > > > > > > The page refreshes, the username slot already has myuen in it from the > > > last entry, I erase it, enter in a new username "jlo" and the correct > > > password and it will not log me in. > > > > > > I know once you attempt to login, it saves the username as a session > > > variable. On my index.php page, I have a script that checks if a session > > > exists (particularly the Username), if it exists, destroy it otherwise, > > > continue on. Obviously it's not destroying it once we enter in a wrong > > > username and try to login again. > > > > > > Any ideas on how to fix this? > > > > > > Here's my coding: > > > > > if(session_is_registered("CUserName")) > > > session_destroy(); > > > > > > session_register("CUserName"); > > > $CUserNameSession="CUserName"; > > > > > > //SNIP > > > ?> > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > >To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] URGENT: Can't see picture
I'm having a ton of trouble trying to get pictures to display. At first, I thought I had the problem fixed - but that's because the pictures reside on my machine. So instead of providing a path to the pictures like: c:/phpweb/userpics/ I tried absolute paths like ../userpics and that doesn't seem to have worked either. Here's a snippet of my code and i'm hoping someone can help me out on this. Thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Repost URGENT: Can't see picture!!!!!!!!
Hi, this is a repost and nothing i've tried is working. Basically, I allow people to upload pictures and they all go to the proper directories but I can't see the picture. I can see the pictures great on my windows server but no one else can see it. Obviously the path to the images is screwed but I can't figure it out. The $picdir i've tried are: $picdir = "./userpics"; $picdir = "c:/phpweb/userpics/" $picdir = "/userpics"; $picdir = "../userpics"; All of the above don't work. I'll post my code below: Uploading your potrait Portrait Picture Hey Goodlooking! Your picture has been uploaded correctly"); print " "; print (""); print" "; print "Home"; print " Upload again"; //adds 'yes' to database so user can search only profiles with pictures. $query="UPDATE clients SET CPicture='yes' WHERE CUserName='$CUserName'"; //FAILED PROCESS if(!mysql_query($query)) { print "A process has failed during the update. Please report this incident to the Web Master mailto:[EMAIL PROTECTED]\">[EMAIL PROTECTED]"; print "Home"; return false; } return true; } die ("Error in uploading. Please try again"); } else { //PRINTS IF PICTURE IS ANYTHING BUT JPEG FORMAT print "In order to show off your qualities to the fullest extent. LDSAlberta.com currently only acceptes pictures in JPEG format which have the highest color quality and in turn show you off the best!"; print "Home"; print " Upload again"; } unlink($fupload); mysql_close(); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] URGENT: Session problem not carrying UserName over
I have this calendar and it's supposed to print out the word "Activity" if there is an event booked on that day. Everything works great except the query isn't finding the username. I did a print "$CUserName is CUserName" and it works great - so I know I started my session and it's accessible but when I put inside the query, it doesn't show up. I tried passing it through the browser and passing the entire session through the browser and still no dice. I also checked my php.ini file and ALL of my globals are on. Here's my coding, I really hope someone can help me figure this thing out. Thanks, Mike LDSAlberta.com: Personal Calendar Calendar of Events Click on date to see details << >> Sunday Monday Tuesday Wednesday Thursday Friday Saturday "; for ($i=1; $i<=$firstwday; $i++) { print " "; } $firstweek = false; } //checks for event if($numrows>=1) { //Event exists print " $d "; } else { //Event doesn't exist print " $d"; /// // PROBLEM IS HERE CUserName doesn't show up $eventrows = 0; $query = "SELECT * FROM activities WHERE CUserName='$CUserName' AND ADay='$d' AND AMonth='$themonth' AND AYear='$y'"; print "$query"; // /// $result = mysql_query($query); $eventrows = mysql_num_rows($result); if($eventrows>=1) print "Activity"; print ""; } $wday++; $wday = $wday % 7; $d++; // Sunday start week with if ($wday==0) { print ""; } //blanks for last week if ($lastweek) { print ""; for ($lastday=28; $tlastday<=31; $lastday++) { print " "; } $lastweek = false; } } ?> Click on date to see details _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Session expiry problem
I'm using IE 5 to view a page i'm building for a client of mine. The problem is, on some pages when you press the "Back" button, I get an expiry message. To temporarily fix this problem, i've opened new windows everytime a link is clicked on. This is a pretty unelegant solution but I hope someone out there has an answer for me on how to fix this. FYI: I'm using Apache 1.3.14 on a Windows machine. Thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Macs and PHP
I'm got another person working for me on a site. He's a Mac user and for some reason, he can't seem to register as a new person. I know this problem isn't due to the large amount of traffic b/c it's a new site with 3 users max at any time. I haven't found any similar problems in any knowledge base and i'm thinking it has something to do with my cable modem connection and the fact that: 1. I'm in Seattle and he's in Cleveland (distance issue) - less likely. 2. ON the more likely side, all the crap that is running on my computer (ie: firewalls, IDS, telnet, applications). However, another developer in the same city as me has no problems registering on his Win machine. Anyone have any ideas? Thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Macs and PHP
As I mentioned in an earlier email. Mac users can't register for the test site i'm building and I have no idea why this is. Here's some information that may help diagnose this problem: - The site is running on Apache1.3.14 on a Windows O/S. - I'm not checking for browser type - All authentication is done through a MySQL database. - The actual signup page is an html page and sent to a PHP page that accepts/denies the information submitted. Here's the actual coding for the newmemberacceptance.php page (the page that accepts or rejects a new user). Thanks, Mike Member registration "; /* This is function tests for matching passwords */ if (empty($CUserName)) { print "UserName is empty"; exit(); } if(empty($CPassword)) { print "You must choose a password"; exit(); } if($CPassword == $CPassword2) { print ""; } else { print "Passwords do not match.Please press on the back button and re-enter your passwords so they match."; session_destroy(); exit(); } /* This is function tests for user information */ if (isset($CUserName) && isset($CPassword) && isset($CFirstName)) { //checking for user input $dberror=""; $ret=add_to_database($CUserName,$CFirstName,$CLastName,$CCity,$CEmail,$CGender,$CCommunity,$CAge,$CHeight,$CMarital,$CKid,$CBody,$CEducation,$CChurch,$CWard,$CStake,$CTemple,$CMission,$CMissionLocation,$CUrl,$CGreeting,$CPassword,$CMailingList,$CEyeColor,$CHairColor,$Interests1,$Interests2,$Interests3,$Interests4,$Interests5,$Interests6,$Interests7,&$dberror); if(!$ret) print "Error: $dberror"; else print "Congratulations! Your profile has been added."; } /* FUNCTION: add_to_database PURPOSE: Add data to clients / interests table in Database */ function add_to_database($CUserName,$CFirstName,$CLastName,$CCity,$CEmail,$CGender,$CCommunity,$CAge,$CHeight,$CMarital,$CKid,$CBody,$CEducation,$CChurch,$CWard,$CStake,$CTemple,$CMission,$CMissionLocation,$CUrl,$CGreeting,$CPassword,$CMailingList,$CEyeColor,$CHairColor,$Interests1,$Interests2,$Interests3,$Interests4,$Interests5,$Interests6,$Interests7,&$dberror) { $result = mysql_query("SELECT CUserName FROM clients WHERE CUserName = '$CUserName'"); $count = mysql_num_rows($result); if ($count >= 1) { print "I'm sorry, the user name you selected is currently in use, please select another.Please press on the back button of your browser."; exit; } else { $query = "INSERT INTO clients (CUserName,CFirstName,CLastName,CCity,CEmail,CGender,CCommunity,CAge,CHeight,CMarital,CKids,CBody,CEducation,CChurch,CWard,CStake,CTemple,CMission,CMissionLocation,CUrl,CGreeting,CPassword,CMailingList,CEyeColor,CHairColor) VALUES ('$CUserName','$CFirstName','$CLastName','$CCity','$CEmail','$CGender','$CCommunity','$CAge','$CHeight','$CMarital','$CKid','$CBody','$CEducation','$CChurch','$CWard','$CStake','$CTemple','$CMission','$CMissionLocation','$CUrl','$CGreeting','$CPassword','$CMailingList','$CEyeColor','$CHairColor')"; //Inserts interests data from form into Interests table $query2 = "INSERT INTO interests (I1,I2,I3,I4,I5,I6,I7,CUserName) VALUES ('$Interests1','$Interests2','$Interests3','$Interests4','$Interests5','$Interests6','$Interests7','$CUserName')"; } if (!mysql_query ($query2) or !mysql_query($query)) { $dberror = mysql_error(); return false; } return true; } /** This prints out the user input on the screen **/ foreach ($HTTP_POST_VARS as $key=>$val) if (gettype($val) == "array") { print "$key:\n"; foreach ($val as $two_dim_value) print ".$two_dim_value"; } else { print "$key: $val\n"; } print ""; ?> Click here to continue. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]