Welcome! Log In Create A New Profile

Advanced

Prac

Posted by Mac 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Re: Prac
September 19, 2006 02:33PM
From which date can we submit prac ?
Re: Prac
September 20, 2006 09:30PM
Hi Allenvd

To help you understand the preg_replace() function, check out this website:

http://www.tote-taste.de/X-Project/regex/index.php

If anything is still unclear, let me know and I'll see if I can help.

Regarding your code, consider the following:

if (isset($_REQUEST['telw']) // You can check for this if you like, but it should always exist because of the form submit, so there isn't much point.

Maybe try handling each field individually, check all of them, and then notify the user of all errors in one go. As a suggestion:

$errmsg = ""; //Initialise variable to null

if (empty($_REQUEST['telw'])) // Not entered
$errmsg .= "Work telephone number required<p>"; // 1st level err
else // something was entered. lets check further
{
$vtelw = str_replace("(","",$_REQUEST['telw']); // Whatever string manipulation
$vtelw = str_replace("winking smiley","",$vtelw);

if (!is_numeric($vtelw)) // Further check
{
$errmsg .= "Invalid Work Telephone Number<p>";
}
} // Finished with first field

if (empty($_REQUEST['cell'])) // Not entered
$errmsg .= "Cellphone number required<p>"; // 1st level err
else // something was entered. lets check further
{
$vcell = str_replace("(","",$_REQUEST['cell']); // Whatever string manipulation
$vcell= str_replace("winking smiley","",$vcell);

if (!is_numeric($vcell)) // Further check
{
$errmsg .= "Invalid Cellphone Number<p>";
}
} // Finished with second field etc. etc. etc.

if (!$errmsg) // No errors encountered
{
echo "Form processed ok";
// Save to database etc.
}
else
{
echo "The following errors were encountered:<p>";
echo $errmsg;
}

Hope this make sense!

Regards,
Dennis
avatar
Mac
Re: Prac
September 21, 2006 01:06PM
You can submit the prac whenever you are ready.
Re: Prac
September 21, 2006 02:48PM
I've made the prac available on our course site for those students who wish to start with the prac.

Can I get a URL for the site?
Re: Prac
September 21, 2006 05:22PM
Hi Dennis,

Thx for the site reference!

I solved my problem using preg_replace() ....


$ph_search = array("'[/\(/]'","'[/\)/]'"winking smiley;
$ph_replace = array("",""winking smiley;

} elseif (isset($_REQUEST['telh']) && $_REQUEST['telh']!=='' && !is_numeric(preg_replace($ph_search,$ph_replace,$_REQUEST['telh']))) {
$errmsg = "Invalid Home Telephone Number !";



Regards,
Allen
Re: Prac
September 21, 2006 05:23PM
Can I get the database connection spec to update my config file before submitting my prac.

On my previous post ... do we need to incorporate user security/login ?
Re: Prac
September 21, 2006 05:26PM
Hi NicholasP,


Log onto http://www.@#$%&/ to download prac documentation.

Regards,

Allen
avatar
Mac
Re: Prac
September 28, 2006 04:03PM
I've missed some posts due to a user profile change - sorry. I'll provide the detals soon. However, if you're too quick for me, as long as I can change it in one file when marking your project, its OK - I'll change it for you. No points deducted......

Tip. You get 85% if you do 100% of what we require. What do we require? Evidence of application of all that was offered in the course. Include all of that, and you get to 85% (somehow, a lot of students always miss out on the use of .......smiling smiley

Do more than what is asked, and you get the higher marks. So implement whatever extra you want - we want that!

But ultimately, and I may be sticking my neck out here, for me - and I hope for you - it is not about marks. A A++ certificate may look impressive, but more important to me and employers out there - and I trust you as well - is that this course has convinced you that PHP is cool and that you can't wait to learn more. To me that is more important than a mark on a piece of paper.

A secondary milestone for me that this semester's group has achieved is the value of support. Really, I stand in awe of how you guys have supported one another throughout this course. This is in line with the open-source movement, of which PHP and MySQL is family. Keep it up!
Re: Prac
October 10, 2006 09:38AM
Hi,

How does one utilise the [registration] database that is resident on the Unisa servers when coding the prac?
avatar
Mac
Re: Prac
October 11, 2006 07:56AM
You now connect to your localhost database which you created using the structure as provided in the prac letter.

When you send your files to us your code will work with our localhost database, since our db has the same structure as yours. The only thing we may have to change in your code, is the login and password to the database. Therefore it is important that your database connection settings is in one file (call it database.php, for example) and that you include it in all other files that require it. That would result in us only having to change your login and password in one file.
Sorry, only registered users may post in this forum.

Click here to login