Jump to content
kula

[help]praktikal Trainee

Recommended Posts

ok thanks to null, and amin007 for helping.. by the way, rasenye ade yg tak tau lagi, tapi supervisor aku dah tuka rangka plan.. database kne stay Ms Access tapi programming still gne php.. so far, aku da dapat skit2 coding(tinggal 4 ari.. uwah.. takutnye..)

masalah skang ni:

1) Tak tau nape tapi ble je aku link form kata laluan(.htm) ke process_login(.php) akan jadik camnih..

katalaluan.htm = 1.jpg

click process_login.php = 2.jpg

click run/save file = 3.jpg

2)ble tuka katalaluan(.php) dan click enter ke process_login(.php) kluar plak yang nih...

katalaluan.php = 4.jpg

process_login.php = 5.jpg

anyone knows the solution? please help ASAP if u can.. thanks..

Share this post


Link to post
Share on other sites

php - apche idup ke tak ni?

aku da on apache tapi tak on mysql... pasal aku tak gne mysql.. aku kne gne access.. tau tak nape?

Share this post


Link to post
Share on other sites

Betul tu. PHP macam tak jalan. Cuba check dulu PHP.

Page katalaluan.htm jadi katalaluan.php tu biasa je, dalam apache kita boleh setkan extension .php run as .html. So, nampak macam php tapi sebenarnya bukan.

Check dulu PHP.

Kalau pakai Windows + Apache 2.2 + PHP 5, edit httpd.conf dan load module PHP.

====================================

LoadModule php5_module "C:/php5/php5apache2_2.dll"

====================================

Restart balik web server.

Share this post


Link to post
Share on other sites

haha... btul la kate ko amin.. mmg salah kat url tu.. hm.. da ok da..

so, progress aku camni skang:

1) sabtu ngan ahad aritu aku jmpe lecturer.. tapi tak sangke lecturer aku pn pning tengok aku nyer projek..

so die suggest aku wat gne asp.. kat asp ader connection wizard tuk database.. so lagi snang la nak buat tapi

problem die aku da try running still jadik cam problem kat post1.. da on apache, tukar url ke localhost pn same gak..

so aku assume ni sbab software kurang or pasal engine asp tarak..

2) so skang aku dalam dilema nih.. tak tau nak wat camne.. teruskan ngan projek yg sedia ade, tapi pnuh kekonfusan

dalam coding, or tukar gne asp plak.. nih sebaik aku nye spevisor bagi time lebih skit lagi.. adoi segan aku asik extend tarikh jer.. haha.. yang bawah ni la contoh connection wizard kt dreamweaver tuk asp.. mcam sng skit kn?

asp.jpg

3) leh tak bantu aku cadangkan mane satu langkah yg patut aku buat skang? asp or php?...

_______________------------------------_____________

@someone: thanks dude to check around.. anyway, my programs was an updated version of currently existed and used standalone

systems(this was completely Ms Access application environment).. so i was assign to update it to a web-based system, yet with

Access database(cauze my sperviso are old man and not willing to use modern style of MySQL.. "It's confusing me" <- that what

he said..) so, i've been wasting 1 month to just recreating the same interface(with a slight differ) using macromedia dreamweaver(<-also one of the requirement because the users are old folks whose cant tolerate with modern skill).. and another 1 month waste of time to just learning how to use php/mysql/phpmyadmin(he said he gonna try to use MySQL and agree when i said i want to use MySQL) to find out last week that he insist on using Ms Access because it is simpler(which i believe that he couldnt keep up with MySQL and just using some reason).. so now i hang up on doing ODBC connection.. whats worth is i cant find any tutorial online or offline on how to use odbc with php or even odbc list of command..so, whats stuck me now are all the odbc example turned out to not do well with the code syntax.. this below is the last code that i still used(others are dumped) and still turned out to not be very well..

<?php

// Connects to your Database

$odbc = odbc_connect("SubPlan", "root", "") or die('Could not connect to Database');

//Checks if there is a login cookie

if(isset($_COOKIE['SubPlan_Site']))

//if there is, it logs you in and directes you to the members page

{

$username = $_COOKIE['SubPlan_Site'];

$pass = $_COOKIE['SubPlan_pass'];

$check = odbc_exec($odbc, "SELECT * FROM login WHERE loginID = '$username'")or die(odbc_error());

while($info = odbc_fetch_array($check))

{

if ($pass != $info['katalaluan'])

{

echo "Wrong Password";

}

else

{

header("Location: Carian.php");

}

}

}

//if the login form is submitted

if (isset($_POST['submit'])) { // if form has been submitted

// makes sure they filled it in

if(!$_POST['loginID'] | !$_POST['katalaluan']) {

die('You did not fill in a required field.');

}

// checks it against the database

if (!get_magic_quotes_gpc()) {

$_POST['email'] = addslashes($_POST['email']);

}

$query = odbc_exec($odbc, "SELECT * FROM login WHERE loginID = '".$_POST['loginID']."'") or die (odbc_errormsg());

$check2 = odbc_num_rows($query);

//Gives error if user dosen't exist

if ($check2 == 0) {

die('That user does not exist in our database. <a href=process_daftar.php>Click Here to Register</a>');

}

while($info = odbc_fetch_array( $check ))

{

$_POST['katalaluan'] = stripslashes($_POST['katalaluan']);

$info['katalaluan'] = stripslashes($info['katalaluan']);

$_POST['katalaluan'] = md5($_POST['katalaluan']);

//gives error if the password is wrong

if ($_POST['katalaluan'] != $info['katalaluan']) {

die('Incorrect password, please try again.');

}

else

{

// if login is ok then we add a cookie

$_POST['username'] = stripslashes($_POST['loginID']);

$hour = time() + 3600;

setcookie(SubPlan_Site, $_POST['loginID'], $hour);

setcookie(SubPlan_pass, $_POST['katalaluan'], $hour);

//then redirect them to the members area

header("Location: Carian.php");

}

}

}

