• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 625
  • Last Modified:

PHP Beginner

We have a PHP support site, Kayako, that we have on our own servers.  I am a little better than a beginner with .asp and know nothing about PHP.

I want to make some minor changes to a couple of pages and I am at a loss on how to proceed.
When I view the source from the browser, what I want to change is easy...it is simple HTML, but when I look for that same code on my server, I can not recognize it.

What do I need to learn how to make some changes to my webpages.
0
akbiro
Asked:
akbiro
  • 10
  • 5
  • 4
  • +1
3 Solutions
 
collins23Commented:
how does it appear on the server ? could you send a couple of lines you do not understand ?
0
 
akbiroAuthor Commented:
I want to access this page on my server and change some of the Icons.  Here is the link to the page on the server and attached is a snap shot of what I want to change.

http://65.111.176.231/index.php

THANKS
ServiceDesk.jpg
0
 
collins23Commented:
what i asked for was the code for index.php ..

you could upload the parts here of the code that you do not understand.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
collins23Commented:
you can't see the PHP code from the browser (only HTML)

you will have to log into the server that hosts the code and open the index.php file

0
 
akbiroAuthor Commented:
Oh.,..I am sorry.  This is how dumb I am with PHP, I can not find the page on the server.  I know the path to the file, but I do not see an html file...sorry for my ignorance.
0
 
akbiroAuthor Commented:
This is the index.php file
<?php
//=======================================
//###################################
// Kayako Infotech Ltd. - SWIFT Framework
//
// Source Copyright 2001-2008 Kayako Infotech Ltd.
// Unauthorized reproduction is not allowed
// License Number: $%LICENSE%$
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//                   www.kayako.com
//###################################
//=======================================

define("SWIFT_AREA", 40);

// KACT 5/pages/297
require_once ("./swift.php");

/**
* ###############################################
* CSS OUTPUT
* ###############################################
*/
// KACT 5/pages/296
if ($_REQUEST["_ca"] == "css") {
	$template->cache(array('clientcss'));
	header("Content-Type: text/css");
	headerCache();

        // KACT 5/pages/303
	echo $template->displayTemplate("clientcss");
	exit;


/**
* ###############################################
* Other Action
* ###############################################
*/
} else {
	if (!$session->start(SESSION_CLIENT)) {
		// Failed to load session, Create a fresh session over here.
		$session->insertSession(SESSION_CLIENT, 0);
	}

        // KACT 5/pages/294
	if (defined("ISMODERNBILL") && (empty($_SWIFT["session"]["typeid"])))
	{
		$loginresult = $loginshare->authorize($_SESSION["client_email"], $_SESSION["client_password"]);
		if (!$loginresult)
		{
			echo "MB Core Error: Unable to continue, Login Failed";
			exit; // TRFC KACT 5/pages/247
		} // KACT 5/pages/298

	// KACT 5/pages/294
	} else if (defined("ISMODERNBILLV5") && (!empty($CONF["user"]["username"]))) {
		$loginresult = $loginshare->authorize($CONF["user"]["username"], $CONF["user"]["password"]);
		if (!$loginresult)
		{
			echo "MB v5 Core Error: Unable to continue, Login Failed";
			exit; // TRFC KACT 5/pages/247
		} // KACT 5/pages/298

	} else if (defined("ISWHMCS") && (!empty($whmcsuser["userid"]))) {
		$loginresult = $loginshare->authorize($whmcsuser["email"], $whmcsuser["password"]);
		if (!$loginresult)
		{
			echo "WHMCS Core Error: Unable to continue, Login Failed";
			exit; // TRFC KACT 5/pages/247
		} // KACT 5/pages/298
	}


	// ======= LOAD THE USER CREDENTIALS FROM ACTIVE LOGINSHARE MODULE =======

	loginShareLoadUser(); // Loads up user data from active loginshare module

	// Bug #646, escape user full name
	$userDisplayName = htmlspecialchars($_SWIFT["user"]["fullname"]);
	$template->assign("userdisplayname", $userDisplayName);
	//
	
	$loginshare->processUserGroup(); // Checks to see of empty user groups and loads default ones

	$loginshare->loadPermissions(); // Loads up the permissions for active user group

	// ======= MISC ACTIONS =======
	$loginemailcookie = $cookie->getSCookie("loginemail");
	// KACT 5/pages/294
	// KACT 5/pages/297
	if (!empty($loginemailcookie) && $_SWIFT["user"]["loggedin"] == false)
	{
		$loginpasscookie = $cookie->getSCookie("loginpassword");
		$template->assign("cookieloginemail", $loginemailcookie);
		$template->assign("cookieloginpassword", decryptCookiePassword($loginpasscookie));
		$template->assign("cookierememberme", "1");
	}

	// ======= PROCESS THE WIDGETS =======
	require_once ("./includes/Widgets/widgets.php");
	$template->assign("widgets", processWidgets($_widgets));

        // KACT 5/pages/294
	if (empty($_SWIFT["user"]["userid"]) && !empty($_SERVER["QUERY_STRING"]))
	{
                // KACT 5/pages/295
		$template->assign("querystring", iif(!stristr(htmlspecialchars($_SERVER["QUERY_STRING"]), "logout"), htmlspecialchars($_SERVER["QUERY_STRING"])));
	}

	// ======= TRY TO EXECUTE ANY ASSOCIATED EVENTS =======
	if (!$events->triggerEvent(EVENT_CLIENT))
	{
		// Load main page
		require_once ("./modules/core/client_index.php");
	}
}
?>

