Adding a new page to jisko

Asked by Cyrusmark

Hi

i just want to add a new page to my jisko website and i need to be sure that the user already signed in in jisko and then he/she can reach to my page . I think i need a certification code that is using in all jisko pages but i can't find it at this time ... and it's great if i can find out the person's username so i can welcome him in that page .

thanks for your support

Question information

Language:
English Edit question
Status:
Solved
For:
Jisko Edit question
Assignee:
No assignee Edit question
Solved by:
Marcos Garcia
Solved:
Last query:
Last reply:
Revision history for this message
Marcos Garcia (marcosgdf) said :
#1

It's very easy:

<?php

global $_USER;
if ($_USER) {

}

?>

You have to put your code between the '{ }'

Regards, Marcos :)

enviado desde mi HTC.

marcos garcia. <email address hidden>

El 04/03/2010 13:06, "Cyrusmark" <email address hidden>
escribió:

New question #103188 on Jisko:
https://answers.launchpad.net/jisko/+question/103188

Hi

i just want to add a new page to my jisko website and i need to be sure that
the user already signed in in jisko and then he/she can reach to my page . I
think i need a certification code that is using in all jisko pages but i
can't find it at this time ... and it's great if i can find out the person's
username so i can welcome him in that page .

thanks for your support

--
You received this question notification because you are an answer
contact for Jisko.

Revision history for this message
Cyrusmark (a18293) said :
#2

i tried your sample page but it doesn't work !! i think i need to include some files for using : global $_USER !!??

Revision history for this message
Best Marcos Garcia (marcosgdf) said :
#3

Remember to edit includes/router.php to allow your file to be loaded into
Jisko, like...:

case 'mypage':
require ........
break;

enviado desde mi HTC.

marcos garcia. <email address hidden>

El 04/03/2010 23:52, "Cyrusmark" <email address hidden>
escribió:

Question #103188 on Jisko changed:

https://answers.launchpad.net/jisko/+question/103188
   Status: Answered => Open

Cyrusmark is still having a problem:
i tried your sample page but it doesn't work !! i think i need to
include some files for using : global $_USER !!??

--

You received this question notification because you are an answer
contact for Jisko.

Revision history for this message
Cyrusmark (a18293) said :
#4

Thanks Marcos Garcia, that solved my question.

Revision history for this message
encore (kandiki) said :
#5

Hi Marcos Garcia,

