Solved

PHP Beginner

Posted on 2010-09-21
20
611 Views
Last Modified: 2012-05-10
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
Comment
Question by:akbiro
  • 10
  • 5
  • 4
  • +1
20 Comments
 
LVL 6

Expert Comment

by:collins23
ID: 33725447
how does it appear on the server ? could you send a couple of lines you do not understand ?
0
 

Author Comment

by:akbiro
ID: 33725483
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
 
LVL 6

Expert Comment

by:collins23
ID: 33725568
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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 6

Expert Comment

by:collins23
ID: 33725585
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
 

Author Comment

by:akbiro
ID: 33725592
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
 

Author Comment

by:akbiro
ID: 33725620
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
 
LVL 6

Assisted Solution

by:collins23
collins23 earned 100 total points
ID: 33725700
this appears to be the file with what you want.


require_once ("./modules/core/client_index.php");
0
 
LVL 3

Expert Comment

by:CvD
ID: 33725755
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
 

Author Comment

by:akbiro
ID: 33725771
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
 

Author Comment

by:akbiro
ID: 33725792
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
 
LVL 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 100 total points
ID: 33726016
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
 
LVL 3

Expert Comment

by:CvD
ID: 33726123
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
 

Author Comment

by:akbiro
ID: 33726228
Let me give it a whirl
0
 

Author Comment

by:akbiro
ID: 33726694
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
 
LVL 3

Expert Comment

by:CvD
ID: 33726951
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
 

Author Comment

by:akbiro
ID: 33727016
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
 

Author Comment

by:akbiro
ID: 33727105
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
 
LVL 3

Accepted Solution

by:
CvD earned 200 total points
ID: 33732029
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
 

Author Comment

by:akbiro
ID: 33733259
it's finished...what's up
0
 
LVL 3

Expert Comment

by:CvD
ID: 33738884
no problem here
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

730 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