StirCrazy
-
Posts
75 -
Joined
-
Last visited
Never
Posts posted by StirCrazy
-
-
nice one hegtv ~ onclick="check_fields(regform); return false;" works great.
S.C> -
I've attached the basics of the Registration page i'm working with.
My problem is that when when I use <input type="image"
If some of the registation fields are empty and press 'submit' I get an alert but then it refreshes the screen.
I don't want it to refresh (coz I lose all the information already entered).
When I use <input type="button" this doesn't happen.
Does anyone know why it refreshes?
Cheers folks,
S.C>
[code]
<script language="javascript">
function check_fields(regform) {
errIndicator = 0;
for (i = 1; i<11; i++) {
if ("" == regform.elements[i].value) {
errIndicator = 1;
}
}
if (errIndicator) {
alert("Please fill in all fields");
return 1;
}
if (regform.email.value != regform.email2.value) {
alert("E-Mail Confirmation Failed");
return 3;
}
if (regform.country.value == "no") {
alert("You must choose your country");
return 4;
}
if (regform.agree.checked == false ){
alert('Please accept our Terms of service to continue.');
return 5;
}
regform.submit();
return 0;
}
</script>
<form name="regform" action="index.php?page=register3" method="post">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<div align="center">
<!------- CODE HERE --------->
<br><center><span class="AcceptTos">
I certify that <b>I am a U.K. Resident over the age of 18, and<br>
I agree to the</b> <a class="AcceptTos" href="javascript:popup('tos.php')">Terms of Service</a>: <input type="checkbox" value="0" name="agree"></span>
<br>
<br>
<input type="image" src="images/layout/submit.gif" onclick="check_fields(regform);" value=" Sign Up "></center>
<br>
</form>
</div>
<?php
return(0);
}
[/code] -
cheers guys ~ it always turns out to be summit real simple doesn't it :D
just forgot the [b][color=red]o.[/color][/b]site='$site_prefix'");
DOH!
W.> -
Hi Folks,
I'm back to pick your brains again (or bug the hell outa you with my constant novice questions).
This is the current sql query i'm using:-
$sql = my_query("select g.name, o.date from orders o, gifts g where
o.user_id = '" . mysql_real_escape_string($_SESSION['offers_user']) . "' and g.id=o.gift_id");
I now want it to only pick out the data from the orders tbl where site='$site_prefix' (simply adding it on the end doesn't work)
$sql = my_query("select g.name, o.date from orders o, gifts g where
o.user_id = '" . mysql_real_escape_string($_SESSION['offers_user']) . "' and g.id=o.gift_id [b]and site='$site_prefix'[/b]");
while (list....blah blah blah
Any ideas?
Thanks guys :) -
Luvly job Joe ;D
{$site_prefix}_users sorted it out.
Thanks for the explaination.
S.C> -
I'm trying to sort out a multisite (passport' ish!) registration system for couple of sites i have planned.
I'm trying to add the data into prefixed tables ~ what's wrong with the bit in bold below?
At the moment it's just not writing anything to the database at all.
global $site_prefix;
my_query("insert into [b]$site_prefix . '_users' [/b] (id,username,email,password.....
Many Thanks,
S.C> -
Nice one Barand: (cheers guys) YAY! Soooo glad I found this forum ;D
-
maybe it's just the way I'm writing it but keep getting an error when modifying the below line:-
select count(referrer) from users where referrer='" . mysql_real_escape_string($_SESSION['user']) . "' and activated='y'");
I Need referrer = $_SESSION['user'] and activated to = 'y' or 'v');
Can anyone help?
Many thanks,
S.C> -
Your a good man thorpe (you are a man rite?)
Thanks for your help both of you.
S.C> -
nope ~ 3 different countries.
S.C> -
Thanks for that designationlocutus ~ that does answer another question I had, but that's more .htaccess and how to block 1 or 2 IPs in PHP. I want to block all IPs apart from 3 in PHP.
S.C> -
I have a script that needs to be receive data from 3 possible IP address.
At the moment it's only geared up to use one IP (using below)
if(strncmp("111.111.111.1", $_SERVER["REMOTE_ADDR"], 10) != 0)
{
How would I change this to 3 different IPs?
Thanks Guys
S.C> -
Nice one: all of you :D
Still a novice at this kinda thing ~ just to clarify :: if I had this in the main script, how would I get_IP() both variables.
//-- set variables ready for fraud cookie ////-- START --//
$fraud1=$username;
get_IP();
if (!isset($proxy)) {
$fraud2 = $ip . "|" . "none";
} else {
$fraud2=$ip . "|" . $proxy;
}
//-- END --// -
Hope someone can help ~ I've set up a function to store the users IP address (and proxy it using one) in $ip and $proxy.
below works if I work it directly into the script but not when I get_IP()
Any ideas why? am I meant to specify what variables it returns with?
Cheers,
S.c>
function get_IP() {
if ($_SERVER["HTTP_X_FORWARDED_FOR"]) {
if ($_SERVER["HTTP_CLIENT_IP"]) {
$proxy = $_SERVER["HTTP_CLIENT_IP"];
}
else {
$proxy = $_SERVER["REMOTE_ADDR"];
}
$ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
}
else {
if ($_SERVER["HTTP_CLIENT_IP"]) {
$ip = $_SERVER["HTTP_CLIENT_IP"];
}
else {
$ip = $_SERVER["REMOTE_ADDR"];
}
}
// $ip = Real IP
// if $proxy has a value it is the Proxy IP
return;
} -
Wonder if anyone can help me.
What is the correct syntax for the below?
if $counter is divisible exactly by 3 {
?>
</tr>
<?php
}
Cheers guys,
S.C> -
Wonder if anyone can help me.
I have a page where members can vote using one of serveral radio inputs.
The name="vote_id" with value= 1 to 10
Can anyone help with a simple onclick="xxxxxx();" that if the user fails to choose an option you get an alert saying "Place your vote" and stays on the same page else carry on with the <form>
Does that make any sense? Always be bad at explaining.
Thanks in advance.
S.C> -
Can someone help me with the correct syntax for the following ~ not sure what i'm doing wrong.
trying to call username,sr_classifieds_score,sr_classifieds_pcnt and put them in $username,$score,$percentage
keep getting mysql_fetch_row(): supplied argument is not a valid MySQL result resource on line 15 - list($username,$score,$percentage) = mysql_fetch_row($r);
Thanks in advance.
S.C>
[code]
<?php
$db = "******";
$dbname = "*******";
$dbpass = "********";
$link = mysql_connect ('localhost', $dbname, $dbpass) or die;
@mysql_select_db('$db', $link);
function my_query($sql) {
global $link;
$result = @mysql_query($sql, $link);
if ($result) return $result;
}
$r = my_query("select username,sr_classifieds_score,sr_classifieds_pcnt from user
where userid='$user_id'");
list($username,$score,$percentage) = mysql_fetch_row($r);
@mysql_close( $link );
?>
[/code] -
toplay your a star! thank you ~
when you say URL standards what do you mean? I only chose $id because im guessing google will think it's a session id and not follow the link (which is what I want).
(e.g [a href=\"http://www.domain.com/link.php?id=***url***\" target=\"_blank\"]http://www.domain.com/link.php?id=***url***[/a] )
Thanks again.
S.C> -
I'm trying to get some simple code working and wondered if someone could help me.
Basicly what i need doing is below
<?php
header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$id);
exit;
?>
only some of the links contain www.domain.com and others contain [a href=\"http://www.domain.com\" target=\"_blank\"]http://www.domain.com[/a]
what I need is ...
if $id doesn't have http:// or https:// then add http:// and redirect
if $id does have http:// or https:// then redirect without changing anything.
if $id has no value then carry on with the rest of the code...
Does that make any sense?
S.C> -
sorry I didn't thank you before for your help -
had a play using the info above and managed to get it to work.
Thank you guys.
S.C> -
Wonder if someone can help me:
I already have a login script fully working and have decided to add a banning function.
I want to add to the login code... something along these lines:
$r = my_query("select hold from users where hold='y'");
[b]if user is hold='y' then Location: banned.php[/b]
Sorry, find it hard to explain ~ Can anyone help with the proper syntax?
Kind Regards,
S.C>
[b]Table name: Users | Column: hold | enum ('y','n')[/b] -
I'm guessing this is a .htaccess question...
when i type my site name into google it comes up with www.mysite.com/index.php?page=23 in the search listing.
is there something i can do so that it only gets listed as www.mysite.com and goes to the default index.php
Thanks,
S.C> -
Hi folks,
Hoping someone can help...
Using the method below, is there any way that I can get select.php to open in a new window?
<FORM METHOD="get" ACTION="select.php">
<select name="options" SIZE="1" style="font-size:XX-Small";>
<option value="option1">option1</option>
<option value="option2">option2</option>
</select>
<input type="submit" name="Submit" value=" Login ">
</FORM>
Regards,
S.C> -
$QueryReference = mysql_query($QueryString, $DatabaseConnection) or die;
Is there anything wrong with the way this line is formatted, because I keep getting this error :-
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/library/database.php on line 20
cheers
S.C
definitive email header(!?)
in PHP Coding Help
Posted
Has anyone come up with a definitive header that hotmail will accept?
Using this:-
[CODE]$headers = "From: ".$_POST[sender]." <".$_POST[sender]."> \r\n";
$headers .= "X-Mailer: PHP/" . phpversion(). "\n";
$headers .= "X-Sender-IP: ".$_SERVER["REMOTE_ADDR"]."\n";
$headers .= "Content-Type: text/html";
$subject = "Subject Line";
$description = stripslashes($_POST[msg]);
$message = "<HTML><BODY><P>".$description."</P></BODY></HTML>";
@mail($email,$subject,$message,$headers);[/CODE]
But hotmail doesn't accept any emails using it.
Any ideas?
S.C>