Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,157,938 members, 7,835,126 topics. Date: Tuesday, 21 May 2024 at 05:13 AM

Ajaxphp7's Posts

Nairaland Forum / Ajaxphp7's Profile / Ajaxphp7's Posts

(1) (2) (of 2 pages)

Webmasters / Re: Upload Picture To The Server. by ajaxphp7: 2:40pm On Jun 30, 2011
thanks so much dualcore you are really a guru. but pls the picture is still not displaying, it is echoing an empty picture box.
thanks
Webmasters / Re: Upload Picture To The Server. by ajaxphp7: 2:39pm On Jun 30, 2011
thanks so much dualcore you are really a guru. but pls the picture is still not displaying, it is echoing an empty picture page.
thanks
Webmasters / Upload Picture To The Server. by ajaxphp7: 2:10pm On Jun 30, 2011
Pls Nairaland webdesigners I need help in this scipt, the script is working well it ensures the right file is uploaded which must be in jpeg,gif, png, and the right file size. When the right file and the size is not exceded it displays
File Uploaded Successfully! Try again![/i] I want the picture to be echoed out, i mean i want the picture to be displayed alongside the File Uploaded Successfully! Try again![i].
Pls what modification do i need to do to the script to get it right.
see script 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=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<?php
//define a maxim size for the uploaded images in Kb
define ("MAX_SIZE","100"wink;

//This function reads the extension of the file. It is used to determine if the file is an image by checking the extension.
function getExtension($str) {
$i = strrpos($str,"."wink;
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}

//This variable is used as a flag. The value is initialized with 0 (meaning no error found)
//and it will be changed to 1 if an errro occures.
//If the error occures the file will not be uploaded.
$errors=0;
//checks if the form has been submitted
if(isset($_POST['Submit']))
{
//reads the name of the file the user submitted for uploading
$image=$_FILES['image']['name'];
//if it is not empty
if ($image)
{
//get the original name of the file from the clients machine
$filename = stripslashes($_FILES['image']['name']);
//get the extension of the file in a lower case format
$extension = getExtension($filename);
$extension = strtolower($extension);
//if it is not a known extension, we will suppose it is an error and will not upload the file,
//otherwise we will do more tests
if (($extension != "jpg"wink && ($extension != "jpeg"wink && ($extension != "png"wink && ($extension != "gif"wink)
{
//print error message
echo '<h1>Unknown extension!</h1>';
$errors=1;
}
else
{
//get the size of the image in bytes
//$_FILES['image']['tmp_name'] is the temporary filename of the file
//in which the uploaded file was stored on the server
$size=filesize($_FILES['image']['tmp_name']);

//compare the size with the maxim size we defined and print error if bigger
if ($size > MAX_SIZE*1024)
{
echo '<h1>You have exceeded the size limit!</h1>';
$errors=1;
}

//we will give an unique name, for example the time in unix time format
$image_name=time().'.'.$extension;
//the new name will be containing the full path where will be stored (images folder)
$newname="C:xampp/htdocs/image1/picture".$image_name;
//we verify if the image has been uploaded, and print error instead
$copied = copy($_FILES['image']['tmp_name'], $newname);
if (!$copied)
{
echo '<h1>Copy unsuccessfull!</h1>';
$errors=1;
}}}}

//If no errors registred, print the success message
if(isset($_POST['Submit']) && !$errors)
{
echo "<h1>File Uploaded Successfully! Try again!</h1>";
}

?>

<!--next comes the form, you must set the enctype to "multipart/frm-data" and use an input type "file" -->
<form name="newad" method="post" enctype="multipart/form-data" action="">
<table>
<tr><td><input type="file" name="image"></td></tr>
<input type="hidden" name="id">
<tr><td><input name="Submit" type="submit" value="Upload image"></td></tr>
</table>
</form>



</body>
</html>
Webmasters / Webdesigners And Graphic Designer Wanted by ajaxphp7: 2:09pm On May 20, 2011
if you know you can teach computer, and you have some years of experience, good in web scripting and web design, graphics
PHP and Mysql
Html, CSS, Dreamwever, fireworks, Flash
Graphics
Corel Draw
Photoshop
Microsoft Office Suite
then why not apply with you Cv attached in microsoft word format to the following email
steve4real19@yahoo.com.
Location: Oshodi, Lagos
Application closes on the 30th may 2011
Webmasters / Re: Connection String To The Server In Php by ajaxphp7: 1:28pm On Mar 12, 2011
Thamks so much for the contribution
Webmasters / Connection String To The Server In Php by ajaxphp7: 12:45pm On Mar 08, 2011
Please tell me what comes first my tied variables or the connection string, I was drawn into an arguement with one of my programming collegue. The connection string to the server or the variable tied to the text fields.

Which is better this

<?php
$names=$_post['names'];
$state=$_post['state'];
$age=$_post['age'];
mysql_pconnect("localhost","username","password"wink;
?>
or this
<?php
mysql_pconnect("localhost","username","password"wink;
$names=$_post['names'];
$state=$_post['state'];
$age=$_post['age'];
?>
Programming / Difference B/w Visual Basic And C++ by ajaxphp7: 7:40pm On Feb 06, 2011
Please programmers in the house I will want to know from you the Vivid difference b/w VB and C++ Thanks
Webmasters / What Is Bad In This Site by ajaxphp7: 5:32pm On Dec 12, 2010
Please Website designer in the house help me criticize and appraise this website where necessary.
www.divineprovidence.net
Webmasters / Re: Inserting Data In Excel Into Mysql Database by ajaxphp7: 2:28pm On Nov 24, 2010
I made a post on this trend so many contributed nicely and somebody is sending me a mail for me to pay money before he can render a help.
Wow, well great any way maybe he can become rich through the process.
any way no vess i go send u mail.
Webmasters / Re: Calling On All Web Design Experts. by ajaxphp7: 3:24pm On Nov 20, 2010
Well, I think I have had such problem in the past as a begginer. The best solution to that problem is make sure you are conversant with the Dhtml that is try to make use of css(cascading style sheet) know how to position your div tag using float, center, and probably absolute. It will help
Webmasters / C++ Is It Invoke On Web by ajaxphp7: 2:31pm On Nov 09, 2010
I have been working with visual basic and php for some years now. But the language C++ seems not to be quite understood by me.
As I dont really know its functionality and its application to the real task in todays world.
Please Webmaster in the house where do I really need C++ as a language is it still invoke in our today world of programming?
Thanks
Webmasters / Re: Transfering Data's From Excel Into Mysql Database(php Guru's Please Help) by ajaxphp7: 1:48pm On Oct 29, 2010
Ok, Thanks I will try it
Webmasters / Import Excel Sheet To Mysql Database by ajaxphp7: 1:25pm On Oct 29, 2010
How do I import Excel sheet to a mysql database.
Pls help
Webmasters / Transfering Data's From Excel Into Mysql Database(php Guru's Please Help) by ajaxphp7: 1:23pm On Oct 29, 2010
Assuming I have records up to 50,000 entered in excel and the company involve has been using excel to keep records for a long period of time, and now they need a system whereby those record can actually be transfered into MYSQL database.
What method can I actually use to implement this.
Somebody should please help
Webmasters / Re: Inserting Data In Excel Into Mysql Database by ajaxphp7: 1:20pm On Oct 29, 2010
Assuming I have Data' s up to 2000 records entered in excel and the company involve has been using excel to keep records for a long period of time, and now they need a system whereby those record can actually be transfered into MYSQL database.
What method can I actually use to implement this.
Webmasters / Inserting Data In Excel Into Mysql Database by ajaxphp7: 6:29pm On Oct 24, 2010
I really want to know if it is possible to insert a data in excel sheet into a MYsql Database.
And please what is the logic in getting it done.
Webmasters / Re: Php Class For Beginners. Question Will Be Treated With High Priority. by ajaxphp7: 4:21pm On Oct 14, 2010
Thanks for all the contribution in Nairaland. quadrillio I actually saw one of your contribution and I am actually doing a project on that
Which is the form that does the posting

<form action="./upload.php" method="post" enctype="multipart/form-data">
<p>
<label for="file">Select a file:</label> <input type="file" name="userfile" id="file">

<button>Upload File</button>
<p>
</form>
The page that does the processing
<?php
// Configuration - Your Options
$allowed_filetypes = array('.jpg','.gif','.bmp','.png'); // These will be the types of file that will pass the validation.
$max_filesize = 524288; // Maximum filesize in BYTES (currently 0.5MB).
$upload_path = './files/'; // The place the files will be uploaded to (currently a 'files' directory).

$filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension).
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename.

// Check if the filetype is allowed, if not DIE and inform the user.
if(!in_array($ext,$allowed_filetypes))
die('The file you attempted to upload is not allowed.');

// Now check the filesize, if it is too large then DIE and inform the user.
if(filesize($_FILES['userfile']['tmp_name']) > $max_filesize)
die('The file you attempted to upload is too large.');

// Check if we can upload to the specified path, if not DIE and inform the user.
if(!is_writable($upload_path))
die('You cannot upload to the specified directory, please CHMOD it to 777.');

// Upload the file to your specified path.
if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename))
echo 'Your file upload was successful, view the file <a href="' . $upload_path . $filename . '" title="Your File">here</a>'; // It worked.
else
echo 'There was an error during the file upload. Please try again.'; // It failed Sad.

?>
That is the code you gave. Please can you help me modify the script in a way that the picture uploaded to the folder in the server can be call up after it has been posted.
A good example is the kind you have in JAMB Website after Posting the form it does the processing and also call it Up on the Page.
Please help.
Webmasters / Re: Protect My Php And Mysq Website(pc Guru And Other Great Php Programmers Help) by ajaxphp7: 3:22pm On Oct 09, 2010
Slyrox2, I have sent you a mail. Check your mail Please.
Webmasters / Protect My Php And Mysq Website(pc Guru And Other Great Php Programmers Help) by ajaxphp7: 10:16am On Oct 08, 2010
As a web programmer how can I actually protect my Web pages from hackers. In all my Php script I can't really tell where my codes sound to be protecting the Pages from being Hack. Is there any special way to it. Please help
Webmasters / Re: Can Php Do It. by ajaxphp7: 3:35pm On Oct 01, 2010
Thanks for The Idea PC-Guru, it helps.
Webmasters / Can Php Do It. by ajaxphp7: 3:44pm On Sep 29, 2010
On a profile page for Registering of Students, in the session, I have two links
1) Register for Student Union
2)See registered Information.
I actually want to make the Link See registered information unactive if Registration has not been carried out.
And also make the link Register for student Union Unactive when Registration has been carried on in the session of the student.
What tool am I supposed to use.
I used php to write the script and using mysql at the back end. Can Php do it?
Any Idea will be appreciated.
Webmasters / Protected Php And Mysql Script by ajaxphp7: 12:29pm On Sep 24, 2010
Please, I really need you people's advice here. I just finish a demo of a site for a client which am not serving as d direct agent but a web development company is. The company actually asked me to do a demo of the site as it is fully done with Php and Mysql database. They want me to give the demo to them so that they can use it to fully gain the project involve.
But, i am seeking you peoples advice because I am afraid my codes can be used and I am dumped along the line. How can I protect my codes from it being used?
Has any of you done such a thing before. Please I will need to learn from the past experience.
Webmasters / Php And Asp by ajaxphp7: 5:36pm On Sep 02, 2010
I code in php and I use Mysql Database also as my back end in developing websites am thinking of may be taking another web development course, and I have in mind asp. Is it a wise choice and what is the advantages asp has over php I know little differences b/w them.
One the cost in hosting with a window server that is hostting a site with asp is costlier
Client hardly ask the language you are developing with, what they want is to see their job done
Is there anything that an asp programmer will be able to achieve that a php programer will not achieve.
Pls help
Webmasters / Re: Website Design Course In Niit. What Hope Do I Have For A First Class Lectures? by ajaxphp7: 5:26pm On Sep 02, 2010
Well, I think 6 months for a website design training will be too much. As I am convince you will not be thought the scipting aspects that is Php and Database Mysql. If you are doing just website design only for 6 months I wonder what you will be learning as Website Designers are not know by the number of months they spent running the programme in an IT school but the number of hours they spent on their system trying to implement.
Webmasters / Re: Html Submit Form.pls Help! by ajaxphp7: 1:03pm On Jul 22, 2010
Send your email I think I have the code that will make it work for you.
It comprises of three files The html Form, The Php file that will do the processing, and a last file for the Success or error page. the last file notify users that their message has been successfully sent.
Webmasters / Re: How Do I Insert A Fash Swf Banner On My Site by ajaxphp7: 1:44pm On Jul 17, 2010
with your div tag where you have your code. Remove all the content of the code you must have entered. In your Div Tag <div><embed src=nameofthefile.swf ></div>. I think that helps, if it doesn't. then reply.
Webmasters / Re: Creating Forms with frontapage 2003 by ajaxphp7: 1:28pm On Jul 17, 2010
Dual Core is a Mentor. You should look at for, I expect you to have learn't something from his story.
Just try to begin from scratch like he Dual core advised. Begin with xHtml, Css, then Php and Myql which will make your form interactive.
Dual Core more grease to your elbow. I like your advise in Nairaland.
Webmasters / Re: Guru In Php by ajaxphp7: 12:59pm On Jun 30, 2010
onye_ngbu thanks very much for your quick response. I just find out that I have to change my pattern of coding when I do it was successful as I am retrieving student information with just the matric no and in my sql database datatype for matricno was changed to int. When I did it that way it was successful, but when I decided to use varchar which is the datatype that matches what I need for matric no even if matric no is found it still display the if error mesage matric no is not found.
<?php 

//Student Matric Number
$matricno = $_GET["matric"];

//variable to hold Student info
$sInfo = "";

//database information
$sDBServer = "localhost";
$sDBName = "studentaffair";
$sDBUsername = "root";
$sDBPassword = "";

//create the SQL query string
$sQuery = "Select * from populate where matricno=$matricno";

//make the database connection
$oLink = mysql_connect($sDBServer,$sDBUsername,$sDBPassword);
@mysql_select_db($sDBName) or $sInfo = "Unable to open database";

if($sInfo == '') {
if($oResult = mysql_query($sQuery) and mysql_num_rows($oResult)>0) {
$aValues = mysql_fetch_array($oResult,MYSQL_ASSOC);
$sInfo = $aValues['matricno']."
".$aValues['firstname']."
".
$aValues['lastname']."
".$aValues['othername']."
".
$aValues['level']."
".$aValues['semester']."
".
$aValues['cgpa']."
".$aValues['course1']."
".
$aValues['course2']."
".$aValues['course3']."
".
$aValues['course4']."
".$aValues['course5']."
".
$aValues['course6']."
".$aValues['course7']."
".
$aValues['course8']."
".$aValues['course9']."
".
$aValues['course10']."
".$aValues['grade1']."
".
$aValues['grade2']."
".$aValues['grade3']."
".
$aValues['grade4']."
".$aValues['grade5']."
".
$aValues['grade6']."
".$aValues['grade7']."
".
$aValues['grade8']."
".$aValues['grade9']."
".
$aValues['grade10']."
".$aValues['code1']."
".
$aValues['code2']."
".$aValues['code3']."
".
$aValues['code4']."
".$aValues['code5']."
".
$aValues['code6']."
".$aValues['code7']."
".
$aValues['code8']."
".$aValues['code9']."
".
$aValues['code10'];
} else {
$sInfo = "Student with Matric Number $matricno doesn't exist.";
}
}

mysql_close($oLink);

?>

that code is working fine if matricno is set to int as datatype but if matricno is changed to varchar it displays matric no not found. Please help me debug it.
Programming / Re: Variable Undefine by ajaxphp7: 11:03am On Jun 29, 2010
Thanks for the contribution beaf. for the question for why I am using like and not "=" it is what I actually have in mind initially to achieve with it. but for now my query has changed bcause of the advice I have gotten from guru's like you and others.
The major problem I am having now is on the last </html> close tag. The error reads, Parse error: parse error in line 50 [color=#990000][/color] which is pointing to the last html close tag.
What are the likely cause of such error message.
Programming / Re: Variable Undefine by ajaxphp7: 6:19pm On Jun 28, 2010
PLEASE, BEAF WHAT DO U MEAN BY THE form variables are not returning null, otherwise don't even bother with the database
Programming / Re: Variable Undefine by ajaxphp7: 6:04pm On Jun 28, 2010
I want to thank beaf alot for the contribution. But what if the variable error is showing null
Webmasters / Re: Guru In Php by ajaxphp7: 5:20pm On Jun 28, 2010
I new that u guys could be helpful not till i start this project. I want to still thank you a lot for the contribution so far
with the last script submited that is the error am having on my browser
Warning: mysql_query() expects parameter 1 to be string, resource given
Warning: mysql_fetch_row() expects parameter 1 to be resource
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, null given

pls i still need ur contribution

(1) (2) (of 2 pages)

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 51
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.