\";\r\nAdd:\r\n\techo \"\\n \";\r\n\r\nBefore:\r\n echo \"\\n \";\r\nAdd:\r\n echo \"\\n users\";\r\n\r\nIn admin.php\r\nAfter:\r\n } else if ($action == 'settheme') {\r\n if (isset($_GET['theme'])) {\r\n $gallery->setCurrentTheme($_GET['theme']);\r\n }\r\nAdd:\r\n\t \r\n/** USERS ******************************************************************/\r\n/*****************************************************************************/\r\n\r\n } else if ($action == 'updateUsers') {\r\n\t\t$uid = explode(\"_\",$_REQUEST['userid']);\r\n\t\t$uid = $uid[1];\r\n\t\t$name = $_REQUEST['username'];\r\n\t\t$pass = $_REQUEST['userpass'];\r\n\t\t$email = $_REQUEST['usermail'];\r\n\t\t$query = \"SELECT * FROM users WHERE name='$name' LIMIT 1\";\r\n\t\t$result = mysql_query($query) or die(mysql_error());\r\n\t\tif (mysql_num_rows($result)<1){\r\n\t\t\t//create new user\r\n\t\t\t$query = \"INSERT INTO users (`name`,`pass`,`email`) VALUES ('$name',MD5('$pass'),'$email')\";\r\n\t\t\t$result = mysql_query($query) or die(mysql_error());\r\n\t\t\t$r = mysql_insert_id();\r\n\t\t\tdie(\"$r\");\r\n\t\t}else{\r\n\t\t\t//update old user\r\n\t\t\t$query = \"UPDATE users SET \";\r\n\t\t\t$query .= \"name='$name'\";\r\n\t\t\tif (!empty($pass) && ($pass!=\"\")){ $query .= \",pass=MD5('$name')\"; }\r\n\t\t\t$query .= \",email='$email'\";\r\n\t\t\t$query .= \" WHERE id='$uid'\";\r\n\t\t\t$result = mysql_query($query) or die(mysql_error());\r\n\t\t\tdie(\"Save successful!\");\r\n\t\t}\r\n } else if ($action == 'removeUsers') {\r\n\t\t$uid = explode(\"_\",$_REQUEST['userid']);\r\n\t\t$uid = $uid[1];\r\n\t\t$query = \"DELETE FROM users WHERE id='$uid' LIMIT 1\";\r\n\t\t$result = mysql_query($query) or die(mysql_error());\r\n\t}\r\n\r\nBefore:\r\n \r\nAdd:\r\n \r\n \r\n \r\n\t\r\n\t\r\n\t\r\n\t

User Management

\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\";\r\n\t\t\techo \"\t\";\r\n\t\t\techo \"\t\";\r\n\t\t\techo \"\t\";\r\n\t\t\techo \"\t\";\r\n\t\t\techo \"\";\r\n\t\t}\r\n\t\t?>\r\n\t
NamePasswordEmail
Add User
Delete | Edit\".$r['name'].\"Saved\".$r['email'].\"
\r\n\t \r\nReplace auth_zp.php with:\r\n0){\r\n\t$r = mysql_fetch_assoc($result);\r\n\t$check_auth = md5($r['name'].$r['pass']);\r\n }\r\n if ($rows>0 && $saved_auth==$check_auth) {\r\n $_zp_loggedin = true;\r\n } else {\r\n // Clear the cookie\r\n setcookie(\"zenphoto_auth\", \"\", time()-368000, $cookiepath);\r\n setcookie(\"zenphoto_user\", \"\", time()-368000, $cookiepath);\r\n }\r\n} else {\r\n // Handle the login form.\r\n if (isset($_POST['login']) && isset($_POST['user']) && isset($_POST['pass'])) {\r\n $user = $_POST['user'];\r\n $pass = MD5($_POST['pass']);\r\n $redirect = $_POST['redirect'];\r\n\t$query = \"SELECT * FROM users WHERE name='$user' AND pass='$pass' LIMIT 1\";\r\n\t$result = mysql_query($query) or die(mysql_error());\r\n if (mysql_num_rows($result)>0) {\r\n // Correct auth info. Set the cookie.\r\n setcookie(\"zenphoto_auth\", md5($user.$pass), time()+5184000, $cookiepath);\r\n setcookie(\"zenphoto_user\", $user, time()+5184000, $cookiepath);\r\n $_zp_loggedin = true;\r\n //// FIXME: Breaks IIS\r\n if (!empty($redirect)) { header(\"Location: \" . FULLWEBPATH . $redirect); }\r\n //// \r\n } else {\r\n // Clear the cookie, just in case\r\n setcookie(\"zenphoto_auth\", \"\", time()-368000, $cookiepath);\r\n setcookie(\"zenphoto_user\", \"\", time()-368000, $cookiepath);\r\n $error = true;\r\n }\r\n }\r\n}\r\nunset($saved_auth, $check_auth, $user, $pass);\r\n// Handle a logout action.\r\nif (isset($_POST['logout']) || isset($_GET['logout'])) {\r\n setcookie(\"zenphoto_auth\", \"\", time()-368000, $cookiepath);\r\n setcookie(\"zenphoto_user\", \"\", time()-368000, $cookiepath);\r\n header(\"Location: \" . FULLWEBPATH . \"/\");\r\n}\r\n\r\nfunction zp_loggedin() {\r\n\t$_zp_loggedin = false;\r\n\tif (isset($_COOKIE['zenphoto_auth'])) {\r\n\t $saved_auth = $_COOKIE['zenphoto_auth'];\r\n\t $saved_user = $_COOKIE['zenphoto_user'];\r\n\t $query = \"SELECT * FROM users WHERE name='$saved_user' LIMIT 1\";\r\n\t $result = mysql_query($query) or die(mysql_error());\r\n\t $rows = mysql_num_rows($result);\r\n\t if ($rows>0){\r\n\t\t$r = mysql_fetch_assoc($result);\r\n\t\t$check_auth = md5($r['name'].$r['pass']);\r\n\t\tif ($saved_auth==$check_auth){ $_zp_loggedin = true; }\r\n\t }\r\n\t}\r\n return $_zp_loggedin;\r\n}\r\n\r\n\r\n?>\r\n\r\n\r\nExecute this SQL on your zenphoto table:\r\nCREATE TABLE users (\r\n`id` INT( 255 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,\r\n`name` VARCHAR( 255 ) NOT NULL ,\r\n`pass` VARCHAR( 255 ) NOT NULL ,\r\n`email` VARCHAR( 255 ) NOT NULL\r\n);\r\n\r\nINSERT INTO users (`name`,`pass`,`email`) VALUES ('admin',MD5('password'),'you@yourdomain.com');\r\n\r\n\r\nI recommend also changing the password info in the config file to something uninteresting.\r\n\r\nAlso, as always, I recommend doing a full backup before proceeding with these directions. YMMV. These directions are provided as-is with no warranty express or implied. You use this at your own risk.","bodyAsHTML":"
Multiple user accounts hack for zenPhoto\r\n\r\nI needed support for several users, not really for any fancy reason, just so there was no password sharing, so here's a quick hack I made that shouldn't be hard to extend to be a bit more useful if you desire.\r\n\r\nHopefully I have used this forum's tags correctly. If I haven't perhaps a mod can lend a hand in rectifying them. :)\r\n\r\n\r\nIn admin-functions.php:\r\nAfter:\r\n\techo \"\\n  \";\r\nAdd:\r\n\techo \"\\n  \";\r\n\r\nBefore:\r\n  echo \"\\n  \";\r\nAdd:\r\n  echo \"\\n     users\";\r\n\r\nIn admin.php\r\nAfter:\r\n    } else if ($action == 'settheme') {\r\n      if (isset($_GET['theme'])) {\r\n        $gallery->setCurrentTheme($_GET['theme']);\r\n      }\r\nAdd:\r\n\t  \r\n/** USERS ******************************************************************/\r\n/*****************************************************************************/\r\n\r\n    } else if ($action == 'updateUsers') {\r\n\t\t$uid = explode(\"_\",$_REQUEST['userid']);\r\n\t\t$uid = $uid[1];\r\n\t\t$name = $_REQUEST['username'];\r\n\t\t$pass = $_REQUEST['userpass'];\r\n\t\t$email = $_REQUEST['usermail'];\r\n\t\t$query = \"SELECT * FROM users WHERE name='$name' LIMIT 1\";\r\n\t\t$result = mysql_query($query) or die(mysql_error());\r\n\t\tif (mysql_num_rows($result)<1){\r\n\t\t\t//create new user\r\n\t\t\t$query = \"INSERT INTO users (`name`,`pass`,`email`) VALUES ('$name',MD5('$pass'),'$email')\";\r\n\t\t\t$result = mysql_query($query) or die(mysql_error());\r\n\t\t\t$r = mysql_insert_id();\r\n\t\t\tdie(\"$r\");\r\n\t\t}else{\r\n\t\t\t//update old user\r\n\t\t\t$query = \"UPDATE users SET \";\r\n\t\t\t$query .= \"name='$name'\";\r\n\t\t\tif (!empty($pass) && ($pass!=\"\")){ $query .= \",pass=MD5('$name')\"; }\r\n\t\t\t$query .= \",email='$email'\";\r\n\t\t\t$query .= \" WHERE id='$uid'\";\r\n\t\t\t$result = mysql_query($query) or die(mysql_error());\r\n\t\t\tdie(\"Save successful!\");\r\n\t\t}\r\n    } else if ($action == 'removeUsers') {\r\n\t\t$uid = explode(\"_\",$_REQUEST['userid']);\r\n\t\t$uid = $uid[1];\r\n\t\t$query = \"DELETE FROM users WHERE id='$uid' LIMIT 1\";\r\n\t\t$result = mysql_query($query) or die(mysql_error());\r\n\t}\r\n\r\nBefore:\r\n \r\nAdd:\r\n \r\n      \r\n    \r\n\t\r\n\t\r\n\t\r\n\t

User Management

\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\";\r\n\t\t\techo \"\t\";\r\n\t\t\techo \"\t\";\r\n\t\t\techo \"\t\";\r\n\t\t\techo \"\t\";\r\n\t\t\techo \"\";\r\n\t\t}\r\n\t\t?>\r\n\t
NamePasswordEmail
Add User
Delete | Edit\".$r['name'].\"Saved\".$r['email'].\"
\r\n\t \r\nReplace auth_zp.php with:\r\n0){\r\n\t$r = mysql_fetch_assoc($result);\r\n\t$check_auth = md5($r['name'].$r['pass']);\r\n }\r\n if ($rows>0 && $saved_auth==$check_auth) {\r\n $_zp_loggedin = true;\r\n } else {\r\n // Clear the cookie\r\n setcookie(\"zenphoto_auth\", \"\", time()-368000, $cookiepath);\r\n setcookie(\"zenphoto_user\", \"\", time()-368000, $cookiepath);\r\n }\r\n} else {\r\n // Handle the login form.\r\n if (isset($_POST['login']) && isset($_POST['user']) && isset($_POST['pass'])) {\r\n $user = $_POST['user'];\r\n $pass = MD5($_POST['pass']);\r\n $redirect = $_POST['redirect'];\r\n\t$query = \"SELECT * FROM users WHERE name='$user' AND pass='$pass' LIMIT 1\";\r\n\t$result = mysql_query($query) or die(mysql_error());\r\n if (mysql_num_rows($result)>0) {\r\n // Correct auth info. Set the cookie.\r\n setcookie(\"zenphoto_auth\", md5($user.$pass), time()+5184000, $cookiepath);\r\n setcookie(\"zenphoto_user\", $user, time()+5184000, $cookiepath);\r\n $_zp_loggedin = true;\r\n //// FIXME: Breaks IIS\r\n if (!empty($redirect)) { header(\"Location: \" . FULLWEBPATH . $redirect); }\r\n //// \r\n } else {\r\n // Clear the cookie, just in case\r\n setcookie(\"zenphoto_auth\", \"\", time()-368000, $cookiepath);\r\n setcookie(\"zenphoto_user\", \"\", time()-368000, $cookiepath);\r\n $error = true;\r\n }\r\n }\r\n}\r\nunset($saved_auth, $check_auth, $user, $pass);\r\n// Handle a logout action.\r\nif (isset($_POST['logout']) || isset($_GET['logout'])) {\r\n setcookie(\"zenphoto_auth\", \"\", time()-368000, $cookiepath);\r\n setcookie(\"zenphoto_user\", \"\", time()-368000, $cookiepath);\r\n header(\"Location: \" . FULLWEBPATH . \"/\");\r\n}\r\n\r\nfunction zp_loggedin() {\r\n\t$_zp_loggedin = false;\r\n\tif (isset($_COOKIE['zenphoto_auth'])) {\r\n\t $saved_auth = $_COOKIE['zenphoto_auth'];\r\n\t $saved_user = $_COOKIE['zenphoto_user'];\r\n\t $query = \"SELECT * FROM users WHERE name='$saved_user' LIMIT 1\";\r\n\t $result = mysql_query($query) or die(mysql_error());\r\n\t $rows = mysql_num_rows($result);\r\n\t if ($rows>0){\r\n\t\t$r = mysql_fetch_assoc($result);\r\n\t\t$check_auth = md5($r['name'].$r['pass']);\r\n\t\tif ($saved_auth==$check_auth){ $_zp_loggedin = true; }\r\n\t }\r\n\t}\r\n return $_zp_loggedin;\r\n}\r\n\r\n\r\n?>\r\n\r\n\r\nExecute this SQL on your zenphoto table:\r\nCREATE TABLE users (\r\n`id` INT( 255 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,\r\n`name` VARCHAR( 255 ) NOT NULL ,\r\n`pass` VARCHAR( 255 ) NOT NULL ,\r\n`email` VARCHAR( 255 ) NOT NULL\r\n);\r\n\r\nINSERT INTO users (`name`,`pass`,`email`) VALUES ('admin',MD5('password'),'you@yourdomain.com');\r\n
\r\n\r\nI recommend also changing the password info in the config file to something uninteresting.\r\n\r\nAlso, as always, I recommend doing a full backup before proceeding with these directions. YMMV. These directions are provided as-is with no warranty express or implied. You use this at your own risk.
","author":{"id":1018055,"username":"Snippets_User","realname":null,"emailHash":"7c2a6e78db5bc42c725740ccc54d15b6","avatar":"https://secure.gravatar.com/avatar/7c2a6e78db5bc42c725740ccc54d15b6?d=identicon&r=PG","reputation":0},"activeRevisionId":967536,"revisionIds":[967536],"lastActiveUserId":1018055,"lastActiveDate":1183858116000,"parentId":null,"parentAuthor":null,"originalParentId":null,"childrenIds":[],"commentIds":[],"marked":true,"topics":[],"primaryContainerId":8,"containerIds":[],"plug":"multiple-user-accounts-hack","wiki":false,"score":0,"depth":0},"enableThreadedComments":true,"contentType":"article"}],"loadedStyles":[["/lib/bootstrap/bootstrap.less","/lib/font-awesome/font-awesome.less","/lib/fontello/css/fontello.css","/lib/fontello/css/animation.css","/lib/angular-ui/select.css","/lib/ngDialog/css/ngDialog.css","/less/ngDialog-theme.less","/lib/bootstrap-switch/bootstrap-switch.css","/less/dzone20.less","/less/fonts.less","/less/directives.less","/lib/slick/slick.css","/lib/bootstrap-slider/bootstrap-slider.css","/less/layout.less","/widgets/article/content/article-content.less","/widgets/article/infoBar/widget.less","/widgets/components/slider/widget.less","/widgets/content/commentsSlider/widget.less","/widgets/header/blackBar/widget.less","/widgets/header/main/header-common.less","/widgets/header/main/widget.less","/widgets/sidebar/content/list/list.less","/widgets/sidebar/tapBar/sidebar-list.less","/widgets/sidebar/tapBar/widget.less","/widgets/users/UserHomeMiniProfile/widget.less"]],"loadedScripts":[["/lib/jquery/jquery.js","/lib/lodash/lodash.js","/lib/moment/moment.js","/scripts/utils.js","/lib/angular/angular.js","/lib/angular/angular-sanitize.js","/lib/local-storage/angular-local-storage.js","/lib/bootstrap/bootstrap.js","/lib/angular-ui/bootstrap.js","/lib/angular-ui/select.js","/lib/bootstrap-switch/bootstrap-switch.js","/lib/ngDialog/js/ngDialog.js","/lib/angular-moment/angular-moment.js","/scripts/app.js","/scripts/socket.js","/scripts/services.js","/scripts/ui-services.js","/scripts/directives.js","/scripts/filters.js","/lib/angular-touch/angular-touch.min.js","/lib/elastic/elastic.js","/lib/ng-file-upload/angular-file-upload-all.js","/lib/angular-deckgrid/angular-deckgrid.js","/scripts/dzone.js","/scripts/ads.js","/scripts/head.js","/scripts/links.js","/scripts/utilities/directives.js","/scripts/utilities/services.js","/scripts/utilities/image-editor.js","/lib/bootstrap-slider/bootstrap-slider.js","/lib/bootstrap-slider/directive.js","/lib/angular-draganddrop/draganddrop.js","/widgets/article/content/utils.js","/widgets/article/infoBar/services.js","/widgets/components/slider/service.js","/widgets/header/main/angulartics-ga.js","/widgets/header/main/angulartics.js","/widgets/header/main/resize.js","/widgets/sidebar/content/list/service.js","/widgets/sidebar/tapBar/directive.js","/widgets/sidebar/tapBar/service.js"]],"TH_CSRF":"-706351597247599092","botInfo":[{"isRenderBot":false}],"request":[{"site":{"id":7,"title":"DZone: Programming & DevOps news, tutorials & tools","keywords":"programming, software development, devops, java, agile, web, iot, database, mobile, big data, cloud","description":"Programming, Web Development, and DevOps news, tutorials and tools for beginners to experts. Hundreds of free publications, over 1M members, totally free.","name":"DZone.com"},"dev":false,"cdn":["dz2cdn1.dzone.com","dz2cdn2.dzone.com","dz2cdn3.dzone.com","dz2cdn4.dzone.com"],"theme":"dz20","context":"","user":{"id":2500002,"authenticated":false,"name":"Anonymous","realName":null,"avatar":"https://secure.gravatar.com/avatar/?d=identicon&r=PG","profile":"/users/2500002/anon-user.html"}}],"portals":[[{"topic":8,"id":2,"shortTitle":"agile-methodology-training-tools-news","color":"red","name":"Agile","code":"agile","url":"/agile-methodology-training-tools-news"},{"topic":6129,"id":3,"shortTitle":"big-data-analytics-tutorials-tools-news","color":"green","name":"Big Data","code":"big-data","url":"/big-data-analytics-tutorials-tools-news"},{"topic":30,"id":4,"shortTitle":"cloud-computing-tutorials-tools-news","color":"orange","name":"Cloud","code":"cloud","url":"/cloud-computing-tutorials-tools-news"},{"topic":59,"id":5,"shortTitle":"database-sql-nosql-tutorials-tools-news","color":"purple","name":"Database","code":"database","url":"/database-sql-nosql-tutorials-tools-news"},{"topic":31,"id":6,"shortTitle":"devops-tutorials-tools-news","color":"yellow","name":"DevOps","code":"devops","url":"/devops-tutorials-tools-news"},{"topic":1138,"id":7,"shortTitle":"enterprise-integration-training-tools-news","color":"green","name":"Integration","code":"integration","url":"/enterprise-integration-training-tools-news"},{"topic":48,"id":8,"shortTitle":"iot-developer-tutorials-tools-news-reviews","color":"orange","name":"IoT","code":"iot","url":"/iot-developer-tutorials-tools-news-reviews"},{"topic":1,"id":1,"shortTitle":"java-jdk-development-tutorials-tools-news","color":"purple","name":"Java","code":"java","url":"/java-jdk-development-tutorials-tools-news"},{"topic":29,"id":9,"shortTitle":"mobile-app-developer-tutorials-tools-news","color":"yellow","name":"Mobile","code":"mobile","url":"/mobile-app-developer-tutorials-tools-news"},{"topic":653,"id":10,"shortTitle":"apm-tools-performance-monitoring-optimization","color":"red","name":"Performance","code":"performance","url":"/apm-tools-performance-monitoring-optimization"},{"topic":35,"id":11,"shortTitle":"web-development-programming-tutorials-tools-news","color":"orange","name":"Web Dev","code":"webdev","url":"/web-development-programming-tutorials-tools-news"}]],"matchedUrl":{"name":"dzone:articles:view","mapping":"/articles/**","mappingPatterns":{}},"requiresModule":["angulartics","angulartics.google.analytics","dndLists","generalDirectives","monospaced.elastic","angularFileUpload","akoenig.deckgrid","ui.bootstrap-slider","ngSanitize","ui.select","ui.bootstrap","angularMoment","ngTouch","ngDialog","LocalStorageModule"]}; } catch(e) { console.error(e); }
4
Notification
  • Adam Van Grack started following you

  • Jessica Conaghan, Gumption Scott and 6 commented on a link you posted

    T-Mobile Unvells Cheaper, More Basic 'Simple Prepaid' Phone Plans

  • Jessica Conaghan replied on a comment you posted

    CSS counters are one of those "oh neat, didn't know CSS could do that" features with a lot of Xubuntu 14.10 Utopic Unicorn is the latest release of xubuntu based on Ubuntu 14.10

  • Jessica Conaghan started following you

See All
POWERED BY DZone TeamHub
\";\r\nAdd:\r\n\techo \"\\n \";\r\n\r\nBefore:\r\n echo \"\\n \";\r\nAdd:\r\n echo \"\\n users\";\r\n\r\nIn admin.php\r\nAfter:\r\n } else if ($action == 'settheme') {\r\n if (isset($_GET['theme'])) {\r\n $gallery->setCurrentTheme($_GET['theme']);\r\n }\r\nAdd:\r\n\t \r\n/** USERS ******************************************************************/\r\n/*****************************************************************************/\r\n\r\n } else if ($action == 'updateUsers') {\r\n\t\t$uid = explode(\"_\",$_REQUEST['userid']);\r\n\t\t$uid = $uid[1];\r\n\t\t$name = $_REQUEST['username'];\r\n\t\t$pass = $_REQUEST['userpass'];\r\n\t\t$email = $_REQUEST['usermail'];\r\n\t\t$query = \"SELECT * FROM users WHERE name='$name' LIMIT 1\";\r\n\t\t$result = mysql_query($query) or die(mysql_error());\r\n\t\tif (mysql_num_rows($result)<1){\r\n\t\t\t//create new user\r\n\t\t\t$query = \"INSERT INTO users (`name`,`pass`,`email`) VALUES ('$name',MD5('$pass'),'$email')\";\r\n\t\t\t$result = mysql_query($query) or die(mysql_error());\r\n\t\t\t$r = mysql_insert_id();\r\n\t\t\tdie(\"$r\");\r\n\t\t}else{\r\n\t\t\t//update old user\r\n\t\t\t$query = \"UPDATE users SET \";\r\n\t\t\t$query .= \"name='$name'\";\r\n\t\t\tif (!empty($pass) && ($pass!=\"\")){ $query .= \",pass=MD5('$name')\"; }\r\n\t\t\t$query .= \",email='$email'\";\r\n\t\t\t$query .= \" WHERE id='$uid'\";\r\n\t\t\t$result = mysql_query($query) or die(mysql_error());\r\n\t\t\tdie(\"Save successful!\");\r\n\t\t}\r\n } else if ($action == 'removeUsers') {\r\n\t\t$uid = explode(\"_\",$_REQUEST['userid']);\r\n\t\t$uid = $uid[1];\r\n\t\t$query = \"DELETE FROM users WHERE id='$uid' LIMIT 1\";\r\n\t\t$result = mysql_query($query) or die(mysql_error());\r\n\t}\r\n\r\nBefore:\r\n \r\nAdd:\r\n \r\n \r\n \r\n\t\r\n\t\r\n\t\r\n\t

User Management

\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\";\r\n\t\t\techo \"\t\";\r\n\t\t\techo \"\t\";\r\n\t\t\techo \"\t\";\r\n\t\t\techo \"\t\";\r\n\t\t\techo \"\";\r\n\t\t}\r\n\t\t?>\r\n\t
NamePasswordEmail
Add User
Delete | Edit\".$r['name'].\"Saved\".$r['email'].\"
\r\n\t \r\nReplace auth_zp.php with:\r\n0){\r\n\t$r = mysql_fetch_assoc($result);\r\n\t$check_auth = md5($r['name'].$r['pass']);\r\n }\r\n if ($rows>0 && $saved_auth==$check_auth) {\r\n $_zp_loggedin = true;\r\n } else {\r\n // Clear the cookie\r\n setcookie(\"zenphoto_auth\", \"\", time()-368000, $cookiepath);\r\n setcookie(\"zenphoto_user\", \"\", time()-368000, $cookiepath);\r\n }\r\n} else {\r\n // Handle the login form.\r\n if (isset($_POST['login']) && isset($_POST['user']) && isset($_POST['pass'])) {\r\n $user = $_POST['user'];\r\n $pass = MD5($_POST['pass']);\r\n $redirect = $_POST['redirect'];\r\n\t$query = \"SELECT * FROM users WHERE name='$user' AND pass='$pass' LIMIT 1\";\r\n\t$result = mysql_query($query) or die(mysql_error());\r\n if (mysql_num_rows($result)>0) {\r\n // Correct auth info. Set the cookie.\r\n setcookie(\"zenphoto_auth\", md5($user.$pass), time()+5184000, $cookiepath);\r\n setcookie(\"zenphoto_user\", $user, time()+5184000, $cookiepath);\r\n $_zp_loggedin = true;\r\n //// FIXME: Breaks IIS\r\n if (!empty($redirect)) { header(\"Location: \" . FULLWEBPATH . $redirect); }\r\n //// \r\n } else {\r\n // Clear the cookie, just in case\r\n setcookie(\"zenphoto_auth\", \"\", time()-368000, $cookiepath);\r\n setcookie(\"zenphoto_user\", \"\", time()-368000, $cookiepath);\r\n $error = true;\r\n }\r\n }\r\n}\r\nunset($saved_auth, $check_auth, $user, $pass);\r\n// Handle a logout action.\r\nif (isset($_POST['logout']) || isset($_GET['logout'])) {\r\n setcookie(\"zenphoto_auth\", \"\", time()-368000, $cookiepath);\r\n setcookie(\"zenphoto_user\", \"\", time()-368000, $cookiepath);\r\n header(\"Location: \" . FULLWEBPATH . \"/\");\r\n}\r\n\r\nfunction zp_loggedin() {\r\n\t$_zp_loggedin = false;\r\n\tif (isset($_COOKIE['zenphoto_auth'])) {\r\n\t $saved_auth = $_COOKIE['zenphoto_auth'];\r\n\t $saved_user = $_COOKIE['zenphoto_user'];\r\n\t $query = \"SELECT * FROM users WHERE name='$saved_user' LIMIT 1\";\r\n\t $result = mysql_query($query) or die(mysql_error());\r\n\t $rows = mysql_num_rows($result);\r\n\t if ($rows>0){\r\n\t\t$r = mysql_fetch_assoc($result);\r\n\t\t$check_auth = md5($r['name'].$r['pass']);\r\n\t\tif ($saved_auth==$check_auth){ $_zp_loggedin = true; }\r\n\t }\r\n\t}\r\n return $_zp_loggedin;\r\n}\r\n\r\n\r\n?>\r\n\r\n\r\nExecute this SQL on your zenphoto table:\r\nCREATE TABLE users (\r\n`id` INT( 255 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,\r\n`name` VARCHAR( 255 ) NOT NULL ,\r\n`pass` VARCHAR( 255 ) NOT NULL ,\r\n`email` VARCHAR( 255 ) NOT NULL\r\n);\r\n\r\nINSERT INTO users (`name`,`pass`,`email`) VALUES ('admin',MD5('password'),'you@yourdomain.com');\r\n\r\n\r\nI recommend also changing the password info in the config file to something uninteresting.\r\n\r\nAlso, as always, I recommend doing a full backup before proceeding with these directions. YMMV. These directions are provided as-is with no warranty express or implied. You use this at your own risk.","source":null,"views":12,"articleDate":1183858116000,"tldr":null,"originalSource":"","published":true,"nComments":0,"articleType":"snippet"}]; WMODEL_DATA.perms = {"canDecidePick":false,"canPublish":false}; WMODEL_DATA.isPreview = false; WMODEL_DATA.OPTIONS = {}; TH.installWidgetController('article.content', 'articleContent7', WMODEL_DATA, typeof controller == 'function' ? controller : null, [{name: 'partners', data: true},{name: 'DEFAULT', data: true}], ' oUhbblYOaqbcblYOaqbcC', null); })(); (function() { function controller($scope, $service, $location, SideBarService, TH$Request) { SideBarService.ctx.pageSize = $scope.pageSize; SideBarService.ctx.isPreview = $scope.isPreview; SideBarService.ctx.mode = $scope.mode; SideBarService.fn.loader = $service; SideBarService.fn.scrollCheck = function() { $scope.$emit('thIfScrollCheck'); }; var currentFilter; $scope.$on('$locationChangeSuccess', function() { if (!$location.search().filter) { $scope.filter = 'latest'; } else { $scope.filter = $location.search().filter; if ($scope.filter == 'latest') { $location.search('filter', null); } } if (currentFilter == $scope.filter) { return; } currentFilter = $scope.filter; SideBarService.ctx.filter = $scope.filter; }); $scope.display = SideBarService.getList(); $scope.$watchCollection(function() { return SideBarService.getList(); }, function (n) { $scope.display = n; }); $scope.isActive = SideBarService.isActive; $scope.isExcluded = SideBarService.isExcluded; $scope.loadMore = SideBarService.load; $scope.loading = function() { return SideBarService.ctx.loading; } } var WMODEL_DATA = {}; WMODEL_DATA.pageSize = 20; WMODEL_DATA.isPreview = false; WMODEL_DATA.OPTIONS = {}; WMODEL_DATA.mode = null; TH.installWidgetController('sidebar.content.list', 'sidebarContentList10', WMODEL_DATA, typeof controller == 'function' ? controller : null, [{name: 'DEFAULT', data: true}], ' oUhbkSMaaqbcdvVkcC', null); })(); (function() { var WMODEL_DATA = {}; WMODEL_DATA.OPTIONS = {}; TH.installWidgetController('sidebar.tapBar', 'sidebar', WMODEL_DATA, typeof controller == 'function' ? controller : null, null, ' oUhbkSMadabfWVcC oUhbkSMadabbWQbVkcC', null); })(); (function() { function controller($scope, shareThis, TH$Dialog, TH$Service) { $scope.getEditUrl = function(id, type) { if (!type || type == 'article') { return '/content/' + id + '/edit.html'; } else { return '/dzone/staff/' + type + (type == 'refcard' ? 'z' : 's') + '/' + id + '/edit.html'; } } $scope.share = function(socialNet, url, title){ shareThis.shareThis(socialNet, url, title); }; $scope.canDelete = function(article) { return article.canDelete; } $scope.edit = function(link) { TH$Dialog.open({ loadWidget: 'links.postPreview', widgetArgs: { edit: link.id }, size: 'xbig' }).then(function (result) { $scope.link.title = result.title; $scope.link.linkDescription = result.content; $scope.link.thumb = result.thumb; $scope.link.tags = result.topics; }); }; $scope.deleteLink = function(article) { var title = article.title; var type = 'link'; if(article.header){ title = (article.header.type == 'article') ? article.header.title : article.title; type = (article.header.type == 'article') ? 'article' : 'link'; } TH$Dialog.confirm('Do you want to delete "' + title + '"?').then(function() { return TH$Service.action('delete', {type: type, id: article.id}); }).then(function() { article.deleted = true; }); }; } var WMODEL_DATA = {}; WMODEL_DATA.OPTIONS = {}; TH.installWidgetController('content.commentsSlider', 'contentCommentsSlider9', WMODEL_DATA, typeof controller == 'function' ? controller : null, null, ' oUhbaqbcaibvnWffWVcC', null); })(); (function() { var WMODEL_DATA = {}; WMODEL_DATA.name = "commentsSlider"; WMODEL_DATA.slot = null; WMODEL_DATA.OPTIONS = {"name":"commentsSlider"}; TH.installWidgetController('components.slider', 'componentsSlider8', WMODEL_DATA, typeof controller == 'function' ? controller : null, null, ' oUhballbvbdSaoUhM', null); })();