Open in new window

0
 
collins23Commented:
this appears to be the file with what you want.


require_once ("./modules/core/client_index.php");
0
 
CvDCommented:
When you only need to change icons,
open the web page,
view its source,
find the icon you want to change,
go to the server,
find the image,
copy the image to another filename,
edit the original image file,
reload the webpage.
As you can see, no fuss or difficulty.
0
 
akbiroAuthor Commented:
Ok...I found that.  Now, how do I view it to work on it.  Do I need a special editor.  How did you know where to find this new file
0
 
akbiroAuthor Commented:
CVD, that is good, but I need to change the link, the menu bar at the bottom and the verbiage that goes along with it...so it is easy, but a bit more than just changing icons...thanks
0
 
Ray PaseurCommented:
No special editor needed - you can do it with Notepad if you want.  But you might want to learn something about PHP before you start changing code that already works!  Here are some good learning resources.  First, order this book:
http://www.sitepoint.com/books/phpmysql4/

Then give yourself some time with the PHP online web site.
http://us2.php.net/manual/en/getting-started.php
http://us2.php.net/tut.php
http://www.php.net/links.php

Next, you are probably aware that you're not just dealing with PHP, you're working in a framework.  This search will point you to learning resources for that:
http://lmgtfy.com?q=kayako+swift+framework

Good luck, ~Ray
0
 
CvDCommented:
Ok, I  always use a text editor, that is able to search in directories (UltraEdit).

In the browser view the source and find the link you want to change.
Open your texteditor and let it find that link in the servers root directory.
Open the textfile (if found) and change the link.
If you can't find it in any text file, have a look in the database. The link might be in there. If so, the change should be made in the database.
0
 
akbiroAuthor Commented:
Let me give it a whirl
0
 
akbiroAuthor Commented:
Ok...I am starting to get it...

This is the code from the browser view and I want to find this widget, or page on the server.
Where would I go:


<!-- BEGIN WIDGET: Troubleshooter --> 
			<td width="50%"><table cellspacing="3" cellpadding="1" width="100%" border="0"> 
              <tbody> 
                <tr> 
                  <td valign="top" width="15" nowrap><a href="index.php?_m=troubleshooter&_a=view"><img src="http://65.111.176.231/themes/client_default/troubleshooter.gif" border="0"></a></td> 
                  <td width="98%" align="left" valign="top"><strong><a href="index.php?_m=troubleshooter&_a=view" id="moduletitle">Troubleshooter</a></strong><br /> 
					<span class="smalltext">Use troubleshooter wizards to diagnose and resolve common problems.</span></td> 
                </tr> 
              </tbody> 
            </table></td> 
			<!-- END WIDGET: Troubleshooter --> 

Open in new window

0
 
CvDCommented:
First you must find in which php program the link you are looking for is mentioned (I suspect you are looking to change the reference to troubleshooter.gif).
Next, open the php file in a text editor and change the link in there to the one you want it to be.
Next save the php file.
Lastly reload the page in your browser.
0
 
akbiroAuthor Commented:
Ok...so in the case above, the location link I want to change is:

index.php?_m=troubleshooter&_a=view

and the image link is

http://65.111.176.231/themes/client_default/troubleshooter.gif

I got it MON
0
 
akbiroAuthor Commented:
Ok...I see what to change in the code to redirect the link and to replace the image.  

I traced the path from the index.php to the code below, the widget.  Is the link here and if it is, can you show it to me.
// ======= TROUBLESHOOTER =======
if ($module->isRegistered(MODULE_TROUBLESHOOTER) && $_SWIFT["settings"]["tr_enableclient"] == 1 && $_SWIFT["user"]["permissions"]["perm_canviewtroubleshooter"] != "0")
{
	$_widgets[$index]["icon"] = $_SWIFT["themepath"]."troubleshooter.gif";
	$_widgets[$index]["title"] = $_SWIFT["language"]["troubleshooter"];
	$_widgets[$index]["description"] = $_SWIFT["language"]["desc_troubleshooter"];
	$_widgets[$index]["link"] = "index.php?_m=troubleshooter&_a=view";

	$template->assign("cansearch", true);
	$template->assign("trcansearch", true);

	$index++;
}

Open in new window

0
 
CvDCommented:
What I can see from here it should be revolving around this line:
$_widgets[$index]["icon"] = $_SWIFT["themepath"]."troubleshooter.gif";

Now left's explain something. Variables in php always start with $. Arrays are recognized by there square brackets. So the key element is the array element $_SWIFT["themepath"] since it holds the directoryname where troubleshooter.gif resides.

a. Find the php file that initializes the array element $_SWIFT["themepath"]. It probably resides in some config.php file, but I wouldn't be surprised if it is stored in the database.
b. If in config file: Open that php file, change the initialization to your liking and save the file again.
    if in database: Use a tool or a SQL statement to change the themepath in the database.
c. In the current php file, change the image file name to your liking. This has to be done here, since the name is hardcoded.

Now for the link. The link will start index.php again and feed it some parameters. This works exactly as you would do in HTML. Now, in index.php have a look at what is done with input parameters and search for the values troubleshooter and view. If you have found them, have a look at what actions are taken based upon these values. I wouldn't be surprised if we have to make some modifications there aswell.
0
 
akbiroAuthor Commented:
it's finished...what's up
0
 
CvDCommented:
no problem here
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 10
  • 5
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now