Jump to content

bofett

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bofett's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Fixed it. mkdir($fulldirname, 0777, true);
  2. Here is what I get... Warning: mkdir() [function.mkdir]: No such file or directory in /home/username/mysite.com/folder1/folder2/folder3/here/myfile.php on line 29 Line 29 is mkdir($fulldirname, 0777);
  3. Please help. I am simply trying to create a directory if it doesn't already exist. I am working from one site (www.mysite.com/folder1/folder2/folder3/here). I want to have this PHP script make a directory on another one of my sites (www.mysite2.com/images) $dirname = "../../mysite2.com/images"; <--this is the root directory (www.mysite2.com/images) $filename = "/$sitest/$userid/"; <-- this is the folder we want to create if it doesn't already exist (www.mysite2.com/images/us/27) $fulldirname = "$dirname$filename"; <--this should be the total path (mysite2.com/images/us/27) if (file_exists($fulldirname)) { echo "The directory {$fulldirname} exists"; } else { mkdir($fulldirname, 0777); echo "The directory {$fulldirname} was successfully created."; }
  4. There must be a simple way to handle this. I updated my php site to include md5 for passwords. Now I need to go through and change all of the existing passwords to md5 so the current users won't be impacted. I was thinking of running something like one time: $qrl = mysql_query("SELECT * FROM users"); while( $row2 = mysql_fetch_object($qrl) ){ $oldpassword = $row2->password; $newpassword = md5($oldpassword); mysql_query("update users SET password=$newpassword"); } Thanks for your help.
  5. Problem solved! I had to add ini_set('session.cookie_path', '/'.$sitest.'/'); to my logout.php file as well Thanks for your help.
  6. I have been able to make it work in Firefox with this code but IE8 doesent seem to be setting a cookie so its not working in IE8? include("config.php"); ini_set('session.cookie_path', '/'.$sitest.'/'); session_start(); config code... $sitest = "us/ca"; I appreciate any help on this.
  7. Thank you for your reply. Should I set this in my php file before session_start(); by using ini_set( 'session.cookie_path', '/' ); or in php.ini with session.cookie_path = /? Also, can or should I use a variable which showes which url like us/ca or us/nv? I am asking because I have been trying it different ways and it is still not working. Thanks again.
  8. I have a site which has identical sub sites but for different regions. For example... www.site.com/us/ca/sitea www.site.com/us/az/siteb www.site.com/us/nv/sitec Each site has a different name and DB, most likely different users. My problem is that if a user logs into sitea and then goes to siteb (without logging off), the system gets confused and may see them as a different user. Its like the session is being set for the main url of www.site.com. This allows access to the wrong user information. Is there a way to assign an additional value (like ca or nv) to session_start(); for each site? Or can you have the session set with more url info like www.site.com/us/ca/? Thanks for the help.
  9. I am trying to figure out how to keep my program working and turn off register_globals. From what I have been reading it seems to be a simple change but I cant seem to get it to work. for example... //I think I have to change something like this session_register("myuid"); //to $_session["myuid"] = $myuid; //then call $_session["myuid"] //instead of $myuid //right? Anyway, here is the code I am using now with register_globals=on (session_start() is being callid in common.php) include("include/common.php"); if( $_POST['username'] && $_POST['password'] ){ $failed = 1; $username = $_POST['username']; $password = $_POST['password']; $query = "SELECT * FROM users WHERE username='$username' AND password='$password'"; # echo $query; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); if ( ($result) && (mysql_num_rows($result) > 0) ){ $row = mysql_fetch_object($result); $adlogin = $row->username; $myname = $row->username; $adpassword = $row->password; $myuid = $row->uid; # echo $adlogin." ----".$adpassword."<br>"; if ( ($username != $adlogin) || ($password != $adpassword) ){ $failed = 1; }else{ $failed = 0; $loggedin = 1; session_register("loggedin"); session_register("myuid"); session_register("myname"); } }else{ $failed = 1; $loginerror = "<font color='#FF0000'>Username or password incorrect.</font>"; } } Thanks for all of the help!
  10. bofett

    Easy query?

    This did the trick... function getCat($cat){ $qr1 = mysql_query("SELECT name FROM cats WHERE id='$cat'"); $a = mysql_fetch_object($qr1); return $a->name; } function getsubcat($cat){ $qr1 = mysql_query("SELECT parent FROM cats WHERE id='$cat'"); $a = mysql_fetch_object($qr1); if ($a->parent != "") { $qr2 = mysql_query("SELECT name FROM cats WHERE id=$a->parent"); $a2 = mysql_fetch_object($qr2); echo "{$a2->name} - "; }else{ } }
  11. bofett

    Easy query?

    Please help. Table (cats) has id, name, parent. I am trying to echo the name of the parent when I know the id of the child. So for example… id name parent 1 Automotive NULL 2 Cleaning 1 3 Repair 1 I would like to display “ Automotive – Cleaning” When I know id=2. What is the best way to query for “Automotive”? Thanks
  12. That seems to work! Thank you for you help premiso. I really appreciate it.
×
×
  • 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.