Discount Web Design Blog

Just another Web Design Blog

Entries for the ‘PHP’ Category

PHP includes not showing in page

Hello – I am new to these forums, but I could really use some help with this problem.
I have a menu that lists a bunch of items (unordered list). I need these items to appear (image and description) inside a specific div on my page, when they are chosen in the menu (clicked).

The main page [...]

Basic question on the security of the "post" password submission

I am just beginning design of a site and had a quick question about authentication. The submission of id/password using the standard technique shown is pretty straightforward but is it secure or is this passing the pw as cleartext across the wire and this page should be https?
Any help would be appreciated, I would like [...]

include vs. header

in a php page, I have the code
setcookie("userid", $userid, time() + 3600 * 24 * 30);
setcookie("autosignin", $autosignin, time() + 3600 * 24 * 30);
session_start();
$_SESSION["loggedIn"] = TRUE;
$_SESSION["userid"] = $userid;
$_SESSION["email"] = $email;
$_SESSION["username"] = $username;
$_COOKIE["userid"] = $userid;
$_COOKIE["autosignin"] = $autosignin;
/* include $_SERVER['DOCUMENT_ROOT'] . ‘/cookies.php’;*/
header(’Location: /cookies.php’);
exit();
Cookies.php is a simple page that just echos out variable values. When I uncomment and use [...]

recommendation for RSS php mysql

Hi,
I want to create an RSS feed for my site.
I understand the syntax of an XML file and the tags for RSS.
I also know how to read my mysql files, and know when I need to re-generated the RSS.XML file.
All the info in the RSS would be coming from a table [...]

What is your preferred PHP editor on Windows?

I’ve been using Dreamweaver variants since UltraDev 4 to code PHP and I really like the improvements CS5 has over CS4, but I am curious about the others. I know in the Windows world people have Notepad++, Eclipse, and Netbeans to name a few but I have only tried Notepad++ and Eclipse out of those [...]

selective SELECT?

I want to select some records from a table and display them(let’s illustrate with this example) -:

Code:
$sql=mysql_query("select headline,body from theTable where id=’$id’ order by id DESC");
while($row=mysql_fetch_array($sql))
{
echo "<strong>".$row['headline']."</strong><p/>";
echo $row['body']."<p/>";
}

The code above makes ALL the headlines to be bold,but what i want is to make ONLY the first displayed headline to be bold – not all the [...]

Regex help please – get name/value from html

I’m trying to get the name/value information from input tags in a form. The problem is that the tags are written in unpredictable formats, sometimes the value isn’t specified…

Code:
<input type="text" name="thename" value="the value">
or
<input type="text" name=’thename’ value="the value">
or
<input type="text" NAME="thename" ID="myid" VALUE=’the value’>
or
<input type="text" name="thename">

I’ve come up with the following regular expression:

Code:
/name=['|\"]([\w _]+)['|\"].*value=['|\"](.*?)['|\"]/i

It gets the name [...]

Force back to HTTP (without S) for certain pages

Hi there,
I will really appreciate if someone could give me an advice on what to do. I have 2 pages of my site forced to HTTPS and of course every link in those two pages refers to HTTPS URLs. I would like to make the user redirects back to HTTP version of one page if [...]

$PHP_SELF and include files

Hi,
I am trying to create a contact form that sends a e-mail to a specified e-mail account. Thus far I have been able to send an e-mail through the form. For security reasons and also to filter out rubbish, the data needs to be validated before sending the e-mail.
After a user submits the a [...]

How can a PHP script be used to send an HTML Email message?

I am told that PHP mail(0) function can allow me to send an HTML Email message to any valid email address. The script below is my latest attempt.
I have no idea what email address I should use as the From address. Below I wrote
$headers .= ‘From: <info@globalfreeenterprise.com>’ . "\r\n";
but I don’t see [...]