?
Solved

Log in to CMS (Xoops) and post a news article with ICS

Posted on 2005-03-29
19
Medium Priority
?
278 Views
Last Modified: 2010-04-05
I'd like an example on how I'd log in to XOOPS and send a news article, using ICS.
Not so important but also needed, how you'd send a picture to a web gallery system.

Thanks
0
Comment
Question by:bryan7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 9
19 Comments
 
LVL 26

Expert Comment

by:EddieShipman
ID: 13663681
Xoops admin would require authorization, I believe and as such, you would have
to first authenticate yourself, then transmit the article files and/or images.

I think xoops uses a cookie based authentication system, not PHP sessionIDs
but don't quote me on that one. I will take a look at it to see.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 13663842
Yep, looks like it uses both, PHPSESSID and it is stored in a COOKIE named PHPSESSID.
0
 
LVL 3

Author Comment

by:bryan7
ID: 13666596
Yup, it would use a user account to log in then send the article, under /modules/news/submit.php

I guess it's similar for a forum post and that kind of scripts. I would love an example on how
to do this with ICS.

Thanks
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Author Comment

by:bryan7
ID: 13670378
raised points to 500
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 13671799
I will try to do it on the xoops.org sample site and get back with you.
0
 
LVL 3

Author Comment

by:bryan7
ID: 13672420
thanks, ill grade answer with max points =)
0
 
LVL 3

Author Comment

by:bryan7
ID: 13680939
How can I raise points again ?
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 13681385
500 is maximum.
0
 
LVL 3

Author Comment

by:bryan7
ID: 13681984
ill give you another 250 best graded in a new q if you can make it quick =)
0
 
LVL 3

Author Comment

by:bryan7
ID: 13701118
make that 500 (total 1000*grade)
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 13702012
Just starting to work on it. I was really busy this weekend.
0
 
LVL 3

Author Comment

by:bryan7
ID: 13745667
no luck ? =(
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 13752413
I could not find it. I know it is there but they changed the site.
0
 
LVL 3

Author Comment

by:bryan7
ID: 13753899
I will install a xoops demo site for you, please let me know your email for details
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 13755387
mr_delphi_developer at yahoo dot com
0
 
LVL 3

Author Comment

by:bryan7
ID: 13757065
ok, I installed a demo site and emailed you login info
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 13757300
got it, will take a look tomorrow..

0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 2000 total points
ID: 13997444
OK, Brian, I was able to add articles. I forgot to set the referer and
that was what the problem was.


procedure TForm1.Button1Click(Sender: TObject);
var
 aStream: TMemoryStream;
 Params:  TStringStream;
 HTML:    TStringList;
 PHPSESSID: String;
begin
 aStream := TMemoryStream.create;
 Params := TStringStream.create('');
 try
   // Have to login, first
   with IdHTTP1 do
   begin
     Params.WriteString(URLEncode('uname=' + 'admin' + '&'));
     Params.WriteString(URLEncode('pass=' + 'abcde' + '&'));
     Params.WriteString(URLEncode('xoops_redirect=' + '/xoops/' + '&'));
     Params.WriteString(URLEncode('op=' + 'login' + '&'));
     Params.WriteString(URLEncode('submit=' + 'User Login'));
     Request.ContentType := 'application/x-www-form-urlencoded';
     try
       Post('http://dreaminghost.com/xoops/user.php', Params, aStream);
     except
       on E: Exception do
         showmessage('Error encountered during POST: ' + E.Message);
     end;
   end;
   aStream.WriteBuffer(#0' ', 1);
   aStream.Position := 0;
   HTML := TStringList.Create;
   try
     HTML.LoadFromStream(aStream);
   finally
     PHPSESSID := Copy(HTML.Text, Pos('?PHPSESSID=', HTML.Text) + 11, Length(HTML.Text));
     PHPSESSID := Copy(PHPSESSID, 1, Pos('"', PHPSESSID)-1);
     HTML.Free;
   end;
   // Logged in, got the HPPSSESSID, now post the news article:
   aStream.Free;
   aStream := TMemoryStream.create;
   Params.Free;
   Params := TStringStream.create('');
   with IdHTTP1 do
   begin
     Params.WriteString(URLEncode('PHPSESSID=' + PHPSESSID + '&'));
     Params.WriteString(URLEncode('subject=' + 'This is the Article subject' + '&'));
     Params.WriteString(URLEncode('topic_id=' + '1' + '&'));
     Params.WriteString(URLEncode('messageSize=' + 'medium' + '&'));
     Params.WriteString(URLEncode('messageFont=' + 'Helvetica' + '&'));
     Params.WriteString(URLEncode('messageColor=' + '000033' + '&'));
     Params.WriteString(URLEncode('message=' + Memo1.Lines.Text + '&'));
     Params.WriteString(URLEncode('notifypub=' + '1' + '&'));
     Params.WriteString(URLEncode('nohtml=' + '1' + '&'));
     Params.WriteString(URLEncode('nosmiley=' + '1' + '&'));
     Params.WriteString(URLEncode('post=' + 'Post'));
     Request.ContentType := 'application/x-www-form-urlencoded';
     //
     // MUST have this for the article to be posted!
     //
     Request.Referer := 'http://dreaminghost.com/xoops/modules/news/submit.php';
     //
     try
       Post('http://dreaminghost.com/xoops/modules/news/submit.php', Params, aStream);
     except
       on E: Exception do
         showmessage('Error encountered during POST: ' + E.Message);
     end;
   end;
   aStream.WriteBuffer(#0' ', 1);
   aStream.Position := 0;
   Memo1.Lines.LoadFromStream(aStream);
 except
   aStream.Free;
   Params.Free;
 end;
end;
0
 
LVL 3

Author Comment

by:bryan7
ID: 14000162
Accepted, A graded, thanks so much =) Posting a new empty question for your other points.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month9 days, 23 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question