For me it works fine,
i have included a page to search for our local phone directory in Maldives. its working fine as i have a very updated database of all the directory contacts. (FYI: the current database i am testing with jisko doesn't have the full contacts its just a few contact for testing)

currently i am using a separate db connection for this on separate db. i wish i could use the same database as jisko is using to have a table of my directory and would appreciate if you could help me how to integrate the directory within jisko with no errors. currently i used to get few error messages in the side bar. if you like to have a look http://mvgeek.com/dir you will need to register to search any contact, also if you would like to see the error you will have login and search a contact.

i want to know how to use the database connection query to search in the jisko, as it was coded. so i will be able to ingrate my directory into jisko without errors.

Thanx, yr help is appreciated

Revision history for this message
Marcos Garcia (marcosgdf) said :
#6

How are you connecting to your second database? Maybe it is creating a
connection conflict with Jisko's database.

To integrate your table into Jisko's database you only need to import it
into that database. To create queries:

global $db;

$query = $db->send('myquery');

Regards, Marcos.

On Fri, Mar 26, 2010 at 1:16 AM, encore <
<email address hidden>> wrote:

> Question #103188 on Jisko changed:
> https://answers.launchpad.net/jisko/+question/103188
>
> encore posted a new comment:
> Hi Marcos Garcia,
>
> For me it works fine,
> i have included a page to search for our local phone directory in Maldives.
> its working fine as i have a very updated database of all the directory
> contacts. (FYI: the current database i am testing with jisko doesn't have
> the full contacts its just a few contact for testing)
>
> currently i am using a separate db connection for this on separate db. i
> wish i could use the same database as jisko is using to have a table of
> my directory and would appreciate if you could help me how to integrate
> the directory within jisko with no errors. currently i used to get few
> error messages in the side bar. if you like to have a look
> http://mvgeek.com/dir you will need to register to search any contact,
> also if you would like to see the error you will have login and search a
> contact.
>
> i want to know how to use the database connection query to search in the
> jisko, as it was coded. so i will be able to ingrate my directory into
> jisko without errors.
>
> Thanx, yr help is appreciated
>
> --
> You received this question notification because you are an answer
> contact for Jisko.
>

--
marcos garcía // <email address hidden>

Revision history for this message
encore (kandiki) said :
#7

Marcos,

currently am using a different database with different database connection to it. i want to use the same jisko's db for my directory search.

Anyway, i will be using the jisko's db as uhave mentioned above, i will let you know how it goes.

Also i would like to show an ajax notification to the users who tries to search the directory without login in. currently it does not give any message out put if they search without registering. i want them to be notified if they search.

Regards,
encore

Revision history for this message
Marcos Garcia (marcosgdf) said :
#8

you can do for example:

global $_USER;

if (!$_USER) header('Location: '.BASE);
else {

//thecode
}

at the top of the file

Regards, Marcos.

On Fri, Mar 26, 2010 at 4:04 PM, encore <
<email address hidden>> wrote:

> Question #103188 on Jisko changed:
> https://answers.launchpad.net/jisko/+question/103188
>
> encore posted a new comment:
> Marcos,
>
> currently am using a different database with different database
> connection to it. i want to use the same jisko's db for my directory
> search.
>
> Anyway, i will be using the jisko's db as uhave mentioned above, i will
> let you know how it goes.
>
> Also i would like to show an ajax notification to the users who tries to
> search the directory without login in. currently it does not give any
> message out put if they search without registering. i want them to be
> notified if they search.
>
> Regards,
> encore
>
> --
> You received this question notification because you are an answer
> contact for Jisko.
>

--
marcos garcía // <email address hidden>

Revision history for this message
encore (kandiki) said :
#9

Marcos,

i have managed to insert a table to jisko's db and use that as my directory service, and its working fine with no errors. i would like to know how to code my search page as what you have coded in all pages, i mean how to add new functions to db.php for my search page and how the code will look in the search page. im so thrilled to learn these things, appreciate your help on how to do it.

also, will their be any possibility to add a current online users display on the bottom of the side bar? if so appreciate yr help.

Thanx a lot for yr help.
encore

Revision history for this message
Marcos Garcia (marcosgdf) said :
#10

Simply add you functions to the db.php where the other functions are. If you
want to access another function from the class inside a function of the
class, you have to call $this-> instead of $db->

The online counter is alittle bit difficult to do because there is no exact
data available...

El 27/03/2010 15:15, "encore" <email address hidden>
escribió:

Question #103188 on Jisko changed:
https://answers.launchpad.net/jisko/+question/103188

encore post...
i have managed to insert a table to jisko's db and use that as my
directory service, and its working fine with no errors. i would like to
know how to code my search page as what you have coded in all pages, i
mean how to add new functions to db.php for my search page and how the
code will look in the search page. im so thrilled to learn these things,
appreciate your help on how to do it.

also, will their be any possibility to add a current online users
display on the bottom of the side bar? if so appreciate yr help.

Thanx a lot for yr help.

encore

--
You received this question notification because you are an answer
contact for Jisko.

Revision history for this message
encore (kandiki) said :
#11

i want to know how the function code will in the db.php
i did try a lot, but it didnt work for me, so this is what currently i have done.

<h3>Search Contacts Details</h3>
<p>You may search either by first or last name</p>
<form method="post" action="dir?go" id="searchform">
<input type="text" name="sq">
<input type="submit" name="submit" value="Search">
</form>
<?php
define('TITLE', __('eDirectory by MvGeek'));
echo '<div class="header_title">'.__('eDirectory v0.12 alpha').'</div>';

global $db;
global $_USER;
if (!$_USER) header('Location: '.BASE);
else {

if(isset($_POST['submit'])){
if(isset($_GET['go'])){
if(preg_match("/^[a-zA-Z]+/", $_POST['sq'])){
$sq=$_POST['sq'];

$sql="SELECT * FROM dhiraagu WHERE name LIKE '%" . $sq . "%' OR address LIKE '%" . $sq ."%'";
$result=mysql_query($sql);
$numrows=mysql_num_rows($result);

echo "<p>" .$numrows . " results found for " . stripslashes($sq) . "</p>";

//-create while loop and loop through result set
while($row=mysql_fetch_array($result)){

 $name =$row['name'];
 $address=$row['address'];
 $contact=$row['contact'];
 $id=$row['id'];
 $ward=$row['ward'];

//-display the result of the array

echo "<ul>\n";
echo "<li>" . "<a href=\"dir?id=$id\">" .$name . " " . $contact . " " . $ward . " " . $address . "</a></li>\n";
echo "</ul>";
}
}
else{
echo "<p>Please enter a search query</p>";
 }
}
}
}
?>

Revision history for this message
Marcos Garcia (marcosgdf) said :
#12

This:

$sql="SELECT * FROM dhiraagu WHERE name LIKE '%" . $sq . "%' OR address LIKE
'%" . $sq ."%'";
$result=mysql_query($sql);
$numrows=mysql_num_rows($result);

Will look like:

$sql="SELECT * FROM dhiraagu WHERE name LIKE '%" . $sq . "%' OR address LIKE
'%" . $sq ."%'";
$result=$db->send($sql);
$numrows=mysql_num_rows($result);

And this:

global $db;
global $_USER;
if (!$_USER) header('Location: '.BASE);
else {

HAS to be in the top of the file, otherwise it won't work and it will
display an error

Regards, Marcos.

On Sat, Mar 27, 2010 at 3:46 PM, encore <
<email address hidden>> wrote:

> $sql="SELECT * FROM dhiraagu WHERE name LIKE '%" . $sq . "%' OR address
> LIKE '%" . $sq ."%'";
> $result=mysql_query($sql);
> $numrows=mysql_num_rows($result);
>

--
marcos garcía // <email address hidden>