else

{

// if they are not logged in

?>

<?php

header("Location:katalaluan.htm");

?>

<?php

}

?>

when i run the code, it becomes like this :

processlogin1.jpg

i checked it and notice that the code (odbc_fetch_array) are unusable in php..

and thats all i have been progressing so far.. still looking for appropriate code..for retrieving data/displaying data/register/add/delete and other code too.. and especially security coding.. so, anything u can help me? thanks in advance..

Share this post


Link to post
Share on other sites

urm.. aku just ader buku manual php(dapat dari lecturer..) tapi nih gne mysql gak.. and ader vcd tutorial phpmyadmin tapi pun mysql gak.. hm.. tau tak kat ne nak dapat list2 code ntuk odbc connection? lagi satu, php connection wizard tu bukan tuk mysql je ke? da try da tadi..

Share this post


Link to post
Share on other sites

hello amin, hehe.. aku da try da care ko tu.. em, akhirnye pale otak aku da tak serabut sangat da.. camnih,

aku gne model ko tuk wat connection, and pastu try edit process login aku jadik something like this

<?php

include 'model_kelas_mdb.php';

if (isset($_POST['submit'])){

$loginID = $_POST['loginID'];

$katalaluan = $_POST['katalaluan'];

}

$kelasMDB = new kelasMDB('SubPlan.mdb');

$kelasMDB->buka_Samb_Data();

$kelasMDB->cetus_Samb_Data("select * from login where loginID = '".$loginID."'");

while ( !$kelasMDB->tamat_Samb_Data() )

{

echo "<b>".$kelasMDB->nilaiMedanMDB('loginID')."</b>";

echo " ";

echo "<b>".$kelasMDB->nilaiMedanMDB('katalaluan')."</b>";

echo '<br>';

$kelasMDB->data_seterusnya();

}

$kelasMDB->tutup_Samb_Data();

?>

which gives output like this.. (yay, its work...!!!^^)

log2.jpg"

and the slackthings is, in the query i put condition 'where' sbab tu tarak rekod selepastu... tapi yg paling penting skali, coding ni dah menunjukkan data dari $_POST <- dapat dari login page (katalaluan.htm) pas ke process_login.php.. hehehe... so ble da buang condition where tu sumer name2 user da kuar..

so skang nih, aku nk tanye skit la, kan ke odbc_fetch_array tu da digantikan dengan yang ni ke?

$this->setRekod = $this->data_ADODB->execute( $strSQL );

sbab kat process login ni aku nak letak satu coding yang leh check loginname dan password yg lbih kurang cam nih...

$query = odbc_exec($odbc, "SELECT * FROM login WHERE loginID = '".$_POST['loginID]."'") or die (odbc_errormsg());

$check2 = odbc_num_rows($query);

while($info = odbc_fetch_array( $check ))

{

$_POST['katalaluan'] = stripslashes($_POST['katalaluan']);

$info['katalaluan'] = stripslashes($info['katalaluan']);

$_POST['katalaluan'] = md5($_POST['katalaluan']);

if ($_POST['katalaluan'] != $info['katalaluan']) {

die('Incorrect password, please try again.');

}

stakat ni ak try tk jadik lagi.. last skali kode die aku da wat camni... masalah die yg nih looping endlessly, pastu terbalik plak.. kalo pengguna tu ade dalam db, baru die loop

echo "Data pengguna ".$_POST['loginID]." tiada dalam senarai. sila register.";

1-1.jpg

kalo pengguna takde dalam db, die just kuar page processlogin.php tapi blank page..

2-1.jpg

yg sblom2 nih sampai tak compare data lgsg terus execute comand redirect page je.. yg ni kode yg last tu..

<?php

include 'model_kelas_mdb.php';

if (isset($_POST['submit'])){

$loginID = $_POST['loginID'];

$katalaluan = $_POST['katalaluan'];

}

$kelasMDB = new kelasMDB('SubPlan.mdb');

$kelasMDB->buka_Samb_Data();

$kelasMDB->cetus_Samb_Data("select * from login where loginID=".$loginID."'");

while ( !$kelasMDB->tamat_Samb_Data() )

{

if ($loginID>0)

header("Location:process_pwd.php");

else

echo "Data pengguna ".$_POST['loginID]." tiada dalam senarai. sila register.";

}

$kelasMDB->tutup_Samb_Data();

?>

aku ingat nak wat satu restricted page yang khas tuk execute list name2 user and password ble user press enter kat loginpage pastu wat codin kt processlogin yg compare kn terus ngan page2 tu je.. tapi lebih kurang same gak ngan yg skarang ni kn? hadoih... naik segan da aku asik2 salah jer... nak tanye kat ko ni smpai da tebal muke ak da.. sebaik ak tngah blaja lg, kalo da grade pn camni halamak.. malu siot.. hehe..

Share this post


Link to post
Share on other sites

thanks amin.. wat mase nih aku ngah try upgrade version php je.. sbab forum kat tizag.com ckap version < 4.1 tak suport odbc fetch array.. nnti kalo da ad progres aku report kt ko eh.. hehe

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...