HTML Login, Is it possible?

Last post 03-08-2011 21:06 by csphotograph. 53 replies.
Page 1 of 4 (54 items) 1 2 3 4 Next >
Next
Previous
Sort Posts:
  • csphotograph 01-14-2010 9:36

    • Top 500 Contributor
    • Joined on 01-14-2010
    • Posts: 22

    HTML Login, Is it possible?

    I am trying to make a simple html login so that it will be easier for my clients to get to their galleries. On my main site I have a client login section where I would like my clients to be able to input their gallery code (eg: p10326872) and password. Once they click login the POST argument is passed to zenfolio login script, but obviously it does not work.

     

    <form id="zlogin" name="zlogin" action="http://domain.tld/zf/layout/password.ashx" method="post">
    Gallery code: <input type="text" id="gcode" name="gcode" onKeyUp="document.getElementById('url').value='http://domain.tld/'+this.value" />
    Gallery password: <input type="password" id="password" name="password" />
    <input type="hidden" id="url" name="url" value="" />
    <input name="realmId" type="hidden" value="null" />
    <input type="submit" value="Login">
    </form>

    Any ideas on how to get this working?

    Filed under: ,
  • AF [Zenfolio] 01-14-2010 9:42 In reply to

    • Top 10 Contributor
    • Joined on 03-01-2008
    • San Francisco Bay Area, California
    • Posts: 1,077

    Re: HTML Login, Is it possible?

    Please see this thread: http://forums.zenfolio.com/forums/p/3152/16910.aspx. This is the supported way of doing it.

    -- AF [Zenfolio]
  • csphotograph 01-14-2010 11:13 In reply to

    • Top 500 Contributor
    • Joined on 01-14-2010
    • Posts: 22

    Re: HTML Login, Is it possible?

    This is what I need to do correct?

    1.) Get keyring (Trying to find in the API doc on how to obtain a keyring)
    2.) Get realmId (http://www.zenfolio.com/api/1.2/zfapi.asmx/LoadPhotoSet?photosetId=p1060563831 : returns : Cannot convert p1060563831 to System.Int32. Parameter name: type ---> Input string was not in a correct format.)
    3.) Pass all keyring, realmid, and password to get final key for zf_keyring cookie?
    4.) Finding examples on using curl with zenfolio: PHP

     

    function callback($argument){
    	$ch = curl_init();
    	curl_setopt($ch, CURLOPT_URL, $argument);
    	curl_setopt($ch, CURLOPT_HEADER, 0);
    	curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
    	$site = curl_exec($ch);
    	curl_close($ch);
    	return $site;
    }
    
    function getRealm(){
    	$argument = "http://www.zenfolio.com/api/1.2/zfapi.asmx/LoadPhotoSet?photosetId=p1060563831";
    	$dsp = callback($argument);
    	echo($dsp);
    }
    
    getRealm();
    
    Filed under: , ,
  • AF [Zenfolio] 01-14-2010 11:23 In reply to

    • Top 10 Contributor
    • Joined on 03-01-2008
    • San Francisco Bay Area, California
    • Posts: 1,077

    Re: HTML Login, Is it possible?

    1) API documentation can be found here: http://www.zenfolio.com/zf/help/api.

    2) LoadPhotoSet accepts an integer ID as its parameter (which can be found in the documentation). For your photoset the ID is 1060563831.

    3) The value of the zf_keyring cookie is the keyring. You obtain that from KeyringAddKeyPlain by passing it an initial keyring (empty string), realmId and the password.

    -- AF [Zenfolio]
  • csphotograph 01-14-2010 13:05 In reply to

    • Top 500 Contributor
    • Joined on 01-14-2010
    • Posts: 22

    Re: HTML Login, Is it possible?

    Thanks, I got all the way down to step 3, but I am having issues getting the domain to set.
    domain.com -> cookie will set
    .domain.com -> cookie will set
    clients.domain.com -> will not set : my zenfolio is under clients.domain.com
    .clients.domain.com -> will not set

    do you have any ideas to work around this. I keep reading your original reply about scoping, but I think I hit a dead end. I am currently using PHP to set the cookie.

    Filed under: , , ,
  • csphotograph 01-14-2010 13:38 In reply to

    • Top 500 Contributor
    • Joined on 01-14-2010
    • Posts: 22

    Re: HTML Login, Is it possible?

    I got it. Had to use setrawcookie instead of setcookie.

  • scottwyden 02-17-2010 18:06 In reply to

    • Top 500 Contributor
    • Joined on 07-27-2009
    • Posts: 23

    Re: HTML Login, Is it possible?

    I have been trying to do this on my Wordpress site to make it easier for customers..  Can you make how you do it public so that the many of us who want this ability but don't understand coding can take advantage of the great word you did?  What do you think?

    Scott Wyden Kivowitz
    http://www.scottwyden.com
  • csphotograph 02-17-2010 21:33 In reply to

    • Top 500 Contributor
    • Joined on 01-14-2010
    • Posts: 22

    Re: HTML Login, Is it possible?

    I will post the code as soon as I get over this cold.

  • scottwyden 02-18-2010 4:05 In reply to

    • Top 500 Contributor
    • Joined on 07-27-2009
    • Posts: 23

    Re: HTML Login, Is it possible?

    Sounds great!!

    Scott Wyden Kivowitz
    http://www.scottwyden.com
  • csphotograph 02-18-2010 20:33 In reply to

    • Top 500 Contributor
    • Joined on 01-14-2010
    • Posts: 22

    Re: HTML Login, Is it possible?

    cLogin.php:
    Requirements: PHP5 & You must be using your own domain name with zenfolio.
    Replace ZENFOLIOURL with your Zenfolio URL
    Replace YOURDOMAIN with your Web site Domain
    *This script is incomplete, but still functional.

     

    function callback($argument){
    $useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $argument);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    $site = curl_exec($ch);
    curl_close($ch);
    return $site;
    }

    function getRealm($photosetID, $passWord){
    $argument = "http://www.zenfolio.com/api/1.2/zfapi.asmx/LoadPhotoSet?photosetId=$photosetID";
    $dsp = callback($argument);
    $xml = simplexml_load_string($dsp);
    $realmid = $xml->TitlePhoto->AccessDescriptor->RealmId;
    $argument = "http://www.zenfolio.com/api/1.2/zfapi.asmx/KeyringAddKeyPlain?keyring=&realmId=$realmid&password=$passWord";
    $dsp = callback($argument);
    $xml = simplexml_load_string($dsp);
    if(!$xml->faultcode):
    $finalkey = $xml[0];
    setrawcookie("zf_keyring", urldecode($finalkey), time()+3600, "/", "YOURDOMAIN", 0);
    header("Location: http://YOURZENFOLIOURL/p".$photosetID);
    else:
    echo "NAY";
    endif;
    }


    if(isset($_POST['submit']) && isset($_POST['gcode']) && isset($_POST['password']) && isset($_POST['private'])):
    if(preg_match('/^p\d+$/', $_POST['gcode']) && preg_match('/^[A-Za-z0-9]+$/', $_POST['password'])):
    $photosetID = str_replace("p", "", $_POST['gcode']);
    getRealm($photosetID, $_POST['password']);
    else:
    return false;
    endif;
    endif;

    HTML FORM:

     

    <p style="width:236px; margin:16px 0px 0px 20px; font-weight:bold;">To view your album enter your gallery number and passcode.</p> <form style="width:236px; margin:16px 0px 0px 20px;" method="post" action="/classes/cLogin.php"> <p><label style="float:left; width:70px; margin-right:6px; font-size:12px">Gallery #:</label><input style="background:#226286; color:#FFF; border:solid 1px #1a5576;" mce_style="background:#226286; color:#FFF; border:solid 1px #1a5576;" type="text" name="gcode" id="gcode" /></p> <p><label style="float:left; width:70px; margin-right:6px; font-size:12px">Passcode:</label><input style="background:#226286; color:#FFF; border:solid 1px #1a5576;" mce_style="background:#226286; color:#FFF; border:solid 1px #1a5576;" type="password" name="password" id="password" /></p> <p style="visibility:hidden;" mce_style="visibility:hidden;"><input type="hidden" name="private" id="private" value="true" /></p> <p><input type="image" src="../images/loginbtn.png" mce_src="/forums/images/loginbtn.png" name="submit" id="submit" value="Login" style="margin:10px 0px 0px 0px; border:0;" mce_style="margin:10px 0px 0px 0px; border:0;" border="0" /></p> </form>

  • scottwyden 02-19-2010 4:44 In reply to

    • Top 500 Contributor
    • Joined on 07-27-2009
    • Posts: 23

    Re: HTML Login, Is it possible?

    Thanks so much!! That worked perfectly.  

    Hopefully Zenfolio gets their full Wordpress integration soon to make the transition fluid but this will do for now! 

     

    Thank you again!

    Scott

    Scott Wyden Kivowitz
    http://www.scottwyden.com
  • Cfitz 02-22-2010 21:19 In reply to

    • Top 500 Contributor
    • Joined on 02-12-2010
    • Posts: 16

    Re: HTML Login, Is it possible?

    Hi Scott & CS,

    Thanks for putting up the info for a login page.   I'm very close to making this work based on your code CS and by looking at your site Scott. So thanks to both of you.

    My questions are replacing the urls in the PHP script because it's not working (it just comes back with the php script reading in the browser.)

    CS your directions:

    cLogin.php:
    Requirements: PHP5 & You must be using your own domain name with zenfolio.
    I believe we have php5 (should be at godaddy), and domain name is set and works fine.


    Replace ZENFOLIOURL with your Zenfolio URL

    Is this 'http://www.zenfolio.com/myaccountpage/in other words the base url that shows when editing etc?

    Replace YOURDOMAIN with your Web site Domain 

    Is this 'www.clients.mydomain.com'  (the subdomain we set up that points to Zenfolio) ?

    Appreciate any advice,

    Cfitz

     

    Cfitz
    photogenerations.com

    ...attitude is everything...
    Filed under: , ,
  • scottwyden 02-23-2010 4:06 In reply to

    • Top 500 Contributor
    • Joined on 07-27-2009
    • Posts: 23

    Re: HTML Login, Is it possible?

    my ZENFOLIOURL is photos.scottwyden.com

    and my YOURDOMAIN is scottwyden.com

    Scott Wyden Kivowitz
    http://www.scottwyden.com
  • Cfitz 02-23-2010 18:36 In reply to

    • Top 500 Contributor
    • Joined on 02-12-2010
    • Posts: 16

    Re: HTML Login, Is it possible?

    hmm Scott, thanks fo the tip but, still not working-tried this  

    ZENFOLIOURL     express.photogenerations.com

    and YOURDOMAIN photogenerations.com

    and the variations of --www.   &  http://www. -- and still not working.

    Im using wordpress...creating a page...tried the php code two ways in html body code and without & that didnt help either...its something simple....

    the gallery # I entered without the 'p' just the numbers, and with the 'p' and still no work.

    Just keep getting back the php code....when I hit the submit button....

    any more ideas?

    Cfitz
    photogenerations.com

    ...attitude is everything...
    Filed under: ,
  • Cfitz 02-23-2010 18:36 In reply to

    • Top 500 Contributor
    • Joined on 02-12-2010
    • Posts: 16

    Re: HTML Login, Is it possible?

    hmm Scott, thanks fo the tip but, still not working-tried this  

    ZENFOLIOURL     express.photogenerations.com

    and YOURDOMAIN photogenerations.com

    and the variations of --www.   &  http://www. -- and still not working.

    Im using wordpress...creating a page...tried the php code two ways in html body code and without & that didnt help either...its something simple....

    the gallery # I entered without the 'p' just the numbers, and with the 'p' and still no work.

    Just keep getting back the php code....when I hit the submit button....

    any more ideas?

    Cfitz
    photogenerations.com

    ...attitude is everything...
    Filed under: ,
Page 1 of 4 (54 items) 1 2 3 4 Next >