User Can Add Their Own Background Image

Started on the old forum in July 2010 · view the original in the archive · old links redirect here

8 replies · 697 views · started 16 years ago · 1 min read

6 participants
Dj-marc Developer · 164 posts #1

Hey guys. I have been try this whole time to create a code that will allow each user to add their own image in the background of the site but can get it to work. can anyone help me with this please? I was trying to get ideas from the avatar but it aint working.

I use this code in the xhtmlhead

function xhtmlhead($page_title, $page_style="")
{
	$ret = "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
	$ret .= "\n<head>\n<title>$page_title</title>\n";
	$ret .= "<meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\" />";
	$ret .= "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />";
        $ret .= "<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>";
	$ret .= "\n".$page_style;
        $uid = getuid_sid($sid);
        $thinfo = mysql_fetch_array(mysql_query("SELECT background FROM ibwf_users WHERE id='".$uid."'"));
     $ret .="<body background=\"$thinfo[0]\" bgproperties=\"fixed\">";
        $ret .= "<link href=\"http://dj-marc.wen.ru/web/fav2.gif\" rel=\"shortcut icon\" type=\"image/vnd.microsoft.icon\"> </link>";
        //$ret = "<LINK REL="SHORTCUT ICON" HREF="http://dj-marc.wen.ru/web/fav2.gif">";
	$ret .= "\n</head>\n<body>";
	return $ret;
}

I just cant retrieve the info for the body background image

wap2k Developer · 168 posts #2

Does this work?

function xhtmlhead($page_title, $page_style="")
{   
    $sid = $_GET["sid"];
    $uid = getuid_sid($sid);

    $ret = "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
    $ret .= "\n<head>\n<title>$page_title</title>\n";
    $ret .= "<meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\" />";
    $ret .= "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />";
        $ret .= "<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>";
    $ret .= "\n".$page_style;
        
        $thinfo = mysql_fetch_array(mysql_query("SELECT background FROM ibwf_users WHERE id='".$uid."'"));
     $ret .="<body background=\"$thinfo[0]\" bgproperties=\"fixed\">";
        $ret .= "<link href=\"http://dj-marc.wen.ru/web/fav2.gif\" rel=\"shortcut icon\" type=\"image/vnd.microsoft.icon\"> </link>";
        //$ret = "<LINK REL="SHORTCUT ICON" HREF="http://dj-marc.wen.ru/web/fav2.gif">";
    $ret .= "\n</head>\n<body>"; 
    return $ret;
} 
m4ster_v4 Developer · 125 posts #3

Dj-marc wrote: Hey guys. I have been try this whole time to create a code that will allow each user to add their own image in the background of the site but can get it to work. can anyone help me with this please? I was trying to get ideas from the avatar but it aint working.

I use this code in the xhtmlhead

function xhtmlhead($page_title, $page_style="")
{
	$ret = "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
	$ret .= "\n<head>\n<title>$page_title</title>\n";
	$ret .= "<meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\" />";
	$ret .= "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />";
        $ret .= "<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>";
	$ret .= "\n".$page_style;
        $uid = getuid_sid($sid);
        $thinfo = mysql_fetch_array(mysql_query("SELECT background FROM ibwf_users WHERE id='".$uid."'"));
     $ret .="<body background=\"$thinfo[0]\" bgproperties=\"fixed\">";
        $ret .= "<link href=\"http://dj-marc.wen.ru/web/fav2.gif\" rel=\"shortcut icon\" type=\"image/vnd.microsoft.icon\"> </link>";
        //$ret = "<LINK REL="SHORTCUT ICON" HREF="http://dj-marc.wen.ru/web/fav2.gif">";
	$ret .= "\n</head>\n<body>";
	return $ret;
}

I just cant retrieve the info for the body background image

just use it in css ok....

?> $url = "image/haha.gif"; background-image:url("$url");

<?php

Visit my WEBSITE Project: http://www.aspirewap.net

subzero Super moderator Fellow · 3,954 posts #5

u can add

echo "<style type=\"text/css\">";
background-image:url("$url");
echo "</style>";

on the page u want the image.

Before <body>

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

subzero Super moderator Fellow · 3,954 posts #7

add it to all pages then ..

with sql to there pic is hold

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

something else Fellow · 2,296 posts #9

riderz wrote: do u already have the code that u can upload the images or is it what u want now

coz the above codes given u add on all pages then u make ur uploader and it will display ur uploaded images

echo "<style type=\"text/css\">";
     $bg = mysql_fetch_array(mysql_query("SELECT background FROM ibwf_users WHERE id='".$uid."'"));
background-image:url("$bg");
echo "</style>";

then u can use the avatar uploader just modify it to upload it to background

slight error change: background-image:url("$bg"); to background-image:url("$bg[0]");

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close