It is also stated in the forum rules as well :)
albanclesh commented: sorry! i didn't read the forum rules before +0
LastMitch commented: You are right. My bad. +7
Zagga commented: Nicely explained +4
It is also stated in the forum rules as well :)
This line:
$txtname = "'. ucwords(strtolower($row ['First.Name'])) . '-'. ucwords(strtolower($row ['Last.Name'])) . ";
should be:
$txtname = ucwords(strtolower($row['First.Name'])) . '-' . ucwords(strtolower($row['Last.Name']));
Or include the file that has the function :)
Should this line:
$this->stmt =execute(array('$this->getName()','$this->getNO()','$this->clocation()'));
Be:
$this->stmt =execute(array($this->getName(),$this->getNO(),$this->clocation()));
@Pritaeas,
You are a legend.
I carried on testing and resolved the issue with the __construct
:
The class:
include 'crud.php';
class navigation {
public function __construct($username, $password, $tableConfig) {
$this->username = $username;
$this->password = $password;
$this->tableConfig = $tableConfig;
}
public function nav($table, $live, $loc) {
/**
* nav returns multiple records from the specified table with conditions
* @param string $table Table name
* @param array $live Set in DB condition to show page 1 = Live, 0 = Not Live
* @return array $loc Set in DB shows location of page in Nav 1 = Top, 0 = Side
*/
$dsn = new crud($this->username, $this->password, $this->tableConfig);
$nav = $dsn->getRecords($table, array('live' => $live, 'loc' => $loc));
$result = count($nav);
$cnt = 0;
$navKey = '<nav><ul>';
while ($cnt < $result) {
foreach ($nav[$cnt] AS $key => $value) {
if (is_numeric($key)) {
unset($key, $value);
} else {
if ($key != 'id' && $key != 'content' && $key != 'live' && $key != 'keywords' && $key != 'metaDesc') {
if ($key == 'title') {
$navKey .= '<li><a href="#">' . $value . '</a></li>';
}
}
unset($key, $value);
}
}
$cnt++;
}
// Facebook include and G+1 code -> see main code page -> put into sep include files for ease of modification
$navKey .= '</ul></nav>';
unset($dsn);
return $navKey;
}
}
And the call:
$navigat = new navigation('XXXXXXXXuser', 'XXXXXXXXXX', $tableConfig);
$top = $navigat->nav('content', 1, 1);
print_r($top);
To be honest there are a lot of books out there, although there are also a lot of very helpful tutorials.
It sounds like a cop out but this goolge search:
Has a lot they you may find very helpful and easy to follow.
As you are starting out, i would shy away from MySQL completely unless you decide to use a PDO wrapper.
If you do get stuck then by almeans drop a thread. The DaniWeb community is second to none when it comes to help and assistance.
Good luck, and happy coding.
@yy886,
This is part of an upload script i put together and using well:
$mime = array('image/gif', 'image/jpeg', 'image/jpg', 'image/png');
if (in_array($_FILES['file']['type'], $mime) == FALSE) {
echo "You are attempting to upload a \"{$_FILES['file']['type']}\" file type. <br/>
This is not permitted.<br/>";
} else {
$mime
is an array that holds the accepted file types, the $_FILE[]['type']
is then checked to see if the uploaded mime type is allowed. If it is not, it is blocked.
Very similar to pixelsoul's example.
Have you got your mime types correct?
Have you checked your error log?
I would suggest adding a try{}
and catch{}
, as you may have an exception, or low value warning that is not showing up due to your settings
EDIT pipped by IIM :):)
Sorted, many thanks fo ryour input Dani:
print $arr[0]['email'];
@LastMitch,
I am validating the mime type before progressing to the resizing OOP Class.
You are correct in the code you supplied, this is in the class functionalilty. I had created a multi array instead of one that i can validate the ['type']
from $_FILES.
So i cahnged the first line to:
$var = array('mimetype1','mimetype2');
And this parsed.
Thank you for your assistance and input. It is greatly received.
I googled and googled to try and find a comprehensive wiki/tut on how to share htdocs across a dual platform.
My base install is Windows 7 64bit, and recently (6wks ago) set up a dual boot.
One thing pained me for a while of not being able to use the current edited files from one system to the other.
So for anyone that is looking to do this, I finally sussed it and have it working :).
Assumptions:
1. You have XAMPP installed on Windws platform
2. You have XAMPP installed on Linux platform
3. You know how to access Terminal in Linux
All text ->
So, first things first we need to modify the way Linux mounts the additional drives/partitions.
Firstly unmount the Windows drive.
This is done using the fstab file. So before we make changes make a back up.
We also need to get the UUID of our other drive (Windows drive) using blkid:
/dev/sda1: LABEL="SYSTEM" UUID="9EC0347FC0346027" TYPE="ntfs"
/dev/sda2: LABEL="OS" UUID="E868357B68354998" TYPE="ntfs"
/dev/sdb1: UUID="4659932c-47e6-431b-8bda-779a3e2efb18" TYPE="ext4"
/dev/sdb5: UUID="8170f6c2-aa22-4b9b-9480-8231665ff232" TYPE="swap"
/dev/sdb6: UUID="783cc8a0-24c3-44cd-9c61-01d51d047099" TYPE="ext4"
/dev/sdb7: UUID="26a38c59-f39c-47eb-b9aa-b15f4355951f" TYPE="ext4"
/dev/sr0: LABEL="Disk1" TYPE="udf"
/dev/sdc1: LABEL="WebDesign" UUID="18C47AFBC47ADB08" TYPE="ntfs"
This will give you output of the UUIDs in use matching the HDDs. Make a note of the long alphanumeric UUID that corresponds to your Windows drive. Then using the editor of your choice (Iam using gedit in this), we are going to tag a line on the very end
…No probs fellow, we all start somewhere.
With videos/pictures i personnally wouldnt store the vid in the SQL table (some do, some dont).
I would store the name, and link to the video only. This reduces the call time and also the size of your table.
This is just the SQL code for the table.
You need to add an additional column for example bday DATE NOT NULL,
Change bday to what you want it to be called
@LastMitch,
Thats the link i couldnt find :)
+1
@kakalahori
You need to install the PHPUnit module. This can be easily done via PEAR
http://pear.php.net/manual/en/installation.getting.php
Or via GIT
https://github.com/sebastianbergmann/phpunit/
I used PEAR in my set up as it also allows access to the pre compiled libraries.
ZF2 is no longer using zf.bat.
If you look over the base tutorial it takes you through how to install:
cd /my-project/dir
git clone git://github.com/zendframework/ZendSkeletonApplication.git
cd ZendSkeletonApplication
php composer.phar self-update
php composer.phar install
This obviously assumes you have composer, and git installed.
Here is a sample tut: http://bigemployee.com/zend-framework-2-simple-web-application-crud-using-ajax-tutorial/ that the above was taken from.
I am looking through ZF2 at the present (and also ZF1), do be careful on the ZF2 tut on the ZF2 website, as there are errors.
I have just gone through this a few times and installed onto Win 7 64Bit within 5 minutes.
Make sure you allow git to amend your PATH, and also ensure you manually add the composer PATH variable
Ok, i feel stupid.
I had:
protected function __initDoctype()
{
$this->bootstrap('view');
SHould be:
protected function _initDoctype()
{
$this->bootstrap('view');
Note the single _
.
@LastMitch,
The link you put unfortunatley is relating to ZF2, i havent ventured on to that as yet.
But thank you for your input. I have seen HELPERS in ZF1 but not got to those, as i am going through a few tutorials and piecing bits together.
DO NOT USE THE MYSQL extension.
Although a lot of tuts will still use this, it has been superceeded by MySQLi.
You could also opt for, and one i use, PDO.
MySQLi basic connection:
$mysqli = new mysqli("localhost", "your_user", "your_password", "your_database");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
else {
..do something wonderful..
}
PDO & MySQL connection:
try
{
$dbh = new PDO('mysql:host=localhost;dbname=DATABASE_NAME', 'your_user', 'your_password');
}
catch (PDOException $e)
{
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
I agree. People are not going to review 1000 lines. Post the code you pinned as the problem
Have you tried just the php snippet:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
$script_url=$_SERVER['PHP_SELF']; //Change this if you want to use this as an include file.
$files_path="./album/"; // Where does the album start? Anything under the directory the script will read. With Trailing slash
$full_server="http://localhost:8080/phAlbum/album"; //Enter the full server path to where the albums start. //With Trailing Slash
I would say it is the same question as LastMitch has pointed out.
Anyway:
$script_url=$_SERVER['PHP_SELF']; //Change this if you want to use this as an include file.
This will telll you all about $_SERVER
: http://php.net/manual/en/reserved.variables.server.php
$files_path="./album/"; // Where does the album start? Anything under the directory the script will read. With Trailing slash
As the comment on the script states: - This is where the gallery starts from
$full_server="http://localhost:8080/phAlbum/album"; //Enter the full server path to where the albums start. //With Trailing Slash
This is the test bed:
localhost
= Local test URL (XAMPP etc)phAlbum
= The folder under htdocs where the script has been putalbum
= folder under /htdocs/phAlbum/ (see album path)
Looking at the README.TXT:
INSTALL INSTRUCTIONS
- Create an empty directory
- Set permissions on directory to 777
- Place 'gallery.php' in the directory
- Navigate to http://www.yoursite.com/yourdir/gallery.php
- The default password is 'admin' (Please change this by opening 'gallery.php' and changing the value of $password)
You need to create the folder album
and chmod.
From my understanding this is not going to work :
if(isset($_POST['emri'])){ $emri=$_POST['emri']}
if(isset($_POST['mbiemri'])){ $emri=$_POST['mbiemri']}
if(isset($_POST['email'])){ $emri=$_POST['email']}
if(isset($_POST['nr'])){ $emri=$_POST['nr']}
if(isset($_POST['adresa'])){ $emri=$_POST['adresa']}
if(isset($_POST['shenime'])){ $emri=$_POST['shenime']}
)
Your SQL is stating that "these fields" & "these values" you cannot use the if(isset...
in this manner.
Try a dynamic SQL statement using:
$_POST as $field => $value
This takes the POST data and puts it into arrays, you would then step through them within you SQL stmt. So field and values are:
INSERT INTO kontakte ('$field[]') values ('$value[]');
*Note tested - this is an idea which you need to adapt
That way it will only use the POST fields that are isset
.
*Side note - you should validate and clean any POST data
@LastMitch,
Think line 7 is wrong way round
echo "<img src='IMAGE/ITEMS/$image_folder_name/{$img['file']}' /><br>\n";
Macromedia has no email ability.
Your test server (XAMP etc) will have this function. You will need to configure it
which one?
Each one.
lets take this on for example:
function check($arr,$name)
{
$found = false;
$c=0;
while(isset($arr[$c])&&!$found)
{
$found = $arr[$c]['item_name'] == $name;
$c++;
}
echo "Check: ".$found.", search for: ".$name.", Count: ".$c;
return $found;
}
the while loop is executing and will echo only once, when the while loop has finished and will use the last result.
function check($arr,$name)
{
$found = false;
$c=0;
while(isset($arr[$c])&&!$found)
{
$found = $arr[$c]['item_name'] == $name;
echo "Check: ".$found.", search for: ".$name.", Count: ".$c;
$c++;
}
return $found;
}
Now it will echo during the loop as it executes. This is common logic.
Look here for explaination:
Would it not make more sense to get a single upload functioning first, then you can modify the coding for multi upload
"\n" -> new line
"\t" -> tab
"\r" -> carriage return
Dude
but i wont a better explain
pritaes is well respected, and has taken time to help you. You clearly have not checked google, nor the search function on this web site.
All of what you are "wanting a better explaination" on is very easily searched via google. You seem to lack a basic understanding of "DO NOT BIT THE HAND THAT FEEDS".
I have watched the last few threads of yours and it appears you have ripped someone elses code and quite clearly do not know how it functions. Have you actually thought of contacting the individual that created it the first time round?
Looking at the site from where the code comes from : http://www.verot.net/php_class_upload_docs.htm
You could use:
$handle->image_watermark_x = 5; //change to fit your needs
$handle->image_watermark_y = 5; //change to fit your needs
Instead of
$handle->image_watermark_position = 'BR';
Which is a fixed predetermined location.
JayJ, have you tried using return
on the variable you want to pass out?
@andyy121
@LastMitch aahhahhahahahaha you are such a big fail the problem wasnt in SELECT ect ect
Good Luck, I don't know what else to say.THIS IS FOR YOUUUUUUUUUUUUUUUU
And that is how you treat people who try and help. Mate you are a sad person. Shooting people down that try and help. Good luck with your coding issues and trying to get help from people.
TWAT
@andyy121:
Quite frankly with the attitude you come on to the forum with i have given up caring.
People on here have help you and pointed you in viable directions, and yet you seem to think everyone on here owes you something.
If it was possible i would have you blocked from my profile, and considering how rude you were on the last thread, good ridence to you.
@Mods,
No offence intended to anyone on here, but this guys attitude sucks.
hey genius this is the code what i have to do????
Firstly, very uncalled for.
Secondly, and I will put this very easy for you as the last 2 time i have said dont seem to register.
IS THE INC FILE IN THE SAME FOLDER AS THE SCRIPT CALLING IT
IS THE CODE YOU HAVE PASTED IN THE SAME FOLDER AS FUNCK.INC.PHP
You are on a forum asking for help, and in my opion not listening to what has been put to you, and being rude.
Yes, well done. Although that will only work if you have short tags enabled other wise you have to use <?php ?>
if($row['banned'] == '1') {
header( 'http://www.awsomechat.comuv.com/ban/userbanned.php' );
} elseif ($row['banned'] == '2'){
header( 'http://www.awsomechat.comuv.com/ban/userbanned.php' );
}
Should these not read
header('location : http://www.awsomechat.comuv.com/ban/userbanned.php' );
&& ( :) )
header('location : http://www.awsomechat.comuv.com/ban/userbanned.php' );
they have different precedence.
True. &&
is before and
- ||
is before or
:)
This should help:
RewriteEngine On
RewriteRule ^([^/]*)$ /pages/fetchpage.php?id=$1 [L]
<?php
// Using PDO
$tbl_name = "forum_question";
$pdo = new PDO('mysql:dbname=test;host=localhost', '', ''); // first '' is user, second '' is password
$stmt = $pdo->prepare("SELECT * FROM $tbl_name where id= :id ORDER BY id DESC");
$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT);
$stmt->execute();
$stmt->setFetchMode(PDO::FETCH_ASSOC);
?>
Your above SQL using PDO, you would then step through the data or display it with something like:
while($row = $stmt->fetch())
{
echo $row['TABLE_COLUMN_1'] . " " . $row['TABLE_COLUMN_2'];
}
'
$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT);
This sanitises the int PDO::PARAM_INT
.
This is order by the id
ORDER BY id
So to do the same using name
and class
you should be able to do this.
Does your 'ipnlistener.php'
have an unclosed }
?
where is your SQL statement?
What uis the content of test.php
?
Your form is incomplete, plus you have a FORM within a FORM. I do not beleive this is viable
I can't figure out why the contact form doesn't send me a notification email telling me someone submitted a form.
You need to call in (include/require_once) when the form is submitted, which triggers an email
I don't know how to send a user a message through their email saying that we got their form submitted.
As above
I can't figure out how to put a message in the same window saying "Thanks for Submitting Form" without putting this on another page.
You could use if(!isset())
so if the form is not submitted you display the form, else you show the "Thanks", with a timed re direct(?).
I can't figure out how to make fields required.
Basic HTML fields????
I can't figure out a solution in putting ways in checking for real emails, so I don't get spammed by users sending fake emails (the email form has to have the @ symbol in order for it to work).
I can't figure out how to allow user's to only send form once.
Login some kind of DB table
If you need help to develop this drop me a PM with further details
<?php
if ($second == "")
{
if($first - $third <= 5)
{
echo "<img src='images/img1.png' />";
}
else
{
echo "<img src='images/img3.png' />";
}
}
else
{
if($first - $second <= 5)
{
echo "<img src='images/img1.png' />";
}
else
{
echo "<img src='images/img2.png' />";
}
}
?>
Img 3 will never show as they way you have your logic <=5
& >5
what else is there?
It will be greater or less than or equal to :)
<form method="post" action="signup-p.php" id="signupform">
<div class="form">
<div class="fieldset">
<input name="signup_form" type="hidden" />
<div class="input">
<label for="username">Username</label>
<input type="text" name="user" id="username" value="" />
</div>
<div class="input">
<label for="email">E-mail</label>
I would suggest changing all the " used in this to '
<?php
$form = "<form method='post' action='signup-p.php' id='signupform'>
<div class='form'>
<div class='fieldset'>
<input name='signup_form' type='hidden' />
<div class='input'>
<label for='username'>Username</label>
<input type='text' name='user' id='username' value='' />
</div>
<div class='input'>
<label for='email'>E-mail</label>
<input type='text' name='email' id='email' value='' />
</div>
<div class='input'>
<label for='email_confirm'>Confirm E-mail</label>
<input type='text' name='email_confirm' id='email_confirm' value='' />
</div>
<div class='input'>
<label for='password'>Password</label>
<input type='password' name='password' id='password' />
</div>
<div class='input'>
<label for='password_confirm'>Confirm password</label>
<input type='password' name='password_confirm' id='password_confirm' />
</div>
</div>
<div class='button'><strong><input type='submit' class='submit' name='registerbtn' value='Sign up' /></strong></div>
</div>
</form>";
?>
You also have not terminated your php usng ;
why is it stating not to use array_reverse()?
What is this for?
You can apply formatting to the email also
id Studentid Department Subject Semester Marks Min Max Total Percentage
1 111819 MBA History Fourth 200 100 200 200 94.93
2 111820 MCA c third 100 40 60 80 67.9
So, to make sure i undestand.
If student with ID 111819 puts in his/her ID you want the Dept/Sub/Marks etc to be displyed?
If your first question is resolved, please vote up :)
You have missed the ";"
<label class="grey" for="firstname">Firstname:</label>
<input class="field" type="text" name="firstname" id="firstname" size="23" value="<?php echo $firstname; ?>"/>