I looked and looked and worked with them and found other related material.
Anyway thanks for pointing me in the right direction :) .. IM onto my next step :))
if you hit a wall with your new code just be welcome!
I looked and looked and worked with them and found other related material.
Anyway thanks for pointing me in the right direction :) .. IM onto my next step :))
if you hit a wall with your new code just be welcome!
so what did you do with links I gave?
It seems there is issue with server you are using. I would suggest you install WAMP/XAMPP to avoid the issue!
please post your current code and ask from there!
Is there something better i can do w/ the Values before i insert the array into MYSQL ?
What does better means? And w/ is meaningless to my head. Please write full words!
try rebooting server may be (if local). Cant see anything big with code unless you have loops in your "secret" code !
Newbees should learn to use google :)
If you did here is one of results
http://stackoverflow.com/questions/5164930/fatal-error-maximum-execution-time-of-30-seconds-exceeded
Ardav,
It makes sense to me now especially that bitwise operation!
I'd have these levels built on bits:
master = 16
admin = 8
sup'vr = 4
gp = 2
pat. = 1SO if storing levels for an user:
if a gp and a master - value = 2 + 16 = 18
store this in your users table
then when user logged in you can check if they are a gp and should see the gp tab like so:
if($row['level'] & 2){ ..show gp tab... } if($row['level'] & 16){ ..show master tab .. }
etc.
The beauty of this is that you can keep on adding new levels without having to mess up your DB structure.
though didn't ask the question, I got lost as I was reading :)
so does it still give you troubles?
So answer is yes, are we solved? :)
make hidden form element capt_id and make a copy of it in session. When form submitted compare the two. IF they don't match reject form, someone have just tempered to with your form. else process it with variable in session or form (since they are equal)
@ev
Did you understand that? Crickey! I made more sense of a mad Greek taxi driver shouting over his shoulder at me when I was asleep in his cab. :(
I just guessed that he was explaining his project and asking if it was possible to do that with PHP. If I'm wrong, then it does not matter anyway ;)
Maybe I will if I don't find a way to fix it. But I am used to xampp, some configuration, on wamp there migth be some other things I don't know. But thanks of course for this advice also
Actually configuring Wamp is as breeze as right clicking the tray icon and behold all configs are there :)
Yeah it is possible with HTML forms and PHP (sessions)
I believe what you are after is a piece of software called "Mercury". Mercury is a program which allows you to receive and send emails on windows however I'm not sure what the Linux equivalent would be. You would also have to ask your isp for a static ip and do some port forwarding on your modem and/or router for the emails to process through your computer.
Mail Server? I'm sure you don't want to code one. Unless you mean installing mail server or you want to create mailing script!
But I don't know programming so it would take you a lot less time and it is good for everyone because this way you can have free storage of all your videos of your family without storing them on your personal hard drives which can fail and lead to irreparable loss of important videos.
Learn to program first and then move into doing programming projects!
http://www.w3schools.com/php/default.asp
evstevemd, Thanks again for the heredoc pointer.
Enjoy and welcome to Daniweb!
Thanks !! raphie
I have one query also.I have a registration form where i am checking whether the given(by user) email is exist or not.
after googling found some code:
This code is working fine.but i have other validations also.like email format,password same,& empty fields.
want to work my form in proper sequence
i.e.
It checks empty condition,email format,then email availability.
Need help/suggestions
Don't do final validation on JS, it can be easily bypassed. You can do empty variable checks and maybe other but make sure you do final validations at Server side! That is a security note :)
Check directory iterator class. Here is sample code
<?php
$dirIterator = new DirectoryIterator(dirname(__FILE__));
foreach ($dirIterator as $fileInfo) {
if($fileInfo->isDot() || !$fileInfo->isFile()) {
continue;
}
echo "<p>".$fileInfo->getFilename() . "</p>";
}
This appears:
Array ( [link] => www.banner.com [id] => [simpan] => Simpan )
there is no element with name gambar as you can see from array. Either!
Check your HTML form
ending tags and string for values are missing
<input name="nama" size="20px" type="text" value =<?php echo $data['nama_produk']; ?>>
is supposed to be
<input name="nama" size="20px" type="text" value ="<?php echo $data['nama_produk']; ?>"/>
I had to go and fix all unquoted values in your input plus you didnt close much of your html tags
<input ..../> was missing a lot. Take a look of rough fix below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Admin</title>
<link href="admin-style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="includes/navstyleadmin.css" />
<script type="text/javascript" src="includes/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="includes/superfish.js"></script>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<link href="ckeditor/content.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
jQuery(function(){
jQuery('ul.menu').superfish({
animation: {opacity:'show',height:'show'},
speed: 'slow',
autoArrows: true
});
});
</script>
<style type="text/css">
<!--
.style1 {font-size: 12px}
-->
</style>
</head>
<body>
<div id="header">
<p><a href="#">Home </a>| <a href="index.php">Logout </a>| <a href="admin.php">Admin Panel</a></p>
<p> </p>
<p> </p>
<p> </p>
</div>
<div id="search">
<form action="search.php" method="post" name="login" target="_self" id="login" style="style.css" title="search">
<br>
<label>search :
<input type="text" name="search" id="search2" />
</label>
<br />
</form>
</div>
<div id="menu">
<?php //include ("includes/navigation_admin.php"); ?>
<?php //include ("includes/koneksi.php"); ?>
</div>
<?php
// DATA BARU
//if ($_REQUEST[mode]=='edit')
//{extract ($_REQUEST);
//do something
//echo $_REQUEST['id'];
//will give us the valid id from the previous page.
//}
if (empty($_GET['id']))
{
$nama = '';
$kategori = '';
$harga = '';
$deskripsi = '';
}
$nama = isset($_POST['nama']) ? $_POST['nama'] : '';
$kategori = isset($_POST['kategori']) ? $_POST['kategori'] : '';
$harga = isset($_POST['harga']) ? $_POST['harga'] : '';
$gambar = isset($_POST['gambar']) ? $_POST['gambar'] : '';
// SETELAH TOMBOL SIMPAN DI TEKAN
if (isset($_GET['save'])){
$nama = $_GET['nama'];
$kategori = $_GET['kategori'];
$harga = $_GET['harga'];
$gambar = $_GET['gambar'];
/*if (empty($_GET['id'])){
$result = mysql_query("INSERT INTO produk(nama_produk, harga, gambar) VALUES('".$nama."','".$kategori."','".$gambar."')");
}
else{
$result …
if i do this, it works....But is it a good way?
Bad way and here is why
function getArticles() {
global $mysqli;
}
You are using global instance not the one in class. you should user class property instead and remove the global thing
if ($result = $this->mysqli->query($query) )
using prepared statements will easy your code as well as give extra protection against SQL injection
http://devzone.zend.com/article/686
what is your definition of large data?
have you confirmed problem is gone when you comment out CKEditor related code?
couldyou add print_r($_POST); die(); and comment out $gambar = $_POST;
I remember using # comment for Python have never tried that for PHP.
BTTT,
You have mixed HTML and PHP to a point f confusing me, cant help with that. If you need to print something like for use HEREDOC syntax. And goto? Can't beilieve it!
here is clean way of adding html in PHP
$form = <<<EOT
<form action={$_SERVER["PHP_SELF"]} method="post" enctype="multipart/form-data">
<label for="file">Select File...</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
EOT;
echo $form;
you need SSL to be enabled
http://stackoverflow.com/questions/2643462/setting-up-ssl-on-a-local-xampp-apache-server
may be issue is with CKEditor. I have not included it in my JS so it should be in my shot. Try to remove CKEditor codes to confirm that it is a culpit then open new thread specifically for that problem!
line 154:
<textarea name="deskripsi" cols="30" rows="15" value=<?php echo $data['deskripsi']; ?></textarea>
Stripping the PHP Database code everything runs fine
see the shot!
I have this:
Notice: Undefined index: deskripsi in C:\xampp\htdocs\Masterlink\cgoods\product_edit.php on line 154
in side deskripsi text area.
//$data['deskripsi'] = ''; // I have to keep the following disable otherwise, it will show me a text area that are filled with codes or the ckeditor disabled.
error cannot be here. Here you are just adding to array. Try checking where you actually use the array value!
I found a blog docummenting changes in hotmail Auth
require_once('../class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer();
$body = file_get_contents('contents.html');
$body = eregi_replace("[\]",'',$body);
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "mail.yourdomain.com"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "tls"; // sets the prefix to the servier
$mail->Host = "smtp.live.com"; // sets HOTMAIL as the SMTP server
$mail->Port = 25; // alternate is "26" - set the SMTP port for the HOTMAIL server
$mail->Username = "yourusername@hotmail.com"; // HOTMAIL username
$mail->Password = "yourpassword"; // HOTMAIL password
$mail->SetFrom('name@yourdomain.com', 'First Last');
$mail->AddReplyTo("name@yourdomain.com","First Last");
$mail->Subject = "PHPMailer Test Subject via smtp (Hotmail), basic";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$address = "whoto@otherdomain.com";
$mail->AddAddress($address, "John Doe");
$mail->AddAttachment("images/phpmailer.gif"); // attachment
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
Try this with Gmail it dates 2009 and I hope things have not changed
http://www.web-development-blog.com/archives/send-e-mail-messages-via-smtp-with-phpmailer-and-gmail/
This dates 2010
http://www.xtreemhost.com/2010/04/11/how-to-send-e-mails-via-smtp-with-phpmailer-and-gmail/
Try moving $data outside if/else
$data = array();
if(!empty($_GET['id']))
{
$result = mysql_query("SELECT * FROM produk AS p, kategori AS k WHERE id_produk='".mysql_real_escape_string($_GET['id'])."'AND p.id_kategori = k.id_kategori") or die(mysql_error());
$data = mysql_fetch_array($result); //here you define data
}
else
{
$data['nama_produk'] = '';//it skipped data and hence data is undefined
$data['nama_kategori'] = '';
$data['harga'] = '';
//$data['deskripsi'] = '';
$data['gambar'] = '';
}