News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Expert SSI FAQ

Started by Tomer, June 28, 2004, 07:31:34 PM

Previous topic - Next topic

[SiNaN]

Quote from: shadownexusruler on June 27, 2008, 02:11:20 PM
i have a question is there a way to pull my forums login in to an tabled layout of my hompage is there a way to add these two things
<?php ssi_login(); ?>
Username:     
Password:     
   
Log Out Function: <?php ssi_logout(); ?> and
Board Stats: <?php ssi_boardStats(); ?>
Total Members: 7
Total Posts: 59
Total Topics: 38
Total Categories: 4
Total Boards: 22

Better modify the functions in the SSI.php. (In my opinion - just for these two functions)
Former SMF Core Developer | My Mods | SimplePortal

shadownexusruler

is there anyone who could show me how to bring up the board stats function

[SiNaN]

Let's try this, add this to your page:

<?php
global $txt;
$totals = ssi_boardStats();

echo '<table>
<tr><td>'
, $txt[488], ': <a href="', $scripturl . '?action=mlist">', $totals['members'], '</a></td></tr>
<tr><td>'
, $txt[489], ': ', $totals['posts'], '</td></tr>
<tr><td>'
, $txt[490], ': ', $totals['topics'], '</td></tr>
<tr><td>'
, $txt[658], ': ', $totals['categories'], '</td></tr>
<tr><td>'
, $txt[665], ': ', $totals['boards'], '</td></tr>
</table>'
;
?>
Former SMF Core Developer | My Mods | SimplePortal

shadownexusruler

what bout the ssi login: <?php ssi_login(); ?>

[SiNaN]

<?php
global
$scripturl, $txt, $user_info, $context;

$array = ssi_login('', 'array');

echo '
<form action="'
, $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '">
<table border="0" cellspacing="1" cellpadding="0" class="ssi_table">
<tr>
<td align="right"><label for="user">'
, $txt[35], ':</label>&nbsp;</td>
<td><input type="text" id="user" name="user" size="9" value="'
, $user_info['username'], '" /></td>
</tr><tr>
<td align="right"><label for="passwrd">'
, $txt[36], ':</label>&nbsp;</td>
<td><input type="password" name="passwrd" id="passwrd" size="9" /></td>
</tr><tr>
<td><input type="hidden" name="cookielength" value="-1" /></td>
<td><input type="submit" value="'
, $txt[34], '" /></td>
</tr>
</table>
</form>'
;
?>
Former SMF Core Developer | My Mods | SimplePortal

shadownexusruler

#125
should i save that in a separate file from my homepage like name the file login.php

what bout  <?php ssi_whosOnline(); ?> and <?php ssi_welcome(); ?>

[SiNaN]

No need for that, just add them to your php file.

Quote from: shadownexusruler on July 01, 2008, 10:53:18 AM
what bout  <?php ssi_whosOnline(); ?> and <?php ssi_welcome(); ?>

What do you mean?

Former SMF Core Developer | My Mods | SimplePortal

shadownexusruler

is there a way to call the function of who's online <?php ssi_whosOnline(); ?> and could i add <?php ssi_welcome(); ?> to th login

estokwa

#128
 i don't know where to post my question.. i can't post my question on the basic SSI FAQ because there is no quick reply section at the bottom though i was log in....
here is my question.... i want to put on my default page just a login nothing else but the login module. i tried the two files on the basic SSI, it only show the user name and password and every time i put my username and password and  hit the enter it will erased the info i entered and that's it.. it will show again the username and password and nothing happen.. no page came out but the two input box for username and password...
hope you can enlighten me with this query.. my apology if i put my question on this topic...
thank you for reading this and giving your inputs...

[SiNaN]

shadownexusruler:

I'm not sure what you mean.

estokwa:

Is it possible to see the page? You say you are not redirected to anywhere, right?
Former SMF Core Developer | My Mods | SimplePortal

bfeo

Any way to prevent page access to guests and members who aren't logged in?

fwitt


adrunkentheory

Hello,

I am trying to execute a custom mysql query but keep getting the error ...
"No Database Selected"

I have setup a table within the SMF database and want to access that information based on $context['user']['username'] data variable.

I have tried using the db_query() function that I see in the SSI.php to no avail. I have tried writing my own function within the SSI.php but still receive the same error.

Now I know there's a database connection happening, but how do I use it to execute my own queries?
SMF v1.1.10
Pubstar Network

metallica48423

posting your code might help -- i also reccommend starting a new topic in this board for the issue :)
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

adrunkentheory

Thank you for that quick reply. Hopefully I won't have to start another thread. I will if I cannot be helped here.

Below is the function I tried...
I did not global any variables cause I didn't know which ones exactly to use.
I also left out the __FILE__ and __LINE__, well because I don't know what they do.

Even with global variables and other attributes added, I still receive the same error, so I figured it was irrelevant.



function get_random_profile() {

$request = db_query("SELECT * FROM mytableprefix_profile", false, false) or die(mysql_error());
$row = mysql_fetch_array($request);

echo $row['cod4_guid'];
//mysql_free_result($request);
}


I also tried using just mysql_query() php function.

Really, I just want to know how to do your most basic query using SSI.php.

Quote from: metallica48423 on January 12, 2009, 03:50:41 PM
posting your code might help -- i also reccommend starting a new topic in this board for the issue :)
SMF v1.1.10
Pubstar Network

metallica48423

You didn't tell MySQL which database you want the data from

$request = db_query("SELECT * FROM {$db_prefix}mytableprefix_profile", false, false) or die(mysql_error());

As for __FILE__, __LINE__ -- leave them there, they're there for debugging so that the error log can pick up the right file and line number for debugging :)
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

adrunkentheory

BOOOOM. Thank you so much man :)

Last question, but not that important.

Originally, my custom table name did not have the same prefix as my forum tables. Is there another way to reference the database. I don't have a problem renaming my custom tables to match the forum structure, but I'm just curious.

Thank you very much again.  ;D
SMF v1.1.10
Pubstar Network

metallica48423

you could do like databasename.tablename

ie: $request = db_query("SELECT * FROM other_forum.mytableprefix_profile", false, false) or die(mysql_error());

where other_forum is the name of the database
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

adrunkentheory

Excellent! Your my SMF super hero.

I can't believe my previous searches didn't come up with anything. After installing SMF and learning about SSI.php doing a custom query using the information provided by $context was one of the first things I wanted to do.  I hope this helps somebody as much as it's helped me as now I am on my way to a completely SMF integrated website  8)

Metallica, best wishes and I can't thank you enough. :)

SMF v1.1.10
Pubstar Network

Acans

blue dream

will this script log you in but not redirect you to your forum

<?php
global
$scripturl, $txt, $user_info, $context;

$array = ssi_login('', 'array');

echo '
<form action="'
, $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '">
<table border="0" cellspacing="1" cellpadding="0" class="ssi_table">
<tr>
<td align="right"><label for="user">'
, $txt[35], ':</label>&nbsp;</td>
<td><input type="text" id="user" name="user" size="9" value="'
, $user_info['username'], '" /></td>
</tr><tr>
<td align="right"><label for="passwrd">'
, $txt[36], ':</label>&nbsp;</td>
<td><input type="password" name="passwrd" id="passwrd" size="9" /></td>
</tr><tr>
<td><input type="hidden" name="cookielength" value="-1" /></td>
<td><input type="submit" value="'
, $txt[34], '" /></td>
</tr>
</table>
</form>'
;
?>
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

Advertisement: