turn reg link on and off wapdesire v_2 script

Started on the old forum in February 2011 · view the original in the archive · old links redirect here

24 replies · 1,494 views · started 15 years ago · 1 min read

TL;DR · summary of 24 replies
  • - The fix involves changing the value of $results["reg"] to $results["registration"] in the code.
  • - The main page message should be added where the registration link is currently displayed, showing a message instead of redirecting to the register.php page when the registration feature is turned off.
  • - The error "mysql_fetch_array(): supplied argument is not a valid MySQL result resource" suggests there might be an issue with how data from the database is being fetched and used in the code.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

8 participants
brand Senior · 391 posts #1

hi there friends i have been thinking on creating a bit in me settings so when the reg is turned off it takes the link off the login page i was going to use this but would not now what to change

$res=mysql_query("UPDATE users SET automsgs='".$id."' WHERE id='".getuid_sid($sid)."'"); if(($res)&&($id==1)){$main.="<img src="../images/ok.gif" alt="o"/> Auto Msgs Are Now Enabled\n";} else if(($res)&&($id==0)){$main.="<img src="../images/ok.gif" alt="o"/> Auto Msgs Are Now Disabled\n";} else{$main.="<img src="../images/error.gif" alt="o"/> Database error!\n";}

can any one help me out please

i need to so it says when the reg is turned off it will say on the login page reg turned off please try later but want it so it can be turned off in the settings in the tools

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

brand Senior · 391 posts #2

wap2k wrote:

$res=mysql_query("UPDATE users SET reg='".$id."' WHERE id='".getuid_sid($sid)."'");
if(($res)&&($id==1)){
$main.="<img src=\"../images/ok.gif\" alt=\"o\"/><br/>Registration Are Now Enabled\n";
}else if(($res)&&($id==0)){
$main.="<img src=\"../images/ok.gif\" alt=\"o\"/><br/>Registration Are Now Disabled\n";
}else{
$main.="<img src=\"../images/error.gif\" alt=\"o\"/><br/>Database error!\n";
}

And add the reg field to the users database

thanks mate but what do i put on the main page for the link to go off and to show a message

wap2k wrote:

$res=mysql_query("UPDATE users SET reg='".$id."' WHERE id='".getuid_sid($sid)."'");
if(($res)&&($id==1)){
$main.="<img src=\"../images/ok.gif\" alt=\"o\"/><br/>Registration Are Now Enabled\n";
}else if(($res)&&($id==0)){
$main.="<img src=\"../images/ok.gif\" alt=\"o\"/><br/>Registration Are Now Disabled\n";
}else{
$main.="<img src=\"../images/error.gif\" alt=\"o\"/><br/>Database error!\n";
}

And add the reg field to the users database

thanks mate but what do i put on the main page for the link to go off and to show a message

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

brand Senior · 391 posts #3

what i mean is when the reg turns off it takes ys to the reg page but shows this message how would i add this to the main page and make the link go off when reg turned off

if((!registration())||(ipbanned(ip(),browser()))){ echo head_tag("Error!!!",0,0); $title="<img src="./images/error.gif" alt="x"/> Error!!!"; $main=" Sorry You Can Not Register At The Moment Due To Site Being Updated At The Moment Plz Try Again Later Thanks "; $L1="<- $zerokey<a $key0 href="./index.php"><img src="./images/home.gif"/>Back</a>"; echo xhtml($sid,$title,1,$L1,0,0,0,0,0,0,0,$main); echo foot_tag(); exit; }

Added after 4 minutes:

wap2k wrote: Post me a select statment and your reg link and i will post the code you need

this is the link mate -> <a href="./register.php">Register Free</a> ";

and this is the bit of the register.php

if((!registration())||(ipbanned(ip(),browser()))){
echo head_tag("Error!!!",0,0);
$title="<img src=\"./images/error.gif\" alt=\"x\"/><br/><b>Error!!!</b>";
$main="<p align=".align().">Sorry You Can Not Register At The Moment <br/> Due To Site Being Updated At The Moment Plz Try Again Later Thanks</p>";
$L1="<- $zerokey<a $key0 href=\"./index.php\"><img src=\"./images/home.gif\"/>Back</a>";
echo xhtml($sid,$title,1,$L1,0,0,0,0,0,0,0,$main);
echo foot_tag();
exit;
}

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

brand Senior · 391 posts #4

wap2k wrote:

$results = mysql_query("select reg FROM users");
$ArrayReg = mysql_fetch_array($results);
if($ArrayReg["reg"]==1){
echo "> <a href=\"./register.php\">Register Free</a><br/>";
} else {
echo "reg turned off please try later";
}

I think that should work :)

i jsut add this on me main page ya

Added after 5 minutes:

wap2k wrote:

$results = mysql_query("select reg FROM users");
$ArrayReg = mysql_fetch_array($results);
if($ArrayReg["reg"]==1){
echo "> <a href=\"./register.php\">Register Free</a><br/>";
} else {
echo "reg turned off please try later";
}

I think that should work :)

i jsut add this on me main page and got this error

Parse error: syntax error, unexpected T_STRING in /home/****/public_html/index.php on line 50

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

brand Senior · 391 posts #5

wap2k wrote: sorry bro my fault did not know what your script layout is.

Can i see the code above and below were your pasting it. The sniplet is not the problem

mate here is me index.php and me reg page

on the register.txt at the top is where the message is mate when ya turn the reg off in tthe settings mate

and thanks for helping me mate

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

Attachments: index.txt register.txt
brand Senior · 391 posts #6

wap2k wrote: To hide the whole register page

$results = mysql_query("select reg FROM users");
$ArrayReg = mysql_fetch_array($results);
if((!registration())||(ipbanned(ip(),browser())||($ArrayReg["reg"]==0))){
echo head_tag("Error!!!",0,0);
$title="<img src=\"./images/error.gif\" alt=\"x\"/><br/><b>Error!!!</b>";
$maintain = "<p align=".align().">Sorry You Can Not Register At The Moment <br/> Due To Site Being Updated At The Moment Plz Try Again Later Thanks</p>";
$regoff = "<p align=".align().">Sorry You Can Not Register At The Moment <br/> Due To Registration being turned off.</p>";
$main = $ArrayReg["reg"]==1 ? $regoff : $maintain;
$L1="<- $zerokey<a $key0 href=\"./index.php\"><img src=\"./images/home.gif\"/>Back</a>";
echo xhtml($sid,$title,1,$L1,0,0,0,0,0,0,0,$main);
echo foot_tag();
exit;
}

Added after 2 minutes:

Are those file without the changes ?

mate i need it so the link in the index.php wont show when its turned off and shows a message instead of it going to another page mate

Added after 9 minutes:

wap2k wrote: To hide the whole register page

$results = mysql_query("select reg FROM users");
$ArrayReg = mysql_fetch_array($results);
if((!registration())||(ipbanned(ip(),browser())||($ArrayReg["reg"]==0))){
echo head_tag("Error!!!",0,0);
$title="<img src=\"./images/error.gif\" alt=\"x\"/><br/><b>Error!!!</b>";
$maintain = "<p align=".align().">Sorry You Can Not Register At The Moment <br/> Due To Site Being Updated At The Moment Plz Try Again Later Thanks</p>";
$regoff = "<p align=".align().">Sorry You Can Not Register At The Moment <br/> Due To Registration being turned off.</p>";
$main = $ArrayReg["reg"]==1 ? $regoff : $maintain;
$L1="<- $zerokey<a $key0 href=\"./index.php\"><img src=\"./images/home.gif\"/>Back</a>";
echo xhtml($sid,$title,1,$L1,0,0,0,0,0,0,0,$main);
echo foot_tag();
exit;
}

Added after 2 minutes:

Are those file without the changes ?

mate i need it so the link in the index.php wont show when its turned off and shows a message instead of it going to another page mate

this is what i mean mate

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

Attachments: reg.jpg
brand Senior · 391 posts #7

wap2k wrote:

<?php
define('WCS',true);
include('./core/main.inc');
header_type();
addvisitor();
blocked_ip(ip(),0);
blocked_network(network(ip(),"isp"),0);
blocked_browser($_SERVER["HTTP_USER_AGENT"],0);
cleardata();
if(ipbanned(ip(),browser())){
if(!shield(getuid_sid($sid))){
echo head_tag("Ip Blocked!!!",0,0);
echo ipbanned_msg();
echo foot_tag();
exit();
}
}

/////////////////////////INDEX PAGE/////////////////////////

echo head_tag(sitename(),0,0);
$title="<img src=\"./phpThumb/phpThumb.php?src=../images/$logo\" alt=\"".sitename()."\"/><br/>
".date("g:ia",strtotime("-0 hours"))."<br/>".date("l jS F",strtotime("-0 hours"));
$main="<p align=".align().">
<b>Welcome to $sitename<br/></b>
</p>
<div class=".align().">
<form action=\"./login.php?username=$username&password=$password\" method=\"get\">
<b>Username:</b><br/>
<input type=\"text\" name=\"username\" title=\"username\" maxlength=\"12\" size=\"20\"/><br/>
<b>Password:</b><br/>
<input type=\"password\" name=\"password\" title=\"password\" maxlength=\"10\" size=\"20\"/><br/>
<input type=\"submit\" value=\"Login\"/><br/><br/>
<img src=\"./phpThumb/phpThumb.php?src=../images/$banner\" alt=\"-------\"/>
</form>
</div>
<p align=".align().">";

$results = mysql_query("select reg FROM users"); 
$ArrayReg = mysql_fetch_array($results); 
if($ArrayReg["reg"]==0){ 
$main .= "> <a href=\"./register.php\">Register Free</a><br/>"; 
} else { 
$main .= ""; 
} 

$main .= "-> <a href=\"./terms.php\">Terms Of Use</a><br/>
-> <a href=\"http://chat-mania.me.uk/top\">Link Swaps Here</a><br/>
</p>
<p align=".align().">
<b>Online Members:</b> ".getnumonline($sid)."<br/>
<b>Browser:</b> ".browser()."<br/>
<b>Ip:</b> ".ip()."<br/>
<b>Network:</b> ".flag(ip()).network(ip(),"isp")." ".network(ip(),"country")."
</p>";

echo xhtml($sid,$title,0,0,0,0,0,0,0,0,0,$main);
echo foot_tag();
?>

Use that to hide the index link.

thanks m8 thats put me page bk on but get this error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/wapchatt/public_html/index.php on line 40

and the link has gone when reg is on

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

Attachments: reg.jpg
brand Senior · 391 posts #8

wap2k wrote: Did you add the "reg" field to your users database bro

no as the reg is in the settings in the database and when you turn the reg off it gives you the message on that reg page i give you on here

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

brand Senior · 391 posts #9

brand wrote: no as the reg is in the settings in the database and when you turn the reg off it gives you the message on that reg page i give you on here

thanks for ya help mate i just worked it out from what you given me mate thanks very much for all ya help you have jsut given me mate

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

wap2k Developer · 168 posts #10

Your Welcome. So your sure it is working. You haven't just give up have you?

brand Senior · 391 posts #11

brand wrote: no as the reg is in the settings in the database and when you turn the reg off it gives you the message on that reg page i give you on here thanks for ya help mate i just worked it out from what you given me mate thanks very much for all ya help you have jsut given me mate

Added after 5 minutes:

i posted a image mate

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

Attachments: reg.jpg
wap2k Developer · 168 posts #12

This is the first time i failed to help someone. I'm a failure at everything 🙁. Good job working it out yourself dude.

brand Senior · 391 posts #13

wap2k wrote: This is the first time i failed to help someone. I'm a failure at everything 🙁. Good job working it out yourself dude.

we worked it out together mate if it was not for your help i would of never done it so dont be silly you helped all i done was change the bit where it gets the info from database and thats it mate

and thanks for your help

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

wap2010v2 Junior · 44 posts #14

is there any way to to do for the login boxs as well so if the login part is turned off it show a message just like this

brand Senior · 391 posts #15

can some let me now where i am going wrong on this please i done it once with help but can not get it to work now

$main.=" ";

$results = mysql_query("select registration FROM settings"); if($registration["reg"]==0){ $main.="> <a href="./register.php">Register Free</a> "; } else { $main.="reg turned off please try later</br>"; }

i am trying to get this to work on the wapdesire v2 script

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

atef Developer · 224 posts #16

brand wrote: can some let me now where i am going wrong on this please i done it once with help but can not get it to work now

i am trying to get this to work on the wapdesire v2 script

try to remove the dot at $main.

brand Senior · 391 posts #17

atef wrote: try to remove the dot at $main.

$results = mysql_query("select registration FROM settings");
$registration = mysql_fetch_array($results);
if($registration["reg"]==0){
$main.="> <a href=\"./register.php\">Register Free</a><br/>";
} else {
$main.="reg turned off please try later";
}  

i have tryed this as well and i get a error which i posted the first time i tryed this

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

arnage Lead · 811 posts #18

Like this.

$results = mysql_fetch_array(mysql_query("SELECT * FROM settings"));

Here in $registration["reg"], "reg" is a table name.

if($results["reg"]==0){
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
brand Senior · 391 posts #19

arnage wrote: Like this.

$results = mysql_fetch_array(mysql_query("SELECT * FROM settings"));

Here in $registration["reg"], "reg" is a table name.

if($results["reg"]==0){

thanks for helping arnage i have tryed what you have said bit still not working

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

subzero Super moderator Fellow · 3,954 posts #20

You trying to get reg info ? or stop flood ?

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... _______…

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